基于WF的意见征集5(浅析)

投票宿主项目,项目名称:toupiao

窗体名称:HFXiangXiXinXi.cs(回复详细信息)

 

HFXiangXiXinXi
 1using System;
 2using System.Collections.Generic;
 3using System.ComponentModel;
 4using System.Data;
 5using System.Drawing;
 6using System.Linq;
 7using System.Text;
 8using System.Windows.Forms;
 9using IClass;
10using Maticsoft.DBUtility;
11using FBBLL;
12
13namespace toupiao
14{
15    public partial class HFXiangXiXinXi : Form
16    {
17        HuaTi hh;
18        FBBLL.BLHuaTi fbht = new BLHuaTi();
19        BLHTHuiFu blhthf = new BLHTHuiFu();
20        public HFXiangXiXinXi(int id)
21        {
22            InitializeComponent();
23            this.Height = 363;
24            hh = fbht.GetModel(id);
25            labHTName.Text = hh.HTName1;
26            List<HTHuiFu> lhthf = new List<HTHuiFu>();
27            lhthf = blhthf.GetModelList(" HTId="+hh.HTID1);
28            for (int i = 0; i < lhthf.Count; i++)
29            {
30                object[] obj = new object[3];
31                obj[0= lhthf[i].HfId1;
32                obj[1= lhthf[i].FBRenName1;
33                obj[2= lhthf[i].FanKuiNeiRong1;
34                dataGridView1.Rows.Add(obj);
35            }
36        }
37
38        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
39        {
40            if (e.ColumnIndex<0)
41            {
42                return;
43            }
44            else
45            {
46                int index=e.RowIndex;
47                this.Height = 692;
48                this.CenterToScreen();
49                btnClance.Hide();
50                groupBox1.Location = new Point(groupBox1.Location.X, 293);
51                txtHTNeiRong.Text = hh.HTNeiRong1;
52                HTHuiFu hthf = new HTHuiFu();
53                hthf = blhthf.GetModel(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
54                txtHuiFuNeiRong.Text = hthf.FanKuiNeiRong1;
55                labHuiFuName.Text = hthf.FBRenName1;
56            }
57        }
58
59        private void button2_Click(object sender, EventArgs e)
60        {
61            this.Close();
62        }
63
64        private void btnClance_Click(object sender, EventArgs e)
65        {
66            this.Close();
67        }
68    }
69}
70

 

窗体名称:HTGuanLi.cs(话题管理)

 

HTGuanLi
  1using System;
  2using System.Collections.Generic;
  3using System.ComponentModel;
  4using System.Data;
  5using System.Drawing;
  6using System.Linq;
  7using System.Text;
  8using System.Windows.Forms;
  9using FBBLL;
 10using IClass;
 11using Maticsoft.DBUtility;
 12using System.Data.SqlClient;
 13using System.Workflow.Runtime;
 14using System.Workflow.Activities;
 15using System.Workflow.Runtime.Hosting;
 16using System.Workflow.Runtime.Tracking;
 17
 18namespace toupiao
 19{
 20    public partial class HTGuanLi : Form,IClass.InterFaces
 21    {
 22        HuaTi hh;
 23        FBBLL.BLHuaTi blht = new BLHuaTi();
 24        WorkflowRuntime wr = new WorkflowRuntime();
 25        WorkflowInstance wfi;
 26        ExternalDataExchangeService edes = new ExternalDataExchangeService();
 27        BLHTHuiFu blhthf = new BLHTHuiFu();
 28        HuaTi hhh;
 29        public HTGuanLi()
 30        {
 31            InitializeComponent();
 32            wr.AddService(edes);
 33            edes.AddService(this);
 34           // wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
 35
 36            WorkflowPersistenceService persistenceService =
 37                        new SqlWorkflowPersistenceService(
 38                        "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
 39            wr.AddService(persistenceService);
 40            
 41            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
 42            wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
 43            wr.StartRuntime();
 44
 45
 46            this.Height = 315;
 47            List<HuaTi> ht = new List<HuaTi>();
 48            ht = blht.GetModelList("");
 49            object[] obj = new object[2];
 50            for (int i = 0; i < ht.Count; i++)
 51            {
 52                obj[0= ht[i].HTID1;
 53                obj[1= ht[i].HTName1;
 54                dgv1.Rows.Add(obj);
 55            }
 56        }
 57
 58        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
 59        {
 60
 61            MessageBox.Show("已经完成此次表决!");
 62        }
 63
 64        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
 65        {
 66            e.WorkflowInstance.TryUnload();
 67        }
 68
 69        private void dgv1_CellClick(object sender, DataGridViewCellEventArgs e)
 70        {
 71            if (e.ColumnIndex < 0)
 72            {
 73                return;
 74            }
 75            else
 76            {
 77                hh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
 78                int index = e.RowIndex;
 79                btnClance1.Hide();
 80                this.Height = 670;
 81                groupBox1.Location = new Point(21249);
 82                this.CenterToScreen();
 83                this.labName.Text = dgv1.Rows[e.RowIndex].Cells[1].Value.ToString();
 84                this.txtNeiRong.Text =hh.HTNeiRong1;
 85                DataSet ds=DbHelperSQL.Query("select count(*) from HTHuiFu where HTId="+dgv1.Rows[e.RowIndex].Cells[0].Value.ToString());
 86                string str = ds.Tables[0].Rows[0][0].ToString();
 87                if (hh.State1==0)
 88                {
 89                    labMessage.Text="表决正在进行中.";
 90                    labMessage.Text+="已经有"+str+"人表决完毕";
 91                    button3.Enabled = true;
 92                }
 93                else
 94                {
 95                    labMessage.Text = "表决已经完成..所有人已经完成表决";
 96                    button3.Enabled = false;
 97                }
 98
 99            }
100        }
101
102        private void btnClance1_Click(object sender, EventArgs e)
103        {
104            this.Close();
105        }
106
107        private void button2_Click(object sender, EventArgs e)
108        {
109            this.Close();
110        }
111
112        private void button1_Click(object sender, EventArgs e)
113        {
114            HFXiangXiXinXi hfxx = new HFXiangXiXinXi(hh.HTID1);
115            hfxx.Show();
116        }
117
118        private void button3_Click(object sender, EventArgs e)
119        {
120            this.Height = 315;
121            groupBox1.Location = new Point(21249+46);
122            btnClance1.Show();
123            IClass.Master mm = new IClass.Master();
124            List<IClass.Master> lm = new List<IClass.Master>();
125            FBBLL.Master blm = new FBBLL.Master();
126            lm = blm.GetModelList(" flage=" + hh.HTID1);
127            mm = lm[0];
128            wfi = wr.GetWorkflow(new Guid(mm.Id));
129            eve1(nullnew pargme(new Guid(mm.Id), hh.HTID1, true));
130            hh.State1 = 1;
131            blht.Update(hh);
132        }
133
134        InterFaces 成员#region InterFaces 成员
135
136        public event EventHandler<ExternalDataEventArgs> eve1;
137
138        public void callroupiao(object flage)
139        {
140            MessageBox.Show("已经完成话题为"+flage.ToString()+"的表决!");
141        }
142
143        #endregion
144    }
145}
146

 

窗体名称:Main.cs(发布话题)

 

Main
  1using System;
  2using System.Collections.Generic;
  3using System.ComponentModel;
  4using System.Data;
  5using System.Drawing;
  6using System.Linq;
  7using System.Text;
  8using System.Windows.Forms;
  9using FBBLL;
 10using IClass;
 11using System.Workflow.Activities;
 12using System.Workflow.Runtime;
 13using System.Workflow.Runtime.Hosting;
 14using Maticsoft.DBUtility;
 15using System.Workflow.Runtime.Tracking;
 16
 17namespace toupiao
 18{
 19    public partial class Main : Form,IClass.InterFaces
 20    {
 21        FBBLL.BLHuaTi blht = new BLHuaTi();
 22        WorkflowRuntime wr;
 23        WorkflowInstance wfi;
 24        ExternalDataExchangeService edes=new ExternalDataExchangeService();
 25
 26
 27
 28
 29        public Main()
 30        {
 31            InitializeComponent();
 32
 33            wr = new WorkflowRuntime();
 34            wr.AddService(edes);
 35            edes.AddService(this);
 36            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
 37            wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
 38            //wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
 39            WorkflowPersistenceService persistenceService =
 40                        new SqlWorkflowPersistenceService(
 41                       "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
 42            
 43            wr.AddService(persistenceService);
 44            wr.StartRuntime();
 45        }
 46
 47        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
 48        {
 49            MessageBox.Show("表决完成");
 50        }
 51
 52        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
 53        {
 54           e.WorkflowInstance.TryUnload();
 55        }
 56
 57        private void button1_Click(object sender, EventArgs e)
 58        {
 59            FBBLL.Master mm = new FBBLL.Master();
 60
 61
 62            wfi = wr.CreateWorkflow(typeof(zhuangtaiji.Workflow1));
 63            wfi.Start();
 64
 65
 66
 67            HuaTi ht = new HuaTi();
 68            ht.HTName1 = txtHTName.Text.ToString();
 69            ht.HTNeiRong1 = txtHTNeiRong.Text.ToString();
 70            ht.State1 = 0;
 71            ht.Dt = DateTime.Now;
 72            blht.Add(ht);
 73            List<HuaTi> h1 = new List<HuaTi>();
 74            h1 = blht.GetModelList(" HTName='" + ht.HTName1 + "' and State=0");
 75            IClass.Master m = new IClass.Master(wfi.InstanceId.ToString(), false, h1[0].HTID1);
 76            mm.Add(m);
 77          //  eve1(null,new ExternalDataEventArgs(wfi.InstanceId));
 78            MessageBox.Show("发布话题成功!");
 79             //eve1(null, new ExternalDataEventArgs(wfi.InstanceId));
 80            wfi.TryUnload();
 81        }
 82
 83        private void button2_Click(object sender, EventArgs e)
 84        {
 85            HTGuanLi htgl = new HTGuanLi();
 86            htgl.Show();
 87        }
 88
 89        private void txtNumber_KeyPress(object sender, KeyPressEventArgs e)
 90        {
 91            if (e.KeyChar>='0' &&e.KeyChar<='9')
 92            {
 93                e.Handled = false;
 94            }
 95            else if (e.KeyChar==8)
 96            {
 97                e.Handled = false;
 98            }
 99            else
100            {
101                e.Handled = true;
102            }
103        }
104
105        private void Main_FormClosing(object sender, FormClosingEventArgs e)
106        {
107
108        }
109
110        InterFaces 成员#region InterFaces 成员
111
112        public event EventHandler<ExternalDataEventArgs> eve1;
113
114        public void callroupiao(object flage)
115        {
116            throw new NotImplementedException();
117        }
118
119        #endregion
120    }
121}
122

 

配置文件:App.config

 

1 <? xml version="1.0" encoding="utf-8"  ?>
2 < configuration >
3    < appSettings >
4      < add  key ="SQL2000"  value ="server=192.168.1.3;database=asd;uid=sa"   />
5    </ appSettings >
6 </ configuration >

 

投票用户宿主项目,项目名称:User

配置文件:App.config

 

1 <? xml version="1.0" encoding="utf-8"  ?>
2 < configuration >
3    < appSettings >
4      < add  key ="SQL2000"  value ="server=192.168.1.3;database=asd;uid=sa"   />
5    </ appSettings >
6 </ configuration >

 

窗体名称:UserMain.cs(用户投票窗体)

 

UserMain
  1using System;
  2using System.Collections.Generic;
  3using System.ComponentModel;
  4using System.Data;
  5using System.Drawing;
  6using System.Linq;
  7using System.Text;
  8using System.Windows.Forms;
  9using Maticsoft.DBUtility;
 10using IClass;
 11using FBBLL;
 12using System.Workflow.Activities;
 13using System.Workflow.Runtime;
 14using System.Workflow.Runtime.Hosting;
 15using System.Workflow.Runtime.Tracking;
 16
 17namespace User
 18{
 19    public partial class UserMain : Form,IClass.InterFaces
 20    {
 21        #region 
 22        WorkflowRuntime wr = new WorkflowRuntime();
 23        WorkflowInstance wfi;
 24        ExternalDataExchangeService edes = new ExternalDataExchangeService();
 25        BLHuaTi blht = new BLHuaTi();
 26        BLHTHuiFu blhthf = new BLHTHuiFu();
 27        HuaTi hhh;
 28        public UserMain()
 29        {
 30            InitializeComponent();
 31            wr.AddService(edes);
 32            edes.AddService(this);
 33            WorkflowPersistenceService persistenceService =
 34                        new SqlWorkflowPersistenceService(
 35                        "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
 36            wr.AddService(persistenceService);
 37            //wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
 38            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
 39            wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
 40            wr.StartRuntime();
 41
 42            this.Height = 343;
 43            List<HuaTi> lht = new List<HuaTi>();
 44            lht = blht.GetModelList("");
 45            for (int i = 0; i < lht.Count; i++)
 46            {
 47                if (lht[i].State1==0)
 48                {
 49                    object[] obj = new object[2];
 50                    obj[0= lht[i].HTID1;
 51                    obj[1= lht[i].HTName1;
 52                    dgv1.Rows.Add(obj);
 53                }                
 54            }
 55        }
 56
 57        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
 58        {
 59            e.WorkflowInstance.TryUnload();
 60        }
 61
 62        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
 63        {
 64            MessageBox.Show("此次投票已经完成");
 65        }
 66
 67        private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 68        {
 69            if (e.RowIndex<0)
 70            {
 71                return;
 72            }
 73            else
 74            {
 75               
 76                this.Height = 732 - 46;
 77                groupBox1.Location = new Point(groupBox1.Location.X, 265);
 78                hhh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
 79                labHTName.Text = hhh.HTID1.ToString();
 80                txtHuTiNeiRong.Text = hhh.HTNeiRong1;
 81            }
 82        }
 83
 84        private void button1_Click(object sender, EventArgs e)
 85        {
 86            Application.Exit();
 87        }
 88        #endregion
 89        private void button2_Click(object sender, EventArgs e)
 90        {
 91            IClass.Master mm = new IClass.Master();
 92            List<IClass.Master> lm = new List<IClass.Master>();
 93            FBBLL.Master blm = new FBBLL.Master();
 94            lm = blm.GetModelList(" flage="+hhh.HTID1);
 95            mm = lm[0];
 96            wfi = wr.GetWorkflow(new Guid(mm.Id));
 97            
 98            HTHuiFu hthf = new HTHuiFu();
 99            if (cbx1.Checked)
100            {
101                hthf.FBRenName1 = "匿名";
102            }
103            else
104            {
105                hthf.FBRenName1 = txtName.Text.ToString();
106            }
107            hthf.HTId1 = hhh.HTID1;
108            hthf.FanKuiNeiRong1 = textBox1.Text.ToString();
109            blhthf.Add(hthf);
110            eve1(nullnew pargme(new Guid(mm.Id), hhh.HTID1,false));
111
112        }
113
114        private void button3_Click(object sender, EventArgs e)
115        {
116            Application.Exit();
117        }
118
119        private void cbx1_CheckedChanged(object sender, EventArgs e)
120        {
121            if (cbx1.Checked)
122            {
123                txtName.Text = "";
124                txtName.ReadOnly = true;
125            }
126            else
127            {
128                txtName.Text = "";
129                txtName.ReadOnly = false;
130            }
131        }
132
133        InterFaces 成员#region InterFaces 成员
134
135        public event EventHandler<ExternalDataEventArgs> eve1;
136
137        public void callroupiao(object flage)
138        {
139            HuaTi h = hhh;
140            h.HTID1 = Convert.ToInt32(flage);
141            h.State1 = 1;
142            FBBLL.BLHuaTi blht = new BLHuaTi();
143            blht.Update(h);
144        }
145
146        #endregion
147    }
148    
149}
150

 

 

基于WF的意见征集1(浅析)
基于WF的意见征集2(浅析)
基于WF的意见征集3(浅析)
基于WF的意见征集4(浅析)
基于WF的意见征集6(浅析)
基于WF的意见征集7(浅析)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值