基于WF的报销单流转审批业务6(浅析)

 

项目名:UserForm(用户操作部分)

窗体名:FrmCaiWu

 

FrmCaiWu
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;

namespace UserForm
{
    
/// <summary>
    
/// 财务审批
    
/// </summary>
    public partial class FrmCaiWu : Form
    {
        BLL.BLBXDan blbx 
= new BLL.BLBXDan();
        
int whichone;
        
public FrmCaiWu()
        {
            InitializeComponent();
            List
<Model.BXDan> lbx = new List<Model.BXDan>();
            lbx 
= blbx.GetModelList(" stated=1");
            
for (int i = 0; i < lbx.Count; i++)
            {
                
object[] obj = new object[3];
                obj[
0= lbx[i].BXID;
                obj[
1= lbx[i].BXName;
                obj[
2= lbx[i].BXJin;
                dgv1.Rows.Add(obj);
            }
        }
        
public FrmCaiWu(int whichone)
        {
            InitializeComponent();
            
this.whichone = whichone;
            List
<Model.BXDan> lbx = new List<Model.BXDan>();
            
if (whichone == 1)
            {
                lbx 
= blbx.GetModelList(" stated=1");
            }
            
else if (whichone == 2)
            {
                lbx 
= blbx.GetModelList(" stated=2");
            }
            
else if (whichone == 3)
            {
                lbx 
= blbx.GetModelList(" stated=3");
            }
            
for (int i = 0; i < lbx.Count; i++)
            {
                
object[] obj = new object[3];
                obj[
0= lbx[i].BXID;
                obj[
1= lbx[i].BXName;
                obj[
2= lbx[i].BXJin;
                dgv1.Rows.Add(obj);
            }
        }

        
private void dgv1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
if (e.RowIndex < 0)
            {
                
return;
            }
            
else
            {
                Model.BXDan bb 
= blbx.GetModel(Convert.ToInt32(dgv1.Rows[e.RowIndex].Cells[0].Value.ToString()));
                
if (whichone == 1)//财务
                {
                    FrmShenP fcw 
= new FrmShenP(bb);
                    fcw.Show();
                    
this.Close();
                }
                
else if (whichone == 2)//经理   
                {
                    FrmJingLi fjl 
= new FrmJingLi(bb);
                    fjl.Show();
                    
this.Close();
                }
                
else if (whichone == 3)//出纳
                {
                    frmChuNa fcn 
= new frmChuNa(bb);
                    fcn.Show();
                    
this.Close();
                }
            }
        }

        
private void button1_Click(object sender, EventArgs e)
        {
            
this.Close();
        }
    }
}

 

窗体名:frmChaKanTaRen

 

frmChaKanTaRen
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;

namespace UserForm
{
    
/// <summary>
    
/// 查看他人信息
    
/// </summary>
    public partial class frmChaKanTaRen : Form
    {
        
public frmChaKanTaRen()
        {
            InitializeComponent();
        }
        
public frmChaKanTaRen(Model.BXDan dx)
        {
            InitializeComponent();
            txtC.Text 
= dx.SPYiJianCW;
            txtJ.Text 
= dx.SPYiJianJL;
            txtN.Text 
= dx.SPYiJianCN;
        }

        
private void button1_Click(object sender, EventArgs e)
        {
            
this.Close();
        }
    }
}

 

窗体名:frmChuNa

 

frmChuNa
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 System.Workflow.Activities;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;

namespace UserForm
{
    
public partial class frmChuNa : Form, InterFaces.IClass
    {
        WorkflowRuntime wr;
        WorkflowInstance wfi;
        ExternalDataExchangeService edes;
        Model.BXDan bx 
= new Model.BXDan();
        BLL.BLBXDan blbx 
= new BLL.BLBXDan();
        
public frmChuNa()
        {
            InitializeComponent();
        }
        
public frmChuNa(Model.BXDan bx)
        {
            InitializeComponent();
            wr 
= new WorkflowRuntime();
            edes 
= new ExternalDataExchangeService();
            wr.AddService(edes);
            wr.WorkflowIdled 
+= new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            edes.AddService(
this);
            wr.AddService(
new SqlWorkflowPersistenceService("Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa"));
            wr.StartRuntime();
            
this.bx = bx;
            CWName.Text 
= bx.BXName;
            labJinE.Text 
= bx.BXJin;
            txtShenQingNeiRong.Text 
= bx.BXNeiRong;
        }
        
void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        {
            e.WorkflowInstance.TryUnload();
        }
        
private void button5_Click(object sender, EventArgs e)
        {
            
this.Close();
        }

        
private void button6_Click(object sender, EventArgs e)
        {
            frmChaKanTaRen ftr 
= new frmChaKanTaRen(bx);
            ftr.Show();
        }


        
private void button1_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            ChuNaShenPi(
nullnew InterFaces.ChuNaSP(wfi.InstanceId, 1));
            bx.stated 
= 4;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button2_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            ChuNaShenPi(
nullnew InterFaces.ChuNaSP(wfi.InstanceId, 0));
            bx.stated 
= 3;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
#region IClass 成员

        
public event EventHandler<ExternalDataEventArgs> ShenQing;

        
public event EventHandler<ExternalDataEventArgs> CaiWuShenPi;

        
public event EventHandler<ExternalDataEventArgs> JingLiShenPi;

        
public event EventHandler<ExternalDataEventArgs> ChuNaShenPi;

        
public void quqian()
        {
            
throw new NotImplementedException();
        }

        
#endregion
    }
}

 

窗体名:FrmJingLi

 

FrmJingLi
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 System.Workflow.Activities;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;

namespace UserForm
{
    
public partial class FrmJingLi : Form, InterFaces.IClass
    {
        WorkflowRuntime wr;
        WorkflowInstance wfi;
        ExternalDataExchangeService edes;
        Model.BXDan bx 
= new Model.BXDan();
        BLL.BLBXDan blbx 
= new BLL.BLBXDan();
        
public FrmJingLi()
        {
            InitializeComponent();
        }
        
public FrmJingLi(Model.BXDan bx)
        {
            InitializeComponent();
            wr 
= new WorkflowRuntime();
            edes 
= new ExternalDataExchangeService();
            wr.AddService(edes);
            wr.WorkflowIdled 
+= new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            edes.AddService(
this);
            wr.AddService(
new SqlWorkflowPersistenceService("Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa"));
            wr.StartRuntime();
            
this.bx = bx;
            CWName.Text 
= bx.BXName;
            labJinE.Text 
= bx.BXJin;
            txtShenQingNeiRong.Text 
= bx.BXNeiRong;
        }
        
void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        {
            e.WorkflowInstance.TryUnload();
        }
        
private void button5_Click(object sender, EventArgs e)
        {
            
this.Close();
        }

        
private void button6_Click(object sender, EventArgs e)
        {
            frmChaKanTaRen ftr 
= new frmChaKanTaRen(bx);
            ftr.Show();
        }

        
private void button1_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            JingLiShenPi(
nullnew InterFaces.JingLiSP(wfi.InstanceId, 0));
            bx.stated 
= 0;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button2_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            JingLiShenPi(
nullnew InterFaces.JingLiSP(wfi.InstanceId, 1));
            bx.stated 
= 9;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button3_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            JingLiShenPi(
nullnew InterFaces.JingLiSP(wfi.InstanceId, 2));
            bx.stated 
= 3;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
#region IClass 成员

        
public event EventHandler<ExternalDataEventArgs> ShenQing;

        
public event EventHandler<ExternalDataEventArgs> CaiWuShenPi;

        
public event EventHandler<ExternalDataEventArgs> JingLiShenPi;

        
public event EventHandler<ExternalDataEventArgs> ChuNaShenPi;

        
public void quqian()
        {
            
throw new NotImplementedException();
        }

        
#endregion
    }
}

 

窗体名:FrmShenP.cs

 

FrmShenP
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 System.Workflow.Activities;
using System.Workflow.Runtime;
using System.Workflow.Runtime.Hosting;

namespace UserForm
{
    
public partial class FrmShenP : Form, InterFaces.IClass
    {
        WorkflowRuntime wr;
        WorkflowInstance wfi;
        ExternalDataExchangeService edes;
        Model.BXDan bx 
= new Model.BXDan();
        BLL.BLBXDan blbx 
= new BLL.BLBXDan();
        
public FrmShenP()
        {
            InitializeComponent();
        }
        
public FrmShenP(Model.BXDan bx)
        {
            InitializeComponent();
            wr 
= new WorkflowRuntime();
            edes 
= new ExternalDataExchangeService();
            wr.AddService(edes);
            wr.WorkflowIdled 
+= new EventHandler<WorkflowEventArgs>(wr_WorkflowIdled);
            edes.AddService(
this);
            wr.AddService(
new SqlWorkflowPersistenceService("Initial Catalog=SqlPersistenceService;Data Source=192.168.1.5;uid=sa;pwd=sa"));
            wr.StartRuntime();
            
this.bx = bx;
            CWName.Text 
= bx.BXName;
            labJinE.Text 
= bx.BXJin;
            txtShenQingNeiRong.Text 
= bx.BXNeiRong;
        }

        
void wr_WorkflowIdled(object sender, WorkflowEventArgs e)
        {
            e.WorkflowInstance.TryUnload();
        }
        
private void button5_Click(object sender, EventArgs e)
        {
            
this.Close();
        }

        
private void button6_Click(object sender, EventArgs e)
        {
            frmChaKanTaRen ftr 
= new frmChaKanTaRen(bx);
            ftr.Show();
        }

        
private void button1_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            CaiWuShenPi(
nullnew InterFaces.CaiWuSP(wfi.InstanceId, 0));
            bx.stated 
= 0;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button2_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            CaiWuShenPi(
nullnew InterFaces.CaiWuSP(wfi.InstanceId, 1));
            bx.stated 
= 9;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button3_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            CaiWuShenPi(
nullnew InterFaces.CaiWuSP(wfi.InstanceId, 2));
            bx.stated 
= 3;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }

        
private void button4_Click(object sender, EventArgs e)
        {
            wfi 
= wr.GetWorkflow(new Guid(bx.BXGID));
            CaiWuShenPi(
nullnew InterFaces.CaiWuSP(wfi.InstanceId, 3));
            bx.stated 
= 2;
            bx.SPYiJianCW 
= txtYiJian.Text.Trim().ToString();
            blbx.Update(bx);
            
this.Close();
        }


        
#region IClass 成员

        
public event EventHandler<ExternalDataEventArgs> ShenQing;

        
public event EventHandler<ExternalDataEventArgs> CaiWuShenPi;

        
public event EventHandler<ExternalDataEventArgs> JingLiShenPi;

        
public event EventHandler<ExternalDataEventArgs> ChuNaShenPi;

        
public void quqian()
        {
            
throw new NotImplementedException();
        }

        
#endregion
    }
}

 

窗体名:Main.cs

 

Main
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;

namespace UserForm
{
    
public partial class Main : Form
    {
        
public Main()
        {
            InitializeComponent();
        }

        
private void button1_Click(object sender, EventArgs e)
        {
            FrmCaiWu fcc 
= new FrmCaiWu(1);
            fcc.Show();
        }

        
private void button2_Click(object sender, EventArgs e)
        {
            FrmCaiWu fcc 
= new FrmCaiWu(2);
            fcc.Show();
        }

        
private void button3_Click(object sender, EventArgs e)
        {
            FrmCaiWu fcc 
= new FrmCaiWu(3);
            fcc.Show();
        }
    }
}

 

配置文件:App.config

 

App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  
<appSettings>
    
<add key="SQL2000" value="server=192.168.1.3;database=Shenp;uid=sa" />
  
</appSettings>
</configuration>

 

基于WF的报销单流转审批业务1(浅析)
基于WF的报销单流转审批业务2(浅析)
基于WF的报销单流转审批业务3(浅析)
基于WF的报销单流转审批业务4(浅析)
基于WF的报销单流转审批业务5(浅析)

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值