基于WF的意见征集5(浅析)
投票宿主项目,项目名称:toupiao
窗体名称:HFXiangXiXinXi.cs(回复详细信息)

 HFXiangXiXinXi
HFXiangXiXinXi1
 using System;
using System;2
 using System.Collections.Generic;
using System.Collections.Generic;3
 using System.ComponentModel;
using System.ComponentModel;4
 using System.Data;
using System.Data;5
 using System.Drawing;
using System.Drawing;6
 using System.Linq;
using System.Linq;7
 using System.Text;
using System.Text;8
 using System.Windows.Forms;
using System.Windows.Forms;9
 using IClass;
using IClass;10
 using Maticsoft.DBUtility;
using Maticsoft.DBUtility;11
 using FBBLL;
using FBBLL;12

13
 namespace toupiao
namespace toupiao14


 {
{15
 public partial class HFXiangXiXinXi : Form
    public partial class HFXiangXiXinXi : Form16

 
     {
{17
 HuaTi hh;
        HuaTi hh;18
 FBBLL.BLHuaTi fbht = new BLHuaTi();
        FBBLL.BLHuaTi fbht = new BLHuaTi();19
 BLHTHuiFu blhthf = new BLHTHuiFu();
        BLHTHuiFu blhthf = new BLHTHuiFu();20
 public HFXiangXiXinXi(int id)
        public HFXiangXiXinXi(int id)21

 
         {
{22
 InitializeComponent();
            InitializeComponent();23
 this.Height = 363;
            this.Height = 363;24
 hh = fbht.GetModel(id);
            hh = fbht.GetModel(id);25
 labHTName.Text = hh.HTName1;
            labHTName.Text = hh.HTName1;26
 List<HTHuiFu> lhthf = new List<HTHuiFu>();
            List<HTHuiFu> lhthf = new List<HTHuiFu>();27
 lhthf = blhthf.GetModelList(" HTId="+hh.HTID1);
            lhthf = blhthf.GetModelList(" HTId="+hh.HTID1);28
 for (int i = 0; i < lhthf.Count; i++)
            for (int i = 0; i < lhthf.Count; i++)29

 
             {
{30
 object[] obj = new object[3];
                object[] obj = new object[3];31
 obj[0] = lhthf[i].HfId1;
                obj[0] = lhthf[i].HfId1;32
 obj[1] = lhthf[i].FBRenName1;
                obj[1] = lhthf[i].FBRenName1;33
 obj[2] = lhthf[i].FanKuiNeiRong1;
                obj[2] = lhthf[i].FanKuiNeiRong1;34
 dataGridView1.Rows.Add(obj);
                dataGridView1.Rows.Add(obj);35
 }
            }36
 }
        }37

38
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)39

 
         {
{40
 if (e.ColumnIndex<0)
            if (e.ColumnIndex<0)41

 
             {
{42
 return;
                return;43
 }
            }44
 else
            else45

 
             {
{46
 int index=e.RowIndex;
                int index=e.RowIndex;47
 this.Height = 692;
                this.Height = 692;48
 this.CenterToScreen();
                this.CenterToScreen();49
 btnClance.Hide();
                btnClance.Hide();50
 groupBox1.Location = new Point(groupBox1.Location.X, 293);
                groupBox1.Location = new Point(groupBox1.Location.X, 293);51
 txtHTNeiRong.Text = hh.HTNeiRong1;
                txtHTNeiRong.Text = hh.HTNeiRong1;52
 HTHuiFu hthf = new HTHuiFu();
                HTHuiFu hthf = new HTHuiFu();53
 hthf = blhthf.GetModel(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                hthf = blhthf.GetModel(Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()));54
 txtHuiFuNeiRong.Text = hthf.FanKuiNeiRong1;
                txtHuiFuNeiRong.Text = hthf.FanKuiNeiRong1;55
 labHuiFuName.Text = hthf.FBRenName1;
                labHuiFuName.Text = hthf.FBRenName1;56
 }
            }57
 }
        }58

59
 private void button2_Click(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)60

 
         {
{61
 this.Close();
            this.Close();62
 }
        }63

64
 private void btnClance_Click(object sender, EventArgs e)
        private void btnClance_Click(object sender, EventArgs e)65

 
         {
{66
 this.Close();
            this.Close();67
 }
        }68
 }
    }69
 }
}70

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

 HTGuanLi
HTGuanLi1
 using System;
using System;2
 using System.Collections.Generic;
using System.Collections.Generic;3
 using System.ComponentModel;
using System.ComponentModel;4
 using System.Data;
using System.Data;5
 using System.Drawing;
using System.Drawing;6
 using System.Linq;
using System.Linq;7
 using System.Text;
using System.Text;8
 using System.Windows.Forms;
using System.Windows.Forms;9
 using FBBLL;
using FBBLL;10
 using IClass;
using IClass;11
 using Maticsoft.DBUtility;
using Maticsoft.DBUtility;12
 using System.Data.SqlClient;
using System.Data.SqlClient;13
 using System.Workflow.Runtime;
using System.Workflow.Runtime;14
 using System.Workflow.Activities;
using System.Workflow.Activities;15
 using System.Workflow.Runtime.Hosting;
using System.Workflow.Runtime.Hosting;16
 using System.Workflow.Runtime.Tracking;
using System.Workflow.Runtime.Tracking;17

18
 namespace toupiao
namespace toupiao19


 {
{20
 public partial class HTGuanLi : Form,IClass.InterFaces
    public partial class HTGuanLi : Form,IClass.InterFaces21

 
     {
{22
 HuaTi hh;
        HuaTi hh;23
 FBBLL.BLHuaTi blht = new BLHuaTi();
        FBBLL.BLHuaTi blht = new BLHuaTi();24
 WorkflowRuntime wr = new WorkflowRuntime();
        WorkflowRuntime wr = new WorkflowRuntime();25
 WorkflowInstance wfi;
        WorkflowInstance wfi;26
 ExternalDataExchangeService edes = new ExternalDataExchangeService();
        ExternalDataExchangeService edes = new ExternalDataExchangeService();27
 BLHTHuiFu blhthf = new BLHTHuiFu();
        BLHTHuiFu blhthf = new BLHTHuiFu();28
 HuaTi hhh;
        HuaTi hhh;29
 public HTGuanLi()
        public HTGuanLi()30

 
         {
{31
 InitializeComponent();
            InitializeComponent();32
 wr.AddService(edes);
            wr.AddService(edes);33
 edes.AddService(this);
            edes.AddService(this);34
 // wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
           // wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));35

36
 WorkflowPersistenceService persistenceService =
            WorkflowPersistenceService persistenceService =37
 new SqlWorkflowPersistenceService(
                        new SqlWorkflowPersistenceService(38
 "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
                        "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");39
 wr.AddService(persistenceService);
            wr.AddService(persistenceService);40
 
            41
 wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);42
 wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);43
 wr.StartRuntime();
            wr.StartRuntime();44

45

46
 this.Height = 315;
            this.Height = 315;47
 List<HuaTi> ht = new List<HuaTi>();
            List<HuaTi> ht = new List<HuaTi>();48
 ht = blht.GetModelList("");
            ht = blht.GetModelList("");49
 object[] obj = new object[2];
            object[] obj = new object[2];50
 for (int i = 0; i < ht.Count; i++)
            for (int i = 0; i < ht.Count; i++)51

 
             {
{52
 obj[0] = ht[i].HTID1;
                obj[0] = ht[i].HTID1;53
 obj[1] = ht[i].HTName1;
                obj[1] = ht[i].HTName1;54
 dgv1.Rows.Add(obj);
                dgv1.Rows.Add(obj);55
 }
            }56
 }
        }57

58
 void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)59

 
         {
{60

61
 MessageBox.Show("已经完成此次表决!");
            MessageBox.Show("已经完成此次表决!");62
 }
        }63

64
 void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)65

 
         {
{66
 e.WorkflowInstance.TryUnload();
            e.WorkflowInstance.TryUnload();67
 }
        }68

69
 private void dgv1_CellClick(object sender, DataGridViewCellEventArgs e)
        private void dgv1_CellClick(object sender, DataGridViewCellEventArgs e)70

 
         {
{71
 if (e.ColumnIndex < 0)
            if (e.ColumnIndex < 0)72

 
             {
{73
 return;
                return;74
 }
            }75
 else
            else76

 
             {
{77
 hh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                hh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));78
 int index = e.RowIndex;
                int index = e.RowIndex;79
 btnClance1.Hide();
                btnClance1.Hide();80
 this.Height = 670;
                this.Height = 670;81
 groupBox1.Location = new Point(21, 249);
                groupBox1.Location = new Point(21, 249);82
 this.CenterToScreen();
                this.CenterToScreen();83
 this.labName.Text = dgv1.Rows[e.RowIndex].Cells[1].Value.ToString();
                this.labName.Text = dgv1.Rows[e.RowIndex].Cells[1].Value.ToString();84
 this.txtNeiRong.Text =hh.HTNeiRong1;
                this.txtNeiRong.Text =hh.HTNeiRong1;85
 DataSet ds=DbHelperSQL.Query("select count(*) from HTHuiFu where HTId="+dgv1.Rows[e.RowIndex].Cells[0].Value.ToString());
                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();
                string str = ds.Tables[0].Rows[0][0].ToString();87
 if (hh.State1==0)
                if (hh.State1==0)88

 
                 {
{89
 labMessage.Text="表决正在进行中
                    labMessage.Text="表决正在进行中 .";
.";90
 labMessage.Text+="已经有"+str+"人表决完毕";
                    labMessage.Text+="已经有"+str+"人表决完毕";91
 button3.Enabled = true;
                    button3.Enabled = true;92
 }
                }93
 else
                else94

 
                 {
{95
 labMessage.Text = "表决已经完成..所有人已经完成表决
                    labMessage.Text = "表决已经完成..所有人已经完成表决 ";
";96
 button3.Enabled = false;
                    button3.Enabled = false;97
 }
                }98

99
 }
            }100
 }
        }101

102
 private void btnClance1_Click(object sender, EventArgs e)
        private void btnClance1_Click(object sender, EventArgs e)103

 
         {
{104
 this.Close();
            this.Close();105
 }
        }106

107
 private void button2_Click(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)108

 
         {
{109
 this.Close();
            this.Close();110
 }
        }111

112
 private void button1_Click(object sender, EventArgs e)
        private void button1_Click(object sender, EventArgs e)113

 
         {
{114
 HFXiangXiXinXi hfxx = new HFXiangXiXinXi(hh.HTID1);
            HFXiangXiXinXi hfxx = new HFXiangXiXinXi(hh.HTID1);115
 hfxx.Show();
            hfxx.Show();116
 }
        }117

118
 private void button3_Click(object sender, EventArgs e)
        private void button3_Click(object sender, EventArgs e)119

 
         {
{120
 this.Height = 315;
            this.Height = 315;121
 groupBox1.Location = new Point(21, 249+46);
            groupBox1.Location = new Point(21, 249+46);122
 btnClance1.Show();
            btnClance1.Show();123
 IClass.Master mm = new IClass.Master();
            IClass.Master mm = new IClass.Master();124
 List<IClass.Master> lm = new List<IClass.Master>();
            List<IClass.Master> lm = new List<IClass.Master>();125
 FBBLL.Master blm = new FBBLL.Master();
            FBBLL.Master blm = new FBBLL.Master();126
 lm = blm.GetModelList(" flage=" + hh.HTID1);
            lm = blm.GetModelList(" flage=" + hh.HTID1);127
 mm = lm[0];
            mm = lm[0];128
 wfi = wr.GetWorkflow(new Guid(mm.Id));
            wfi = wr.GetWorkflow(new Guid(mm.Id));129
 eve1(null, new pargme(new Guid(mm.Id), hh.HTID1, true));
            eve1(null, new pargme(new Guid(mm.Id), hh.HTID1, true));130
 hh.State1 = 1;
            hh.State1 = 1;131
 blht.Update(hh);
            blht.Update(hh);132
 }
        }133

134

 InterFaces 成员#region InterFaces 成员
        InterFaces 成员#region InterFaces 成员135

136
 public event EventHandler<ExternalDataEventArgs> eve1;
        public event EventHandler<ExternalDataEventArgs> eve1;137

138
 public void callroupiao(object flage)
        public void callroupiao(object flage)139

 
         {
{140
 MessageBox.Show("已经完成话题为"+flage.ToString()+"的表决!");
            MessageBox.Show("已经完成话题为"+flage.ToString()+"的表决!");141
 }
        }142

143
 #endregion
        #endregion144
 }
    }145
 }
}146

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

 Main
Main1
 using System;
using System;2
 using System.Collections.Generic;
using System.Collections.Generic;3
 using System.ComponentModel;
using System.ComponentModel;4
 using System.Data;
using System.Data;5
 using System.Drawing;
using System.Drawing;6
 using System.Linq;
using System.Linq;7
 using System.Text;
using System.Text;8
 using System.Windows.Forms;
using System.Windows.Forms;9
 using FBBLL;
using FBBLL;10
 using IClass;
using IClass;11
 using System.Workflow.Activities;
using System.Workflow.Activities;12
 using System.Workflow.Runtime;
using System.Workflow.Runtime;13
 using System.Workflow.Runtime.Hosting;
using System.Workflow.Runtime.Hosting;14
 using Maticsoft.DBUtility;
using Maticsoft.DBUtility;15
 using System.Workflow.Runtime.Tracking;
using System.Workflow.Runtime.Tracking;16

17
 namespace toupiao
namespace toupiao18


 {
{19
 public partial class Main : Form,IClass.InterFaces
    public partial class Main : Form,IClass.InterFaces20

 
     {
{21
 FBBLL.BLHuaTi blht = new BLHuaTi();
        FBBLL.BLHuaTi blht = new BLHuaTi();22
 WorkflowRuntime wr;
        WorkflowRuntime wr;23
 WorkflowInstance wfi;
        WorkflowInstance wfi;24
 ExternalDataExchangeService edes=new ExternalDataExchangeService();
        ExternalDataExchangeService edes=new ExternalDataExchangeService();25

26

27

28

29
 public Main()
        public Main()30

 
         {
{31
 InitializeComponent();
            InitializeComponent();32

33
 wr = new WorkflowRuntime();
            wr = new WorkflowRuntime();34
 wr.AddService(edes);
            wr.AddService(edes);35
 edes.AddService(this);
            edes.AddService(this);36
 wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);37
 wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            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"));
            //wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));39
 WorkflowPersistenceService persistenceService =
            WorkflowPersistenceService persistenceService =40
 new SqlWorkflowPersistenceService(
                        new SqlWorkflowPersistenceService(41
 "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
                       "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");42
 
            43
 wr.AddService(persistenceService);
            wr.AddService(persistenceService);44
 wr.StartRuntime();
            wr.StartRuntime();45
 }
        }46

47
 void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)48

 
         {
{49
 MessageBox.Show("表决完成");
            MessageBox.Show("表决完成");50
 }
        }51

52
 void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)53

 
         {
{54
 e.WorkflowInstance.TryUnload();
           e.WorkflowInstance.TryUnload();55
 }
        }56

57
 private void button1_Click(object sender, EventArgs e)
        private void button1_Click(object sender, EventArgs e)58

 
         {
{59
 FBBLL.Master mm = new FBBLL.Master();
            FBBLL.Master mm = new FBBLL.Master();60

61

62
 wfi = wr.CreateWorkflow(typeof(zhuangtaiji.Workflow1));
            wfi = wr.CreateWorkflow(typeof(zhuangtaiji.Workflow1));63
 wfi.Start();
            wfi.Start();64

65

66

67
 HuaTi ht = new HuaTi();
            HuaTi ht = new HuaTi();68
 ht.HTName1 = txtHTName.Text.ToString();
            ht.HTName1 = txtHTName.Text.ToString();69
 ht.HTNeiRong1 = txtHTNeiRong.Text.ToString();
            ht.HTNeiRong1 = txtHTNeiRong.Text.ToString();70
 ht.State1 = 0;
            ht.State1 = 0;71
 ht.Dt = DateTime.Now;
            ht.Dt = DateTime.Now;72
 blht.Add(ht);
            blht.Add(ht);73
 List<HuaTi> h1 = new List<HuaTi>();
            List<HuaTi> h1 = new List<HuaTi>();74
 h1 = blht.GetModelList(" HTName='" + ht.HTName1 + "' and State=0");
            h1 = blht.GetModelList(" HTName='" + ht.HTName1 + "' and State=0");75
 IClass.Master m = new IClass.Master(wfi.InstanceId.ToString(), false, h1[0].HTID1);
            IClass.Master m = new IClass.Master(wfi.InstanceId.ToString(), false, h1[0].HTID1);76
 mm.Add(m);
            mm.Add(m);77
 //  eve1(null,new ExternalDataEventArgs(wfi.InstanceId));
          //  eve1(null,new ExternalDataEventArgs(wfi.InstanceId));78
 MessageBox.Show("发布话题成功!");
            MessageBox.Show("发布话题成功!");79
 //eve1(null, new ExternalDataEventArgs(wfi.InstanceId));
             //eve1(null, new ExternalDataEventArgs(wfi.InstanceId));80
 wfi.TryUnload();
            wfi.TryUnload();81
 }
        }82

83
 private void button2_Click(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)84

 
         {
{85
 HTGuanLi htgl = new HTGuanLi();
            HTGuanLi htgl = new HTGuanLi();86
 htgl.Show();
            htgl.Show();87
 }
        }88

89
 private void txtNumber_KeyPress(object sender, KeyPressEventArgs e)
        private void txtNumber_KeyPress(object sender, KeyPressEventArgs e)90

 
         {
{91
 if (e.KeyChar>='0' &&e.KeyChar<='9')
            if (e.KeyChar>='0' &&e.KeyChar<='9')92

 
             {
{93
 e.Handled = false;
                e.Handled = false;94
 }
            }95
 else if (e.KeyChar==8)
            else if (e.KeyChar==8)96

 
             {
{97
 e.Handled = false;
                e.Handled = false;98
 }
            }99
 else
            else100

 
             {
{101
 e.Handled = true;
                e.Handled = true;102
 }
            }103
 }
        }104

105
 private void Main_FormClosing(object sender, FormClosingEventArgs e)
        private void Main_FormClosing(object sender, FormClosingEventArgs e)106

 
         {
{107

108
 }
        }109

110

 InterFaces 成员#region InterFaces 成员
        InterFaces 成员#region InterFaces 成员111

112
 public event EventHandler<ExternalDataEventArgs> eve1;
        public event EventHandler<ExternalDataEventArgs> eve1;113

114
 public void callroupiao(object flage)
        public void callroupiao(object flage)115

 
         {
{116
 throw new NotImplementedException();
            throw new NotImplementedException();117
 }
        }118

119
 #endregion
        #endregion120
 }
    }121
 }
}122

配置文件:App.config
1 <?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
2 <configuration>
<configuration>
3 <appSettings>
  <appSettings>
4 <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
    <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
5 </appSettings>
  </appSettings>
6 </configuration>
</configuration>
 <?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>2
 <configuration>
<configuration>3
 <appSettings>
  <appSettings>4
 <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
    <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />5
 </appSettings>
  </appSettings>6
 </configuration>
</configuration>
投票用户宿主项目,项目名称:User
配置文件:App.config
1 <?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
2 <configuration>
<configuration>
3 <appSettings>
  <appSettings>
4 <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
    <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
5 </appSettings>
  </appSettings>
6 </configuration>
</configuration>
 <?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>2
 <configuration>
<configuration>3
 <appSettings>
  <appSettings>4
 <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
    <add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />5
 </appSettings>
  </appSettings>6
 </configuration>
</configuration>
窗体名称:UserMain.cs(用户投票窗体)

 UserMain
UserMain1
 using System;
using System;2
 using System.Collections.Generic;
using System.Collections.Generic;3
 using System.ComponentModel;
using System.ComponentModel;4
 using System.Data;
using System.Data;5
 using System.Drawing;
using System.Drawing;6
 using System.Linq;
using System.Linq;7
 using System.Text;
using System.Text;8
 using System.Windows.Forms;
using System.Windows.Forms;9
 using Maticsoft.DBUtility;
using Maticsoft.DBUtility;10
 using IClass;
using IClass;11
 using FBBLL;
using FBBLL;12
 using System.Workflow.Activities;
using System.Workflow.Activities;13
 using System.Workflow.Runtime;
using System.Workflow.Runtime;14
 using System.Workflow.Runtime.Hosting;
using System.Workflow.Runtime.Hosting;15
 using System.Workflow.Runtime.Tracking;
using System.Workflow.Runtime.Tracking;16

17
 namespace User
namespace User18


 {
{19
 public partial class UserMain : Form,IClass.InterFaces
    public partial class UserMain : Form,IClass.InterFaces20

 
     {
{21

 
         #region
#region 22
 WorkflowRuntime wr = new WorkflowRuntime();
        WorkflowRuntime wr = new WorkflowRuntime();23
 WorkflowInstance wfi;
        WorkflowInstance wfi;24
 ExternalDataExchangeService edes = new ExternalDataExchangeService();
        ExternalDataExchangeService edes = new ExternalDataExchangeService();25
 BLHuaTi blht = new BLHuaTi();
        BLHuaTi blht = new BLHuaTi();26
 BLHTHuiFu blhthf = new BLHTHuiFu();
        BLHTHuiFu blhthf = new BLHTHuiFu();27
 HuaTi hhh;
        HuaTi hhh;28
 public UserMain()
        public UserMain()29

 
         {
{30
 InitializeComponent();
            InitializeComponent();31
 wr.AddService(edes);
            wr.AddService(edes);32
 edes.AddService(this);
            edes.AddService(this);33
 WorkflowPersistenceService persistenceService =
            WorkflowPersistenceService persistenceService =34
 new SqlWorkflowPersistenceService(
                        new SqlWorkflowPersistenceService(35
 "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
                        "Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");36
 wr.AddService(persistenceService);
            wr.AddService(persistenceService);37
 //wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
            //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);
            wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);39
 wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);40
 wr.StartRuntime();
            wr.StartRuntime();41

42
 this.Height = 343;
            this.Height = 343;43
 List<HuaTi> lht = new List<HuaTi>();
            List<HuaTi> lht = new List<HuaTi>();44
 lht = blht.GetModelList("");
            lht = blht.GetModelList("");45
 for (int i = 0; i < lht.Count; i++)
            for (int i = 0; i < lht.Count; i++)46

 
             {
{47
 if (lht[i].State1==0)
                if (lht[i].State1==0)48

 
                 {
{49
 object[] obj = new object[2];
                    object[] obj = new object[2];50
 obj[0] = lht[i].HTID1;
                    obj[0] = lht[i].HTID1;51
 obj[1] = lht[i].HTName1;
                    obj[1] = lht[i].HTName1;52
 dgv1.Rows.Add(obj);
                    dgv1.Rows.Add(obj);53
 }
                }                54
 }
            }55
 }
        }56

57
 void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        void wr_WorkflowIdled(object sender, WorkflowEventArgs e)58

 
         {
{59
 e.WorkflowInstance.TryUnload();
            e.WorkflowInstance.TryUnload();60
 }
        }61

62
 void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
        void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)63

 
         {
{64
 MessageBox.Show("此次投票已经完成");
            MessageBox.Show("此次投票已经完成");65
 }
        }66

67
 private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)68

 
         {
{69
 if (e.RowIndex<0)
            if (e.RowIndex<0)70

 
             {
{71
 return;
                return;72
 }
            }73
 else
            else74

 
             {
{75
 
               76
 this.Height = 732 - 46;
                this.Height = 732 - 46;77
 groupBox1.Location = new Point(groupBox1.Location.X, 265);
                groupBox1.Location = new Point(groupBox1.Location.X, 265);78
 hhh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                hhh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));79
 labHTName.Text = hhh.HTID1.ToString();
                labHTName.Text = hhh.HTID1.ToString();80
 txtHuTiNeiRong.Text = hhh.HTNeiRong1;
                txtHuTiNeiRong.Text = hhh.HTNeiRong1;81
 }
            }82
 }
        }83

84
 private void button1_Click(object sender, EventArgs e)
        private void button1_Click(object sender, EventArgs e)85

 
         {
{86
 Application.Exit();
            Application.Exit();87
 }
        }88
 #endregion
        #endregion89
 private void button2_Click(object sender, EventArgs e)
        private void button2_Click(object sender, EventArgs e)90

 
         {
{91
 IClass.Master mm = new IClass.Master();
            IClass.Master mm = new IClass.Master();92
 List<IClass.Master> lm = new List<IClass.Master>();
            List<IClass.Master> lm = new List<IClass.Master>();93
 FBBLL.Master blm = new FBBLL.Master();
            FBBLL.Master blm = new FBBLL.Master();94
 lm = blm.GetModelList(" flage="+hhh.HTID1);
            lm = blm.GetModelList(" flage="+hhh.HTID1);95
 mm = lm[0];
            mm = lm[0];96
 wfi = wr.GetWorkflow(new Guid(mm.Id));
            wfi = wr.GetWorkflow(new Guid(mm.Id));97
 
            98
 HTHuiFu hthf = new HTHuiFu();
            HTHuiFu hthf = new HTHuiFu();99
 if (cbx1.Checked)
            if (cbx1.Checked)100

 
             {
{101
 hthf.FBRenName1 = "匿名";
                hthf.FBRenName1 = "匿名";102
 }
            }103
 else
            else104

 
             {
{105
 hthf.FBRenName1 = txtName.Text.ToString();
                hthf.FBRenName1 = txtName.Text.ToString();106
 }
            }107
 hthf.HTId1 = hhh.HTID1;
            hthf.HTId1 = hhh.HTID1;108
 hthf.FanKuiNeiRong1 = textBox1.Text.ToString();
            hthf.FanKuiNeiRong1 = textBox1.Text.ToString();109
 blhthf.Add(hthf);
            blhthf.Add(hthf);110
 eve1(null, new pargme(new Guid(mm.Id), hhh.HTID1,false));
            eve1(null, new pargme(new Guid(mm.Id), hhh.HTID1,false));111

112
 }
        }113

114
 private void button3_Click(object sender, EventArgs e)
        private void button3_Click(object sender, EventArgs e)115

 
         {
{116
 Application.Exit();
            Application.Exit();117
 }
        }118

119
 private void cbx1_CheckedChanged(object sender, EventArgs e)
        private void cbx1_CheckedChanged(object sender, EventArgs e)120

 
         {
{121
 if (cbx1.Checked)
            if (cbx1.Checked)122

 
             {
{123
 txtName.Text = "";
                txtName.Text = "";124
 txtName.ReadOnly = true;
                txtName.ReadOnly = true;125
 }
            }126
 else
            else127

 
             {
{128
 txtName.Text = "";
                txtName.Text = "";129
 txtName.ReadOnly = false;
                txtName.ReadOnly = false;130
 }
            }131
 }
        }132

133

 InterFaces 成员#region InterFaces 成员
        InterFaces 成员#region InterFaces 成员134

135
 public event EventHandler<ExternalDataEventArgs> eve1;
        public event EventHandler<ExternalDataEventArgs> eve1;136

137
 public void callroupiao(object flage)
        public void callroupiao(object flage)138

 
         {
{139
 HuaTi h = hhh;
            HuaTi h = hhh;140
 h.HTID1 = Convert.ToInt32(flage);
            h.HTID1 = Convert.ToInt32(flage);141
 h.State1 = 1;
            h.State1 = 1;142
 FBBLL.BLHuaTi blht = new BLHuaTi();
            FBBLL.BLHuaTi blht = new BLHuaTi();143
 blht.Update(h);
            blht.Update(h);144
 }
        }145

146
 #endregion
        #endregion147
 }
    }148
 
    149
 }
}150

基于WF的意见征集1(浅析)
基于WF的意见征集2(浅析)
基于WF的意见征集3(浅析)
基于WF的意见征集4(浅析)
基于WF的意见征集6(浅析)
基于WF的意见征集7(浅析)
 
                    
                 
                
            
         浙公网安备 33010602011771号
浙公网安备 33010602011771号