基于WF的意见征集7(浅析)
这段时间好忙啊,被飞驰软件断开后,找到了另外个工作,还是继续上一次的系列:
项目名:User(winform),用户操作项目
床提名:UserMain
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Maticsoft.DBUtility;
using IClass;
using FBBLL;
using System.Workflow.Activities;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;
using System.Workflow.Runtime.Tracking;
namespace User
{
public partial class UserMain : Form,IClass.InterFaces
{
#region
WorkflowRuntime wr = new WorkflowRuntime();
WorkflowInstance wfi;
ExternalDataExchangeService edes = new ExternalDataExchangeService();
BLHuaTi blht = new BLHuaTi();
BLHTHuiFu blhthf = new BLHTHuiFu();
HuaTi hhh;
public UserMain()
{
InitializeComponent();
wr.AddService(edes);
edes.AddService(this);
WorkflowPersistenceService persistenceService =
new SqlWorkflowPersistenceService(
"Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa");
wr.AddService(persistenceService);
//wr.AddService(new SqlTrackingService("Initial Catalog=Tracking;Data Source=192.168.1.5;uid=sa;pwd=sa"));
wr.WorkflowCompleted += new EventHandler<WorkflowCompletedEventArgs>(wr_WorkflowCompleted);
wr.WorkflowIdled += new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
wr.StartRuntime();
this.Height = 343;
List<HuaTi> lht = new List<HuaTi>();
lht = blht.GetModelList("");
for (int i = 0; i < lht.Count; i++)
{
if (lht[i].State1==0)
{
object[] obj = new object[2];
obj[0] = lht[i].HTID1;
obj[1] = lht[i].HTName1;
dgv1.Rows.Add(obj);
}
}
}
void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
{
e.WorkflowInstance.TryUnload();
}
void wr_WorkflowCompleted(object sender, WorkflowCompletedEventArgs e)
{
MessageBox.Show("此次投票已经完成");
}
private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex<0)
{
return;
}
else
{
this.Height = 732 - 46;
groupBox1.Location = new Point(groupBox1.Location.X, 265);
hhh=blht.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
labHTName.Text = hhh.HTID1.ToString();
txtHuTiNeiRong.Text = hhh.HTNeiRong1;
}
}
private void button1_Click(object sender, EventArgs e)
{
Application.Exit();
}
#endregion
private void button2_Click(object sender, EventArgs e)
{
IClass.Master mm = new IClass.Master();
List<IClass.Master> lm = new List<IClass.Master>();
FBBLL.Master blm = new FBBLL.Master();
lm = blm.GetModelList(" flage="+hhh.HTID1);
mm = lm[0];
wfi = wr.GetWorkflow(new Guid(mm.Id));
HTHuiFu hthf = new HTHuiFu();
if (cbx1.Checked)
{
hthf.FBRenName1 = "匿名";
}
else
{
hthf.FBRenName1 = txtName.Text.ToString();
}
hthf.HTId1 = hhh.HTID1;
hthf.FanKuiNeiRong1 = textBox1.Text.ToString();
blhthf.Add(hthf);
eve1(null, new pargme(new Guid(mm.Id), hhh.HTID1,false));
}
private void button3_Click(object sender, EventArgs e)
{
Application.Exit();
}
private void cbx1_CheckedChanged(object sender, EventArgs e)
{
if (cbx1.Checked)
{
txtName.Text = "";
txtName.ReadOnly = true;
}
else
{
txtName.Text = "";
txtName.ReadOnly = false;
}
}
#region InterFaces 成员
public event EventHandler<ExternalDataEventArgs> eve1;
public void callroupiao(object flage)
{
HuaTi h = hhh;
h.HTID1 = Convert.ToInt32(flage);
h.State1 = 1;
FBBLL.BLHuaTi blht = new BLHuaTi();
blht.Update(h);
}
#endregion
}
}
配置文件:App.config
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="SQL2000" value="server=192.168.1.3;database=asd;uid=sa" />
</appSettings>
</configuration>
基于WF的意见征集1(浅析)
基于WF的意见征集2(浅析)
基于WF的意见征集3(浅析)
基于WF的意见征集4(浅析)
基于WF的意见征集5(浅析)
基于WF的意见征集6(浅析)