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

 

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

窗体名:FrmCaiWu

基于WF的报销单流转审批业务6(浅析)_第1张图片

 

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

基于WF的报销单流转审批业务6(浅析)_第2张图片

 

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

基于WF的报销单流转审批业务6(浅析)_第3张图片

 

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

基于WF的报销单流转审批业务6(浅析)_第4张图片

 

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

基于WF的报销单流转审批业务6(浅析)_第5张图片

 

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

基于WF的报销单流转审批业务6(浅析)_第6张图片

 

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(浅析)

你可能感兴趣的:(基于WF的报销单流转审批业务6(浅析))