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

这段时间好忙啊,被飞驰软件断开后,找到了另外个工作,还是继续上一次的系列:

项目名:User(winform),用户操作项目

床提名:UserMain

 

UserMain
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(
nullnew 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

App.config
<?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(浅析)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值