7ce4695854
SVN-Revision: r1054
591 lines
22 KiB
C#
591 lines
22 KiB
C#
using Lskj.Business;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
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 Lskj.PubUserTomodule.AuditPermissionControls
|
|
{
|
|
public partial class StepPage2 : UserControl
|
|
{
|
|
private string mMenuCode;
|
|
public BaseflowTypeModel SelectBaseflowTypeModel;
|
|
public BillflowTypeModel SelectBillflowTypeModel;
|
|
/// <summary>
|
|
/// 选中的流转步骤
|
|
/// </summary>
|
|
public StepItem2 SeletStepItem2Obj;
|
|
/// <summary>
|
|
/// 判断第二页是否有操作权限
|
|
/// </summary>
|
|
public bool SerpPage2Power;
|
|
|
|
/// <summary>
|
|
/// 是基础模块true 还是单据
|
|
/// </summary>
|
|
public bool isBasis;
|
|
|
|
|
|
public StepPage2()
|
|
{
|
|
InitializeComponent();
|
|
this.labelTextEdit1.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
|
this.labelComboxEdit1.TextEdit.EditValueChanged += new EventHandler(OnDepEditValueChanged);
|
|
|
|
GridDragMemo dragGrid = new GridDragMemo(this.gridView, this.txtEdit);
|
|
GridDragMemo dragGrid2 = new GridDragMemo(this.gridView2, this.txtEdit);
|
|
dragGrid.OnDragComplete += new GridFragMemoEditCompleteEventHandler(OnDragGridCompleted);
|
|
dragGrid2.OnDragComplete += new GridFragMemoEditCompleteEventHandler(OnDragGridCompleted);
|
|
}
|
|
|
|
#region 公共方法
|
|
/// <summary>
|
|
/// <para>说明:初始化界面控件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>o
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeControl(string menuCode, bool Basis)
|
|
{
|
|
this.isBasis = Basis;
|
|
this.mMenuCode = menuCode;
|
|
|
|
this.InitializeStepFlow();
|
|
this.InitializeUsers();
|
|
this.InitializeDeps();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:添加流转类别</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void AddFlowTypeItem(string typeName)
|
|
{
|
|
if (isBasis)
|
|
{
|
|
|
|
|
|
BaseflowTypeModel model = new BaseflowTypeModel
|
|
{
|
|
typeCode = mMenuCode,
|
|
typekey = Guid.NewGuid().ToString().ToLower(),
|
|
billType = WorkFlowBaseImpl.GetBaseFlowBaseType(),
|
|
billTypeName = typeName
|
|
};
|
|
|
|
try
|
|
{
|
|
// 保存
|
|
if (WorkFlowBaseImpl.SaveBaseFlowType(model))
|
|
{
|
|
// 重排列表
|
|
InitializeStepFlow();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
// MessageUtil.Show("保存失败!" + ex.Message);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
BillflowTypeModel model = new BillflowTypeModel
|
|
{
|
|
typeCode = mMenuCode,
|
|
typekey = Guid.NewGuid().ToString().ToLower(),
|
|
billType = WorkFlowBillImpl.GetBillFlowBillType(),
|
|
billTypeName = typeName
|
|
};
|
|
|
|
try
|
|
{
|
|
// 保存
|
|
if (WorkFlowBillImpl.SaveBillFlowType(model))
|
|
{
|
|
// 重排列表
|
|
InitializeStepFlow();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
//MessageUtil.Show("保存失败!" + ex.Message);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:更新流转步骤数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void UpdateBaseFlowType()
|
|
{
|
|
if (this.VerifyNull())
|
|
{
|
|
// 获取基本数据
|
|
BaseflowTypeModel model = this.SelectBaseflowTypeModel;
|
|
model.billTypeName = this.ltestepGroup.EditText;
|
|
model.operUser = this.txtEdit.EditValue + "";
|
|
model.billflowban = int.Parse(this.labdisable.EditText);
|
|
|
|
bool result = WorkFlowBaseImpl.UpdateBaseFlowType(model);
|
|
if (result)
|
|
{
|
|
this.SeletStepItem2Obj.TitleLabelObj.Text = this.SeletStepItem2Obj.TabIndex + "、" + model.billTypeName;
|
|
this.SelectBaseflowTypeModel = model;
|
|
}
|
|
MessageUtil.Show(result ? "保存成功!" : "保存失败!");
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:更新流转步骤数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-25 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void UpdateBillFlowType()
|
|
{
|
|
if (this.VerifyNull())
|
|
{
|
|
// 获取基本数据
|
|
BillflowTypeModel model = this.SelectBillflowTypeModel;
|
|
model.billTypeName = this.ltestepGroup.EditText;
|
|
model.operUser = this.txtEdit.EditValue + "";
|
|
model.billflowban = int.Parse(this.labdisable.EditText);
|
|
|
|
bool result = WorkFlowBillImpl.UpdateBillFlowType(model);
|
|
if (result)
|
|
{
|
|
this.SeletStepItem2Obj.TitleLabelObj.Text = this.SeletStepItem2Obj.TabIndex + "、" + model.billTypeName;
|
|
this.SelectBillflowTypeModel = model;
|
|
}
|
|
MessageUtil.Show(result ? "保存成功!" : "保存失败!");
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 私有方法
|
|
/// <summary>
|
|
/// <para>说明:初始化小类设置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
public void InitializeStepFlow()
|
|
{
|
|
this.PlStep2Container.Controls.Clear();
|
|
DataTable table = isBasis ? WorkFlowBaseImpl.GetBaseFlowType(mMenuCode) : WorkFlowBillImpl.GetBillFlowType(mMenuCode);
|
|
if (table.Rows.Count == 0)
|
|
{
|
|
this.panelControl1.Visible = false;
|
|
return;
|
|
}
|
|
this.panelControl1.Visible = true;
|
|
for (int i = table.Rows.Count; i > 0; i--)
|
|
{
|
|
|
|
DataRow rowItem = table.Rows[i - 1];
|
|
if (isBasis)
|
|
{
|
|
BaseflowTypeModel model = new BaseflowTypeModel(rowItem);
|
|
// 设置面板值
|
|
if (i == 1)
|
|
{
|
|
this.SelectBaseflowTypeModel = model;
|
|
this.SetFlowTypeItem(model);
|
|
}
|
|
this.PlStep2Container.Controls.Add(this.InitStepFlowTypeItem(model, i));
|
|
}
|
|
else
|
|
{
|
|
BillflowTypeModel model = new BillflowTypeModel(rowItem);
|
|
// 设置面板值
|
|
if (i == 1)
|
|
{
|
|
this.SelectBillflowTypeModel = model;
|
|
this.SetFlowTypeItem(model);
|
|
}
|
|
this.PlStep2Container.Controls.Add(this.InitStepFlowTypeItem(model, i));
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeUsers()
|
|
{
|
|
DataTable table = isBasis ? WorkFlowBaseImpl.GetWorkFlowUsers("", "") : WorkFlowBillImpl.GetWorkFlowUsers("", "");
|
|
this.gridControl.DataSource = table;
|
|
DataTable Roletable = isBasis ? WorkFlowBaseImpl.GetWorkFlowRole("") : WorkFlowBillImpl.GetWorkFlowRole("");
|
|
this.gridControl.DataSource = table;
|
|
this.gridControl1.DataSource = Roletable;
|
|
//GridDragMemo dragGrid = new GridDragMemo(this.gridView, this.txtEdit);
|
|
//GridDragMemo dragGrid2 = new GridDragMemo(this.gridView2, this.txtEdit);
|
|
//dragGrid.OnDragComplete += new GridFragMemoEditCompleteEventHandler(OnDragGridCompleted);
|
|
//dragGrid2.OnDragComplete += new GridFragMemoEditCompleteEventHandler(OnDragGridCompleted);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化部门数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void InitializeDeps()
|
|
{
|
|
DataTable table = isBasis ? WorkFlowBaseImpl.GetDeps() : WorkFlowBillImpl.GetDeps();
|
|
|
|
this.labelComboxEdit1.ValueMember = "departmentid";
|
|
this.labelComboxEdit1.ValueField = "departmentid";
|
|
this.labelComboxEdit1.TextField = "departmentname";
|
|
this.labelComboxEdit1.SetDataSource(table);
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:设置面板值</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
private void SetFlowTypeItem(BaseflowTypeModel model)
|
|
{
|
|
if (model != null)
|
|
{
|
|
this.ltestepGroup.EditText = model.billTypeName;
|
|
this.txtEdit.EditValue = model.operUser;
|
|
this.SelectBaseflowTypeModel = model;
|
|
this.labdisable.EditText = model.billflowban + "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:设置面板值</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="model">The model.</param>
|
|
private void SetFlowTypeItem(BillflowTypeModel model)
|
|
{
|
|
if (model != null)
|
|
{
|
|
this.ltestepGroup.EditText = model.billTypeName;
|
|
this.txtEdit.EditValue = model.operUser;
|
|
this.SelectBillflowTypeModel = model;
|
|
this.labdisable.EditText = model.billflowban + "";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化小类设置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private StepItem2 InitStepFlowTypeItem(BillflowTypeModel model, int pos)
|
|
{
|
|
StepItem2 item = new StepItem2();
|
|
item.TitleLabelObj.Text = pos + "、" + model.billTypeName;
|
|
if (SerpPage2Power)
|
|
{
|
|
item.DeletePabelObj.Enabled = false;
|
|
}
|
|
item.DeletePabelObj.Click += new EventHandler(OnDeletePabelObjClick);
|
|
item.DeletePabelObj.Tag = model;
|
|
item.Dock = DockStyle.Top;
|
|
item.Tag = item.TitleLabelObj.Tag = model;
|
|
item.SetHoverEvent(OnTitleLabelObjClick);
|
|
item.TabIndex = pos;
|
|
if (pos == 1)
|
|
{
|
|
SeletStepItem2Obj = item;
|
|
item.SetDefaultSelectItem(item);
|
|
}
|
|
return item;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:初始化小类设置</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private StepItem2 InitStepFlowTypeItem(BaseflowTypeModel model, int pos)
|
|
{
|
|
StepItem2 item = new StepItem2();
|
|
item.TitleLabelObj.Text = pos + "、" + model.billTypeName;
|
|
if (SerpPage2Power)
|
|
{
|
|
item.DeletePabelObj.Enabled = false;
|
|
}
|
|
item.DeletePabelObj.Click += new EventHandler(OnDeletePabelObjClick);
|
|
item.DeletePabelObj.Tag = model;
|
|
item.Dock = DockStyle.Top;
|
|
item.Tag = item.TitleLabelObj.Tag = model;
|
|
item.SetHoverEvent(OnTitleLabelObjClick);
|
|
item.TabIndex = pos;
|
|
if (pos == 1)
|
|
{
|
|
SeletStepItem2Obj = item;
|
|
item.SetDefaultSelectItem(item);
|
|
}
|
|
return item;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:验证数据合法性</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-06 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
|
|
public bool VerifyNull()
|
|
{
|
|
foreach (System.Windows.Forms.Control item in groupBox1.Controls)
|
|
{
|
|
if (item is LabelTextEdit)
|
|
{
|
|
LabelTextEdit textEdit = item as LabelTextEdit;
|
|
if (string.IsNullOrEmpty(textEdit.EditText) && textEdit.Required)
|
|
{
|
|
textEdit.Focus();
|
|
MessageUtil.Show(textEdit.LabelText + "不能为空!");
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
#endregion
|
|
|
|
#region 事件相关
|
|
/// <summary>
|
|
/// <para>说明:删除流转分类</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnDeletePabelObjClick(object sender, EventArgs e)
|
|
{
|
|
if (isBasis)
|
|
{
|
|
Panel deletePanel = sender as Panel;
|
|
if (deletePanel != null && deletePanel.Tag != null)
|
|
{
|
|
BaseflowTypeModel model = deletePanel.Tag as BaseflowTypeModel;
|
|
if (MessageUtil.Show("删除审批方案将同步删除方案步骤相关数据\r\n是否删除?", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
// 验证删除存储过程
|
|
string tipMsg = string.Empty;
|
|
if (BaseImpl.deleteFlow(3, mMenuCode, model.typeCode, model.id, out tipMsg) == 1)
|
|
{
|
|
MessageUtil.Show("删除成功!");
|
|
// 重排列表
|
|
InitializeStepFlow();
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(tipMsg);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
Panel deletePanel = sender as Panel;
|
|
if (deletePanel != null && deletePanel.Tag != null)
|
|
{
|
|
BillflowTypeModel model = deletePanel.Tag as BillflowTypeModel;
|
|
if (MessageUtil.Show("删除审批方案将同步删除方案步骤相关数据\r\n是否删除?", MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
try
|
|
{
|
|
// 验证删除存储过程
|
|
string tipMsg = string.Empty;
|
|
if (BaseImpl.deleteFlow(4, mMenuCode, model.typeCode, model.id, out tipMsg) == 1)
|
|
{
|
|
MessageUtil.Show("删除成功!");
|
|
// 重排列表
|
|
InitializeStepFlow();
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show(tipMsg);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw;
|
|
//MessageUtil.Show("删除失败:\r\n" + ex.Message);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:点击流转步骤加载数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-21 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
/// <exception cref="System.NotImplementedException"></exception>
|
|
void OnTitleLabelObjClick(StepItem2 before, StepItem2 after)
|
|
{
|
|
if (isBasis)
|
|
{
|
|
BaseflowTypeModel model = after.Tag as BaseflowTypeModel;
|
|
this.SeletStepItem2Obj = after;
|
|
this.SetFlowTypeItem(model);
|
|
|
|
}
|
|
else {
|
|
BillflowTypeModel model = after.Tag as BillflowTypeModel;
|
|
this.SeletStepItem2Obj = after;
|
|
this.SetFlowTypeItem(model);
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:部门下拉框值改变后</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnDepEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
string depid = this.labelComboxEdit1.EditValue;
|
|
string mf = this.labelTextEdit1.EditText;
|
|
|
|
DataTable table = isBasis?WorkFlowBaseImpl.GetWorkFlowUsers(depid, mf) : WorkFlowBillImpl.GetWorkFlowUsers(depid, mf);
|
|
DataTable Roletable = isBasis ? WorkFlowBaseImpl.GetWorkFlowRole(mf): WorkFlowBillImpl.GetWorkFlowRole(mf);
|
|
this.gridControl.DataSource = table;
|
|
this.gridControl1.DataSource = Roletable;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:用户值改变后</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-06-24 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
void OnUserEditValueChanged(object sender, EventArgs e)
|
|
{
|
|
string depid = this.labelComboxEdit1.EditValue;
|
|
string mf = this.labelTextEdit1.EditText;
|
|
|
|
DataTable table = WorkFlowBaseImpl.GetWorkFlowUsers(depid, mf);
|
|
DataTable Roletable = WorkFlowBaseImpl.GetWorkFlowRole(mf);
|
|
this.gridControl.DataSource = table;
|
|
this.gridControl1.DataSource = Roletable;
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:表格拖拽完成</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-14 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnDragGridCompleted(object sender, GridDragMemoArgs e)
|
|
{
|
|
if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
|
|
|
try
|
|
{
|
|
string userNames = string.Empty;
|
|
if (e.SourceGridViewObj.Name == "gridView")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
userNames += item["employeename"] + ",";
|
|
}
|
|
|
|
}
|
|
else if (e.SourceGridViewObj.Name == "gridView2")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
userNames += "{&" + item["roleName"] + |