基於WF的報銷單流轉審批業務6(淺析)
阿新 • • 發佈:2018-11-19
專案名: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;
{
/// <summary>
/// 財務審批
/// </summary>
public partial class FrmCaiWu : Form
{
BLL.BLBXDan blbx
int whichone;
public FrmCaiWu()
{
InitializeComponent();
List
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(null, new 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(null, new 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(null, new 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(null, new 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(null, new 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(null, new 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(null, new 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(null, new 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(null, new 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(淺析)