ab56a9bcf7
SVN-Revision: r240
822 lines
35 KiB
C#
822 lines
35 KiB
C#
using DevExpress.XtraGrid.Columns;
|
|
using Lskj.Business;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Core;
|
|
using Lskj.Data;
|
|
using Lskj.Model;
|
|
using Lskj.Util;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Lskj.PubModuleToUser
|
|
{
|
|
public partial class FrmMain : Form
|
|
{
|
|
|
|
public DynamicPowerModel PubPowerModel;
|
|
string ReadStaffName = string.Empty; //只读
|
|
string ReadStaffId = string.Empty;
|
|
string EditStaffName = string.Empty;//操作
|
|
string EditStaffId = string.Empty;
|
|
public FrmMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
#region 创建页面
|
|
private void FrmMain_Load(object sender, EventArgs e)
|
|
{
|
|
SetLevelOneDirectory();
|
|
InitializeDeps();
|
|
this.PrimaryDirectory.SelectedValueChanged += new EventHandler(PrimaryDirectoryValueChanged);
|
|
this.SecondaryModuleControlEx.GridView.Click += new EventHandler(OnGridLeftGridViewClick);
|
|
this.PrimaryDirectory.SelectedIndex = 0;
|
|
this.TertiaryModuleControlEx.GridView.Click += new EventHandler(OnTertiaryModuleGridViewClick);//权限模块点击
|
|
this.labelTextEdit1.TextEdit.EditValueChanged += new EventHandler(OnUserEditValueChanged);
|
|
this.labelComboxEdit1.TextEdit.EditValueChanged += new EventHandler(OnDepEditValueChanged);
|
|
this.btnDelete.Click += new EventHandler(onBtnDeleteClick);
|
|
InitializeUsers();
|
|
OnTertiaryModuleGridViewClick(null, null);
|
|
}
|
|
|
|
//删除
|
|
private void onBtnDeleteClick(object sender, EventArgs e)
|
|
{
|
|
int[] browseRowNumbers = this.browseControl.GridView.GetSelectedRows();
|
|
int[] operationRowNumbers = this.operationControl.GridView.GetSelectedRows();
|
|
List<DataRow> deleteRows = new List<DataRow>();
|
|
DataRow mSelectRow = this.TertiaryModuleControlEx.GridView.GetFocusedDataRow();
|
|
if (mSelectRow == null) return;
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
|
|
//浏览
|
|
foreach (int rowIndex in browseRowNumbers)
|
|
{
|
|
DataRow rowItem = this.browseControl.GridView.GetDataRow(rowIndex);
|
|
deleteRows.Add(rowItem);
|
|
string id = rowItem["UserId"]+"";
|
|
string tipMsg = string.Empty;
|
|
if (!id.Contains("|"))
|
|
{
|
|
//人员
|
|
DataSet ds2 = BaseImpl.getAuthorityByEmpid(2, rowItem["UserId"] + "", "", "", out tipMsg);
|
|
List<string> readPurviews = ds2.Tables.Count > 0 ?( ds2.Tables[0].Rows[0]["pid"] + "").Split(',').ToList() : null;
|
|
readPurviews.Remove(MenuId);
|
|
string readPurview= string.Join(",", readPurviews);
|
|
DataRow DR = PowerImpl.GeRoleOperRow(id);
|
|
if (PowerImpl.SaveRoleOperDate(DR["员工ID"] + "", DR["员工姓名"] + "", DR["所属部门"] + "", readPurview, "", true))
|
|
{
|
|
int rValue = savedata(int.Parse(DR["员工ID"] + ""));
|
|
if (rValue == 1)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
}
|
|
}
|
|
}
|
|
else{
|
|
//角色
|
|
DataRow DR = PowerImpl.GetRoleRow(id.Replace("|",""));
|
|
string ReadPurview = DR["ReadPurview"].ToString().Trim();
|
|
List<string> readPurviews = ReadPurview.Split(',').ToList();
|
|
readPurviews.Remove(MenuId);
|
|
ReadPurview = string.Join(",", readPurviews);
|
|
string EditPurview = DR["EditPurview"].ToString().Trim();
|
|
if (PowerImpl.SaveRoleDate(id.Replace("|", ""), ReadPurview, EditPurview))
|
|
{
|
|
|
|
int rValue = saveRoledata(int.Parse(id.Replace("|", "")));
|
|
if (rValue == 0)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
//操作
|
|
foreach (int rowIndex in operationRowNumbers)
|
|
{
|
|
DataRow rowItem = this.operationControl.GridView.GetDataRow(rowIndex);
|
|
deleteRows.Add(rowItem);
|
|
string id = rowItem["UserId"] + "";
|
|
string tipMsg = string.Empty;
|
|
if (!id.Contains("|"))
|
|
{
|
|
//人员
|
|
DataSet ds = BaseImpl.getAuthorityByEmpid(1, id, "", "", out tipMsg);
|
|
List<string> editPurviews = ds.Tables.Count > 0 ? (ds.Tables[0].Rows[0]["pid"] + "").Split(',').ToList() : null;
|
|
editPurviews.Remove(MenuId);
|
|
string editPurview = string.Join(",", editPurviews);
|
|
DataRow DR = PowerImpl.GeRoleOperRow(id);
|
|
if (PowerImpl.SaveRoleOperDate(DR["员工ID"] + "", DR["员工姓名"] + "", DR["所属部门"] + "", "", editPurview, false))
|
|
{
|
|
int rValue = savedata(int.Parse(DR["员工ID"] + ""));
|
|
if (rValue == 1)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//角色
|
|
DataRow DR = PowerImpl.GetRoleRow(id.Replace("|", ""));
|
|
string ReadPurview = DR["ReadPurview"].ToString().Trim();
|
|
string EditPurview = DR["EditPurview"].ToString().Trim();
|
|
List<string> EditPurviews = EditPurview.Split(',').ToList();
|
|
EditPurviews.Remove(MenuId);
|
|
EditPurview = string.Join(",", EditPurviews);
|
|
if (PowerImpl.SaveRoleDate(id.Replace("|", ""), ReadPurview, EditPurview))
|
|
{
|
|
|
|
int rValue = saveRoledata(int.Parse(id.Replace("|", "")));
|
|
if (rValue == 0)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
OnTertiaryModuleGridViewClick(null, null);
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 方法
|
|
/// <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 = WorkFlowBaseImpl.GetDeps();
|
|
|
|
this.labelComboxEdit1.ValueMember = "departmentid";
|
|
this.labelComboxEdit1.ValueField = "departmentid";
|
|
this.labelComboxEdit1.TextField = "departmentname";
|
|
this.labelComboxEdit1.SetDataSource(table);
|
|
GridDragGrid.GridAddCheckBox(this.browseControl.GridView);
|
|
GridDragGrid.GridAddCheckBox(this.operationControl.GridView);
|
|
}
|
|
/// <summary>
|
|
/// 加载角色,人员信息
|
|
/// </summary>
|
|
private void InitializeUsers()
|
|
{
|
|
DataTable Roletable = PowerImpl.GetWorkRole("", "");
|
|
DataTable employeetable = PowerImpl.GetWorkEmployee();
|
|
this.RoleControlEx.DataSource = Roletable;
|
|
this.PeopleControlEx.DataSource = employeetable;
|
|
|
|
GridDragGrid dragGrid = new GridDragGrid(this.RoleGridView, this.browseControl.GridView);
|
|
dragGrid.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
|
|
|
GridDragGrid dragGrid2 = new GridDragGrid(this.RoleGridView, this.operationControl.GridView);
|
|
dragGrid2.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted2);
|
|
|
|
GridDragGrid dragGrid3 = new GridDragGrid(this.PeopleGridView, this.browseControl.GridView);
|
|
dragGrid3.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted);
|
|
|
|
GridDragGrid dragGrid4 = new GridDragGrid(this.PeopleGridView, this.operationControl.GridView);
|
|
dragGrid4.OnDragComplete += new GridFragGridCompleteEventHandler(OnDragGridCompleted2);
|
|
|
|
|
|
}
|
|
|
|
/// <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, GridDragGridArgs e)
|
|
{
|
|
string sql = string.Empty;
|
|
try
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
string userName = string.Empty;
|
|
string userId = string.Empty;
|
|
DataTable table = this.browseControl.gridControl.DataSource as DataTable;
|
|
|
|
|
|
DataRow mSelectRow = this.TertiaryModuleControlEx.GridView.GetFocusedDataRow();
|
|
if (e.SourceGridViewObj.Name == "PeopleGridView")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
|
|
userName += item["员工姓名"] + ",";
|
|
userId += item["员工ID"] + ",";
|
|
|
|
if (mSelectRow != null)
|
|
{
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
string tipMsg = string.Empty;
|
|
DataSet ds2 = BaseImpl.getAuthorityByEmpid(2, item["员工ID"]+"", "", "", out tipMsg);
|
|
string readPurview = ds2.Tables.Count > 0 ? ds2.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
|
readPurview = readPurview + MenuId + ",";
|
|
if (PowerImpl.SaveRoleOperDate(item["员工ID"]+"", item["员工姓名"] + "", item["所属部门"] + "", readPurview,"",true))
|
|
{
|
|
int rValue = savedata(int.Parse(item["员工ID"] + ""));
|
|
if (rValue == 1)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
DataRow addDr = table.NewRow();
|
|
addDr["UserId"] = item["员工ID"];
|
|
addDr["UserName"] = item["员工姓名"];
|
|
table.Rows.Add(addDr);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else if (e.SourceGridViewObj.Name == "RoleGridView")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
userName += "{&" + item["roleName"] + "&},";
|
|
userId += item["ID"] + "|,";
|
|
|
|
if (mSelectRow != null)
|
|
{
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
DataRow DR = PowerImpl.GetRoleRow(item["ID"]+"");
|
|
string ReadPurview = DR["ReadPurview"].ToString().Trim();
|
|
ReadPurview = ReadPurview + MenuId + ",";
|
|
string EditPurview = DR["EditPurview"].ToString().Trim();
|
|
if (PowerImpl.SaveRoleDate(item["ID"]+"", ReadPurview, EditPurview))
|
|
{
|
|
|
|
int rValue = saveRoledata(int.Parse(item["ID"] + ""));
|
|
if (rValue == 0)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
DataRow addDr = table.NewRow();
|
|
addDr["UserId"] = item["ID"];
|
|
addDr["UserName"] = item["roleName"];
|
|
table.Rows.Add(addDr);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("表格拖拽错误", ex);
|
|
LogHelper.Instance.WriteError(ex);
|
|
//MessageUtil.Show(ResourceKeys.OperFault);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
|
|
/// <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>
|
|
void OnDragGridCompleted2(object sender, GridDragGridArgs e)
|
|
{
|
|
string sql = string.Empty;
|
|
try
|
|
{
|
|
if (MessageUtil.Show(ResourceKeys.DragSelectRow, MessageBoxButtons.YesNo) == DialogResult.Yes)
|
|
{
|
|
string userName = string.Empty;
|
|
string userId = string.Empty;
|
|
DataRow mSelectRow = this.TertiaryModuleControlEx.GridView.GetFocusedDataRow();
|
|
DataTable table = this.operationControl.gridControl.DataSource as DataTable;
|
|
|
|
if (e.SourceGridViewObj.Name == "PeopleGridView")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
userName += item["员工姓名"] + ",";
|
|
userId += item["员工ID"] + ",";
|
|
|
|
if (mSelectRow != null)
|
|
{
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
string tipMsg = string.Empty;
|
|
DataSet ds = BaseImpl.getAuthorityByEmpid(1, item["员工ID"]+"", "", "", out tipMsg);
|
|
string editPurview = ds.Tables.Count > 0 ? ds.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
|
editPurview = editPurview + MenuId + ",";
|
|
if (PowerImpl.SaveRoleOperDate(item["员工ID"] + "", item["员工姓名"] + "", item["所属部门"] + "","", editPurview,false))
|
|
{
|
|
int rValue = savedata(int.Parse(item["员工ID"] + ""));
|
|
if (rValue == 1)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
DataRow addDr = table.NewRow();
|
|
addDr["UserId"] = item["员工ID"];
|
|
addDr["UserName"] = item["员工姓名"];
|
|
table.Rows.Add(addDr);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
else if (e.SourceGridViewObj.Name == "RoleGridView")
|
|
{
|
|
foreach (DataRow item in e.GridViewSelectRows)
|
|
{
|
|
userName += "{&" + item["roleName"] + "&},";
|
|
userId += item["ID"] + "|,";
|
|
|
|
if (mSelectRow != null)
|
|
{
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
DataRow DR = PowerImpl.GetRoleRow(item["ID"] + "");
|
|
string ReadPurview = DR["ReadPurview"].ToString().Trim();
|
|
string EditPurview = DR["EditPurview"].ToString().Trim();
|
|
EditPurview = EditPurview + MenuId + ",";
|
|
if (PowerImpl.SaveRoleDate(item["ID"] + "", ReadPurview, EditPurview))
|
|
{
|
|
|
|
int rValue = saveRoledata(int.Parse(item["ID"] + ""));
|
|
if (rValue == 0)
|
|
{
|
|
MessageUtil.Show("同步人员权限成功!");
|
|
DataRow addDr = table.NewRow();
|
|
addDr["UserId"] = item["ID"];
|
|
addDr["UserName"] = item["roleName"];
|
|
table.Rows.Add(addDr);
|
|
}
|
|
else
|
|
{
|
|
MessageUtil.Show("同步人员权限失败!");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogUtil.WriteError("表格拖拽错误", ex);
|
|
LogHelper.Instance.WriteError(ex);
|
|
//MessageUtil.Show(ResourceKeys.OperFault);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 执行保存人员权限时候的存储过程
|
|
/// </summary>
|
|
/// <param name="modid"></param>
|
|
/// <param name="tagid"></param>
|
|
/// <param name="mid"></param>
|
|
/// <returns></returns>
|
|
public int savedata(int operatorid)
|
|
{
|
|
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@operatorid",SqlDbType.VarChar,20),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
param[0].Value = operatorid;
|
|
BaseImpl.ExecProcedure("[p_SystemSetUserPurview]", param);
|
|
return Convert.ToInt32(returnValue.Value.ToString());
|
|
}
|
|
|
|
/// <summary>
|
|
/// 执行保存角色权限时候的存储过程
|
|
/// </summary>
|
|
/// <param name="modid"></param>
|
|
/// <param name="tagid"></param>
|
|
/// <param name="mid"></param>
|
|
/// <returns></returns>
|
|
public int saveRoledata(int roleid)
|
|
{
|
|
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
|
pMsg.Direction = ParameterDirection.Output;
|
|
SqlParameter returnValue = new SqlParameter("@return", SqlDbType.Int, 4);
|
|
returnValue.Direction = ParameterDirection.ReturnValue;
|
|
SqlParameter[] param =
|
|
{
|
|
new SqlParameter("@roleid ",SqlDbType.VarChar,20),
|
|
pMsg,
|
|
returnValue
|
|
};
|
|
param[0].Value = roleid;
|
|
BaseImpl.ExecProcedure("p_SystemSetRoleUserPurview", param);
|
|
return Convert.ToInt32(returnValue.Value.ToString());
|
|
}
|
|
|
|
/// <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>
|
|
//void OnDragGridCompleted(object sender, GridDragMemoArgs e)
|
|
//{
|
|
// if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
|
|
|
// try
|
|
// {
|
|
// string userNames = string.Empty;
|
|
// string userId = string.Empty;
|
|
// if (e.SourceGridViewObj.Name == "PeopleGridView")
|
|
// {
|
|
// foreach (DataRow item in e.GridViewSelectRows)
|
|
// {
|
|
// userNames += item["员工姓名"] + ",";
|
|
// userId += item["员工ID"] + ",";
|
|
// }
|
|
|
|
// }
|
|
// else if (e.SourceGridViewObj.Name == "RoleGridView")
|
|
// {
|
|
// foreach (DataRow item in e.GridViewSelectRows)
|
|
// {
|
|
// userNames += "{&" + item["roleName"] + "&},";
|
|
// userId += item["ID"] + "|,";
|
|
// }
|
|
// }
|
|
// ReadStaffName = ReadStaffName + userNames;
|
|
// ReadStaffId = ReadStaffId + userId;
|
|
// // this.memoEdit1.EditValue += userNames;
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// MessageUtil.Show(ResourceKeys.OperFault);
|
|
// }
|
|
//}
|
|
|
|
///// <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>
|
|
//void OnDragGridCompleted2(object sender, GridDragMemoArgs e)
|
|
//{
|
|
// if (e.GridViewSelectRows == null || e.GridViewSelectRows.Length == 0) return;
|
|
|
|
// try
|
|
// {
|
|
// string userNames = string.Empty;
|
|
// string userId = string.Empty;
|
|
// if (e.SourceGridViewObj.Name == "PeopleGridView")
|
|
// {
|
|
// foreach (DataRow item in e.GridViewSelectRows)
|
|
// {
|
|
// userNames += item["员工姓名"] + ",";
|
|
// userId += item["员工ID"] + ",";
|
|
// }
|
|
|
|
// }
|
|
// else if (e.SourceGridViewObj.Name == "RoleGridView")
|
|
// {
|
|
// foreach (DataRow item in e.GridViewSelectRows)
|
|
// {
|
|
// userNames += "{&" + item["roleName"] + "&},";
|
|
// userId += item["ID"] + "|,";
|
|
// }
|
|
// }
|
|
// EditStaffName = EditStaffName + userNames;
|
|
// EditStaffId = EditStaffId + userId;
|
|
// // this.memoEdit2.EditValue += userNames;
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// LogHelper.Instance.WriteError(ex);
|
|
// MessageUtil.Show(ResourceKeys.OperFault);
|
|
// }
|
|
//}
|
|
|
|
/// <summary>
|
|
/// 设置一级目录,创建二级目录和三级目录的表格列
|
|
/// </summary>
|
|
protected void SetLevelOneDirectory()
|
|
{
|
|
//获取一级目录
|
|
DataTable treeTable = SqlHelper.ExecuteDataTable("select subsysid,subsysname from P_SubSystemTab where useed=1");
|
|
string text = string.Empty;
|
|
foreach (DataRow dr in treeTable.Rows)
|
|
{
|
|
text = string.Empty;
|
|
text = dr["subsysid"] + "." + dr["subsysname"];
|
|
PrimaryDirectory.Properties.Items.Add(text);
|
|
}
|
|
|
|
//二级目录列
|
|
GridColumn MenuIdColumn = new GridColumn();
|
|
MenuIdColumn.Caption = "编号";
|
|
MenuIdColumn.FieldName = "MenuId";
|
|
MenuIdColumn.VisibleIndex = 1;
|
|
|
|
GridColumn MenuStructColumn = new GridColumn();
|
|
MenuStructColumn.Caption = "菜单号";
|
|
MenuStructColumn.FieldName = "MenuStruct";
|
|
MenuStructColumn.VisibleIndex = 2;
|
|
|
|
GridColumn MenuCaptionColumn = new GridColumn();
|
|
MenuCaptionColumn.Caption = "菜单名称";
|
|
MenuCaptionColumn.FieldName = "MenuCaption";
|
|
MenuCaptionColumn.VisibleIndex = 3;
|
|
|
|
|
|
this.SecondaryModuleControlEx.GridView.Columns.AddRange(new GridColumn[] {
|
|
//subsysidColumn,
|
|
MenuIdColumn,
|
|
MenuStructColumn,
|
|
MenuCaptionColumn
|
|
});
|
|
|
|
//三级目录列
|
|
GridColumn LMenuIdColumn = new GridColumn();
|
|
LMenuIdColumn.Caption = "ID";
|
|
LMenuIdColumn.FieldName = "MenuId";
|
|
LMenuIdColumn.VisibleIndex = 1;
|
|
|
|
GridColumn MenuCaptionColumnNew = new GridColumn();
|
|
MenuCaptionColumnNew.Caption = "模块名称";
|
|
MenuCaptionColumnNew.FieldName = "MenuCaption";
|
|
MenuCaptionColumnNew.VisibleIndex = 2;
|
|
|
|
GridColumn purviewIdColumn = new GridColumn();
|
|
purviewIdColumn.Caption = "模块ID";
|
|
purviewIdColumn.FieldName = "purviewId";
|
|
purviewIdColumn.VisibleIndex = 3;
|
|
|
|
this.TertiaryModuleControlEx.GridView.Columns.AddRange(new GridColumn[] {
|
|
//subsysidColumn,
|
|
LMenuIdColumn,
|
|
MenuCaptionColumnNew,
|
|
purviewIdColumn
|
|
});
|
|
|
|
//浏览权限表
|
|
this.browseControl.GridView.Columns.AddVisible("UserId", "ID");
|
|
this.browseControl.GridView.Columns.AddVisible("UserName", "名称");
|
|
//操作权限表
|
|
this.operationControl.GridView.Columns.AddVisible("UserId", "ID");
|
|
this.operationControl.GridView.Columns.AddVisible("UserName", "名称");
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 事件
|
|
/// <summary>
|
|
/// 改变一级目录,加载对应的二级目录
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void PrimaryDirectoryValueChanged(object sender, EventArgs e)
|
|
{
|
|
string text = (this.PrimaryDirectory.EditValue + "").Split('.')[0];
|
|
DataTable dt = SqlHelper.ExecuteDataTable(string.Format("select * from P_FormMenuConfigTab where len(menustruct)=2 and subsysid='{0}' order by menustruct", text));
|
|
if (dt.Rows.Count > 0)
|
|
{
|
|
this.SecondaryModuleControlEx.gridControl.DataSource = dt;
|
|
this.SecondaryModuleControlEx.GridView.SelectRowHandler(0);
|
|
OnGridLeftGridViewClick(null, null);
|
|
}
|
|
else
|
|
{
|
|
this.SecondaryModuleControlEx.gridControl.DataSource = null;
|
|
this.TertiaryModuleControlEx.gridControl.DataSource = null;
|
|
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 点击二级目录,加载具体模块
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnGridLeftGridViewClick(object sender, EventArgs e)
|
|
{
|
|
DataRow mSelectRow = this.SecondaryModuleControlEx.GridView.GetFocusedDataRow();
|
|
if (mSelectRow != null)
|
|
{
|
|
string sql = string.Format("select MenuId ,MenuCaption ,purviewId from P_FormMenuConfigTab where subsysid='{0}' and left(menustruct,2)='{1}' and menustruct!='{1}' and useFlag='1' order by menustruct ", mSelectRow["subsysid"] + "", mSelectRow["menustruct"] + "");
|
|
DataTable Alldt = SqlHelper.ExecuteDataTable(sql);
|
|
this.TertiaryModuleControlEx.gridControl.DataSource = Alldt;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 点击三级模块加载有权限的人员
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnTertiaryModuleGridViewClick(object sender, EventArgs e)
|
|
{
|
|
DataRow mSelectRow = this.TertiaryModuleControlEx.GridView.GetFocusedDataRow();
|
|
if (mSelectRow != null)
|
|
{
|
|
string MenuId = mSelectRow["MenuId"] + "";
|
|
//全部的人员信息
|
|
DataTable AllEmployees = PowerImpl.GetWorkEmployee();
|
|
|
|
string tipMsg = string.Empty;
|
|
//roleOperatorId
|
|
DataTable RdataTable = new DataTable();
|
|
RdataTable.Columns.Add("UserId");
|
|
RdataTable.Columns.Add("UserName");
|
|
DataTable OdataTable = new DataTable();
|
|
OdataTable.Columns.Add("UserId");
|
|
OdataTable.Columns.Add("UserName");
|
|
|
|
int i = 0;
|
|
foreach (DataRow dr in AllEmployees.Rows)
|
|
{
|
|
string id = dr["员工ID"] + "";
|
|
if (string.IsNullOrWhiteSpace(id)) continue;
|
|
DataSet ds = BaseImpl.getAuthorityByEmpid(1, id, "", "", out tipMsg);
|
|
string editPurview = ds.Tables.Count > 0 ? ds.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
|
string[] EditPurview = editPurview.Trim().TrimEnd(',').Split(',');
|
|
DataSet ds2 = BaseImpl.getAuthorityByEmpid(2, id, "", "", out tipMsg);
|
|
string readPurview = ds2.Tables.Count > 0 ? ds2.Tables[0].Rows[0]["pid"] + "" : string.Empty;
|
|
string[] ReadPurview = readPurview.Trim().TrimEnd(',').Split(',');
|
|
|
|
|
|
if (ReadPurview.Contains(MenuId))
|
|
{
|
|
//ReadStaffName = ReadStaffName + dr["员工姓名"] + ",";
|
|
//ReadStaffId = ReadStaffId + id + ",";
|
|
DataRow browsedr = RdataTable.NewRow();
|
|
browsedr["UserId"] = id;
|
|
browsedr["UserName"] = dr["员工姓名"] + "";
|
|
RdataTable.Rows.Add(browsedr);
|
|
}
|
|
if (EditPurview.Contains(MenuId))
|
|
{
|
|
//EditStaffName = EditStaffName + dr["员工姓名"] + ",";
|
|
//EditStaffId = EditStaffId + id + ",";
|
|
DataRow operationdr = OdataTable.NewRow();
|
|
operationdr["UserId"] = id;
|
|
operationdr["UserName"] = dr["员工姓名"] + "";
|
|
OdataTable.Rows.Add(operationdr);
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
// this.memoEdit1.Text = ReadStaffName;
|
|
// this.memoEdit2.Text = EditStaffName;
|
|
this.browseControl.gridControl.DataSource = RdataTable.Copy();
|
|
this.operationControl.gridControl.DataSource = OdataTable.Copy();
|
|
}
|
|
else {
|
|
this.browseControl.gridControl.DataSource = null;
|
|
this.operationControl.gridControl.DataSource = null;
|
|
}
|
|
}
|
|
|
|
|
|
/// <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 = WorkFlowBaseImpl.GetWorkFlowUsers(depid, mf);
|
|
table.Columns["loginaccount"].ColumnName = "员工工号";
|
|
table.Columns["employeename"].ColumnName = "员工姓名";
|
|
this.PeopleControlEx.DataSource = table;
|
|
|
|
}
|
|
|
|
/// <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);
|
|
table.Columns["loginaccount"].ColumnName = "员工工号";
|
|
table.Columns["employeename"].ColumnName = "员工姓名";
|
|
DataTable Roletable = WorkFlowBaseImpl.GetWorkFlowRole(mf);
|
|
this.PeopleControlEx.DataSource = table;
|
|
this.RoleControlEx.DataSource = Roletable;
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|