using DevExpress.XtraEditors.Repository; using DevExpress.XtraGrid.Columns; using DevExpress.XtraGrid.Views.Grid; using DevExpress.XtraTreeList; using DevExpress.XtraTreeList.Nodes; 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.PubUserTomodule { public partial class FrmShortcutSettings : BaseForm { #region 私有字段 /// /// 复选框字段名称 /// private string _checkFieldName = "_check"; /// /// The _id /// private string _id = "_id"; #endregion #region 公有字段 /// /// 数据源 /// /// The data source. public DataTable DataSource { get { return this.AllQuickControlEx.gridControl.DataSourceTable(); } set { this.AllQuickControlEx.gridControl.DataSource = value; } } /// /// 控件类型 /// /// The type. public int IsType { get; set; } /// /// 绑定ValueMember /// public string ValueMember { get; set; } /// /// 隐藏值字段 /// public string ValueField { get; set; } /// /// 显示值字段 /// public string TextField { get; set; } /// /// 备注字段 /// public string RemarkField = "remark"; /// /// 数据源 /// /// The source SQL. public string SourceSQL { get; set; } /// /// 隐藏值 /// /// The edit value. //public string EditValue { get; set; } /// /// 显示值 /// /// The edit text. //public string EditText { get; set; } /// /// CurrentOperColumnKey值 /// /// The data source. public string CurrentOperColumnKey = string.Empty; /// /// CurrentOperModel值 /// /// The data source. public GridColumnModel CurrentOperModel = null; /// /// 配置的关联ModuleCodel值 /// /// The Union ModuleCodel. public string UnionModuleCodel; /// /// 左侧树数据 /// public DataRow LeftRowObj; /// /// 系统模块实体对象 /// /// The system model. public ModuleModel SysModel { get; private set; } /// /// 分割条位置 /// public int PositionSplitter; /// /// 分割条位置 /// public int WindowHeight; /// /// 选中人员id /// public string employeeId; /// /// 操作通道 /// public DataTable OperatingDt; /// /// 报表通道 /// public DataTable ReportDt; /// /// 全部的快捷设置 /// public DataTable AllShortcutSettings; /// /// 人员id或者角色id /// public string EmployeeID; /// ///人员 ture 角色 false /// public bool Operatorflag; #endregion public FrmShortcutSettings(string id, bool oeratorflag) { EmployeeID = id; Operatorflag = oeratorflag; InitializeComponent(); this.AllQuickControlEx.GridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.OnFormClosing); GridDragGrid dragGrid = new GridDragGrid(this.AllQuickControlEx.GridView, this.QuickOperationControlEx.GridView); GridDragGrid backdragGrid = new GridDragGrid(this.QuickOperationControlEx.GridView, this.AllQuickControlEx.GridView); GridDragGrid dragGridNew = new GridDragGrid(this.AllQuickControlEx.GridView, this.QuickReportFormControlEx.GridView); GridDragGrid backdragGridNew = new GridDragGrid(this.QuickReportFormControlEx.GridView, this.AllQuickControlEx.GridView); //加载复选框 GridDragGrid.GridAddCheckBox(this.AllQuickControlEx.GridView); GridDragGrid.GridAddCheckBox(this.QuickOperationControlEx.GridView); GridDragGrid.GridAddCheckBox(this.QuickReportFormControlEx.GridView); this.QuickOperationControlEx.GridView.OptionsSelection.EnableAppearanceFocusedCell = false; this.QuickReportFormControlEx.GridView.OptionsSelection.EnableAppearanceFocusedCell = false; this.Resize += new System.EventHandler(maximization); this.splitMain_Right.SplitterMoved += new EventHandler(PositionChange); GetExistingSettings(id); InitControls(); this.QuickOperationControlEx.GridView.BestFitColumns();//设置根据内容填充列宽 this.QuickReportFormControlEx.GridView.BestFitColumns();//设置根据内容填充列宽 this.AllQuickControlEx.GridView.BestFitColumns();//设置根据内容填充列宽 } #region 方法 #region 获取选择人员已有的快捷通道设置 public void GetExistingSettings(string UserId) { GridColumn treeListColumnName = new GridColumn(); treeListColumnName.Caption = "系统名称"; treeListColumnName.FieldName = "DllShowCaption"; treeListColumnName.MinWidth = 38; treeListColumnName.Visible = true; treeListColumnName.VisibleIndex = 0; treeListColumnName.Width = 300; GridColumn treeListColumnMenuId = new GridColumn(); treeListColumnMenuId.Caption = "菜单id"; treeListColumnMenuId.FieldName = "LMenuid"; treeListColumnMenuId.Visible = true; treeListColumnMenuId.VisibleIndex = 1; GridColumn treeListColumnModuleId = new GridColumn(); treeListColumnModuleId.Caption = "模块编号"; treeListColumnModuleId.FieldName = "PurviewId"; treeListColumnModuleId.Visible = true; treeListColumnModuleId.VisibleIndex = 1; this.QuickOperationControlEx.GridView.Columns.AddRange(new GridColumn[] { treeListColumnName, treeListColumnMenuId, treeListColumnModuleId }); this.QuickReportFormControlEx.GridView.Columns.AddRange(new GridColumn[] { treeListColumnName, treeListColumnMenuId, treeListColumnModuleId }); if (Operatorflag) { AllShortcutSettings = MainImpl.newGetGallerysByUserId(UserId); } else { try { string sql = @" Create Table P_RoleShortcut -- 角色快捷通道表 ( Id int identity(1,1) primary key, -- 分类ID,主键,自动增长 EmployeeID int not null, -- 角色编号 GroupTagid int not null, -- 1为操作 2为报表 ItemTagid int not null, -- ObjDll varchar(50) not null, --dll名 DllShowCaption varchar(50) not null, --模块名字 LinkModeTag int not null, --cs端为1 手机段为2 LMenuid int not null, --Menuid Lsubsysid int not null, --1级目录id orderid int, --cs段默认0 UrlParams varchar(50), --默认空 )"; SqlHelper.ExecuteNonQuery(sql); } catch { } AllShortcutSettings = MainImpl.GetGallerysByRoleId(UserId); } DataRow[] OperatingDr = AllShortcutSettings.Select("grouptagid=1"); DataRow[] ReportDr = AllShortcutSettings.Select("grouptagid=2"); DataTable OperatingDt = AllShortcutSettings.Clone(); DataTable ReportDt = AllShortcutSettings.Clone(); if (OperatingDr != null && OperatingDr.Length > 0) { foreach (DataRow row in OperatingDr) { OperatingDt.ImportRow(row); } } if (ReportDr != null && ReportDr.Length > 0) { foreach (DataRow row in ReportDr) { ReportDt.ImportRow(row); } } this.QuickOperationControlEx.gridControl.DataSource = OperatingDt; this.QuickReportFormControlEx.gridControl.DataSource = ReportDt; } #endregion #region 上方数据勾选,下方增加 public void AccessPermissions(DataRow rowItem, string grouptagid) { DataRow dr = AllShortcutSettings.NewRow(); dr["LMenuid"] = rowItem["LMenuid"] + ""; dr["PurviewId"] = rowItem["PurviewId"] + ""; dr["ObjDll"] = rowItem["DllFilename"] + ""; dr["DllShowCaption"] = rowItem["DllShowCaption"] + ""; dr["Lsubsysid"] = (this.PrimaryDirectory.EditValue + "").Split('.')[0]; dr["GroupTagid"] = grouptagid; dr["EmployeeID"] = EmployeeID; dr["LinkModeTag"] = "1"; dr["orderid"] = "0"; //数据源如果原本不存在选中行,则增加 if ((AllShortcutSettings.Rows.Cast().Where(x => x["LMenuid"] + "" == dr["LMenuid"] + "" && x["PurviewId"] + "" == dr["PurviewId"] + "")).Count() == 0) { this.AllShortcutSettings.Rows.Add(dr); if (grouptagid.Equals("1")) { DataTable QoDt = this.QuickOperationControlEx.gridControl.DataSource as DataTable; QoDt.Rows.Add(dr.ItemArray); } else { DataTable QrDt = this.QuickReportFormControlEx.gridControl.DataSource as DataTable; QrDt.Rows.Add(dr.ItemArray); } } } #endregion #region 下方数据删除,上方取消勾选 public void RemovePermissions(DataRow rowItem) { string menuid = rowItem["LMenuid"] + ""; DataRow[] dr = AllShortcutSettings.Select(string.Format("LMenuid='{0}' and EmployeeID='{1}'", menuid, EmployeeID)); if (dr.Length == 1) { AllShortcutSettings.Rows.Remove(dr[0]); } } #endregion #region 设置分割条位置 /// /// 说明:设置分割条位置 /// 创建人:王一帆 /// 创建日期:2021-07-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// protected void InitlizeSpiltLocation() { try { string width = IniHelper.Read(string.Format("base_width_{0}", this.UnionModuleCodel));//通过Key获取Value值 if (!string.IsNullOrEmpty(width)) { this.splitMain.SplitterPosition = Convert.ToInt32(width); } } catch (Exception ex) { LogHelper.Instance.WriteError(ex); MessageUtil.Show(ex); } } #endregion #region 获取选中行数据 /// /// 说明:获取选中行数据 /// 创建人:王一帆 /// 创建日期:2021-07-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// DataRow[]. public DataRow[] GetViewFocusedDataRows(GridView gridView) { int[] rows = gridView.GetSelectedRows(); DataRow[] dataRows = new DataRow[rows.Length]; for (int i = 0; i < rows.Length; i++) { dataRows[i] = gridView.GetDataRow(rows[i]); } return dataRows; } #endregion #region 刷新左侧树数据 /// /// 点击二级目录,加载具体模块 /// /// /// private void OnGridLeftGridViewClick(object sender, EventArgs e) { DataRow mSelectRow = this.gridLeft.GridView.GetFocusedDataRow(); if (mSelectRow != null) { string sql = string.Format("select MenuId as LMenuid,MenuCaption as DllShowCaption,PurviewId,subsysid,Menustruct,DllFilename from P_FormMenuConfigTab where subsysid='{0}' and left(menustruct,2)='{1}' and menustruct!='{1}' and useFlag='1' and len(menustruct)=4 ", mSelectRow["subsysid"] + "", mSelectRow["menustruct"] + ""); DataTable Alldt = SqlHelper.ExecuteDataTable(sql); string menuid = string.Empty; string purviewId = string.Empty; //DataTable HasBeenSetDt = Alldt.Clone();//已设置快捷通道的模块 List primaryKeys = new List(); //DataTable IsNotSetDt = Alldt.Clone();//为设置快捷通道的模块 for (int i = 0; i < Alldt.Rows.Count; i++) { menuid = Alldt.Rows[i]["LMenuid"] + ""; purviewId = Alldt.Rows[i]["purviewId"] + ""; if (string.IsNullOrWhiteSpace(menuid)) continue; //判断已有的快捷通道设置中是否有当前模块id if ((AllShortcutSettings.Rows.Cast().Where(x => x["LMenuid"] + "" == menuid && x["PurviewId"] + "" == purviewId)).Count() > 0) { //HasBeenSetDt.Rows.Add(Alldt.Rows[i].ItemArray); primaryKeys.Add(Alldt.Rows[i]["LMenuid"] + ""); } else { //IsNotSetDt.Rows.Add(Alldt.Rows[i].ItemArray); } } //this.AllQuickControlEx.gridControl.DataSource = IsNotSetDt; this.AllQuickControlEx.gridControl.DataSource = Alldt; for (int i = 0; i < Alldt.Rows.Count; i++) { if (primaryKeys.Contains(Alldt.Rows[i]["LMenuid"] + "")) this.AllQuickControlEx.GridView.SelectRow(i); } } } #endregion #region 创建界面 /// /// 说明:创建界面 /// 创建人:王一帆 /// 创建日期:2021-07-21 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The menu code. public void InitControls() { //this.gcDetail.OptionsView.ColumnAutoWidth = true; //this.gcMain.OptionsView.ColumnAutoWidth = true; PositionSplitter = this.splitMain_Right.SplitterPosition; WindowHeight = this.Height; //this.pl_left_top.Visible = false; this.gridLeft.Visible = true; this.treeLeft.Visible = false; this.InitlizeSpiltLocation();//设置分割条位置 GridColumn treeListColumnName = new GridColumn(); treeListColumnName.Caption = "系统名称"; treeListColumnName.FieldName = "DllShowCaption"; treeListColumnName.MinWidth = 38; treeListColumnName.Visible = true; treeListColumnName.VisibleIndex = 0; treeListColumnName.Width = 300; GridColumn treeListColumnMenuId = new GridColumn(); treeListColumnMenuId.Caption = "菜单id"; treeListColumnMenuId.FieldName = "LMenuid"; treeListColumnMenuId.Visible = true; treeListColumnMenuId.VisibleIndex = 1; GridColumn treeListColumnModuleId = new GridColumn(); treeListColumnModuleId.Caption = "模块编号"; treeListColumnModuleId.FieldName = "PurviewId"; treeListColumnModuleId.Visible = true; treeListColumnModuleId.VisibleIndex = 1; this.AllQuickControlEx.GridView.Columns.AddRange(new GridColumn[] { treeListColumnName, treeListColumnMenuId, treeListColumnModuleId }); //SetExistingPermissions(); //设置已有权限 //this.SetLeftTreeView();//设置左侧树数据 this.SettingOperation.Click += new EventHandler(OnSettingOperationRightsClick); this.SettingReport.Click += new EventHandler(OnSettingReportClick); this.SetRemovePermissions.Click += new EventHandler(OnRemovePermissionsClick); this.SetRemovePermissions.Click += new EventHandler(OnRemovePermissionsClick2); this.btnOk.Click += new EventHandler(OnbtnOkClick); this.btnCancel.Click += new EventHandler(btnCancel_Click); SetLevelOneDirectory(); this.PrimaryDirectory.SelectedValueChanged += new EventHandler(PrimaryDirectoryValueChanged); this.gridLeft.GridView.Click += new EventHandler(OnGridLeftGridViewClick); this.PrimaryDirectory.SelectedIndex = 0; } /// /// 改变一级目录,加载对应的二级目录 /// /// /// 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 useFlag=1 and subsysid='{0}' order by menustruct", text)); if (dt.Rows.Count > 0) { this.gridLeft.gridControl.DataSource = dt; this.gridLeft.GridView.SelectRowHandler(0); OnGridLeftGridViewClick(null, null); } else { this.gridLeft.gridControl.DataSource = null; this.AllQuickControlEx.gridControl.DataSource = null; this.QuickOperationControlEx.gridControl.DataSource = null; this.QuickReportFormControlEx.gridControl.DataSource = null; } } /// /// 设置一级目录,创建二级目录的表格列 /// 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 subsysidColumn = new GridColumn(); //subsysidColumn.Caption = "ID"; //subsysidColumn.FieldName = "SubSysId"; //subsysidColumn.VisibleIndex = 0; 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.gridLeft.GridView.Columns.AddRange(new GridColumn[] { //subsysidColumn, MenuIdColumn, MenuStructColumn, MenuCaptionColumn }); } #endregion #region 子节点状态改变时 /// /// 说明:子节点状态改变时 /// 创建人:王一帆 /// 创建日期:2021-09-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The instance containing the event data. private void SetCheckedChildNodes(TreeListNode node, CheckState check) { for (int i = 0; i < node.Nodes.Count; i++) { node.Nodes[i].CheckState = check; SetCheckedChildNodes(node.Nodes[i], check); } } #endregion #region 父节点状态改变时 /// /// 说明:父节点状态改变时 /// 创建人:王一帆 /// 创建日期:2021-09-22 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The instance containing the event data. private void SetCheckedParentNodes(TreeListNode node, CheckState check) { if (node.ParentNode != null) { bool b = false; CheckState state; for (int i = 0; i < node.ParentNode.Nodes.Count; i++) { state = (CheckState)node.ParentNode.Nodes[i].CheckState; if (!check.Equals(state)) { b = !b; break; } } node.ParentNode.CheckState = b ? CheckState.Indeterminate : check; SetCheckedParentNodes(node.ParentNode, check); } } #endregion #endregion #region 事件 #region 设置按钮点击事件 //设置操作快捷通道按钮点击事件 private void OnSettingOperationRightsClick(object sender, EventArgs e) { int[] rowNumbers = this.AllQuickControlEx.GridView.GetSelectedRows(); List addRows = new List(); foreach (int rowIndex in rowNumbers) { DataRow rowItem = this.AllQuickControlEx.GridView.GetDataRow(rowIndex); addRows.Add(rowItem); } foreach (DataRow dr in addRows) { AccessPermissions(dr, "1"); } } // 设置报表快捷通道按钮点击事件 private void OnSettingReportClick(object sender, EventArgs e) { int[] rowNumbers = this.AllQuickControlEx.GridView.GetSelectedRows(); List addRows = new List(); foreach (int rowIndex in rowNumbers) { DataRow rowItem = this.AllQuickControlEx.GridView.GetDataRow(rowIndex); addRows.Add(rowItem); } foreach (DataRow dr in addRows) { AccessPermissions(dr, "2"); } } //删除权限 QuickOperationControlEx表 private void OnRemovePermissionsClick(object sender, EventArgs e) { int[] rowNumbers = this.QuickOperationControlEx.GridView.GetSelectedRows(); if (rowNumbers.Length == 0) return; List deleteRows = new List(); List primaryKeys = new List(); foreach (int rowIndex in rowNumbers) { DataRow rowItem = this.QuickOperationControlEx.GridView.GetDataRow(rowIndex); deleteRows.Add(rowItem); primaryKeys.Add(rowItem["LMenuid"] + ""); } DataTable gcDetailDt = this.QuickOperationControlEx.gridControl.DataSource as DataTable; foreach (DataRow dr in deleteRows) { RemovePermissions(dr); gcDetailDt.Rows.Remove(dr); } DataTable gcMainDt = this.AllQuickControlEx.gridControl.DataSource as DataTable; for (int i = 0; i < gcMainDt.Rows.Count; i++) { if (primaryKeys.Contains(gcMainDt.Rows[i]["LMenuid"] + "")) this.AllQuickControlEx.GridView.UnselectRow(i); } } //QuickReportFormControlEx表 private void OnRemovePermissionsClick2(object sender, EventArgs e) { int[] rowNumbers = this.QuickReportFormControlEx.GridView.GetSelectedRows(); if (rowNumbers.Length == 0) return; List deleteRows = new List(); List primaryKeys = new List(); foreach (int rowIndex in rowNumbers) { DataRow rowItem = this.QuickReportFormControlEx.GridView.GetDataRow(rowIndex); deleteRows.Add(rowItem); primaryKeys.Add(rowItem["LMenuid"] + ""); } DataTable gcDetailDt = this.QuickReportFormControlEx.gridControl.DataSource as DataTable; foreach (DataRow dr in deleteRows) { RemovePermissions(dr); gcDetailDt.Rows.Remove(dr); } DataTable gcMainDt = this.AllQuickControlEx.gridControl.DataSource as DataTable; for (int i = 0; i < gcMainDt.Rows.Count; i++) { if (primaryKeys.Contains(gcMainDt.Rows[i]["LMenuid"] + "")) this.AllQuickControlEx.GridView.UnselectRow(i); } } //点击确定按钮 private void OnbtnOkClick(object sender, EventArgs e) { try { WaitForm.ShowForm(ResourceKeys.DataSaving); string TableName = string.Empty; if (Operatorflag) { TableName = "P_MessageToolLinkDllTab"; } else { TableName = "P_RoleShortcut"; } string deleteSql = string.Format("delete {0} where EmployeeID='{1}'", TableName, EmployeeID); SqlHelper.ExecuteNonQuery(deleteSql); string sql = string.Empty; foreach (DataRow dr in AllShortcutSettings.Rows) { sql = string.Format(@"insert into {10}(EmployeeID,GroupTagid,ItemTagid,ObjDll,DllShowCaption,LinkModeTag,LMenuid,Lsubsysid,orderid,UrlParams) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", dr["EmployeeID"], dr["GroupTagid"], dr["ItemTagid"], dr["ObjDll"], dr["DllShowCaption"], dr["LinkModeTag"], dr["LMenuid"], dr["Lsubsysid"], dr["orderid"], dr["UrlParams"], TableName); SqlHelper.ExecuteNonQuery(sql); } //把角色的快捷信息保存到对应的人员中 if (!Operatorflag) { //获得角色表对应的全部人员 DataTable Roledetailed = PowerImpl.GetWorkUsers(EmployeeID); foreach (DataRow RoledetailedDr in Roledetailed.Rows) { DataTable EmployeesQuicklyDt = MainImpl.newGetGallerysByUserId(RoledetailedDr["员工ID"] + ""); deleteSql = string.Format("delete P_MessageToolLinkDllTab where EmployeeID='{0}'",RoledetailedDr["员工ID"]); SqlHelper.ExecuteNonQuery(deleteSql); foreach (DataRow dr in AllShortcutSettings.Rows) { sql = string.Format(@"insert into P_MessageToolLinkDllTab(EmployeeID,GroupTagid,ItemTagid,ObjDll,DllShowCaption,LinkModeTag,LMenuid,Lsubsysid,orderid,UrlParams) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", RoledetailedDr["员工ID"], dr["GroupTagid"], dr["ItemTagid"], dr["ObjDll"], dr["DllShowCaption"], dr["LinkModeTag"], dr["LMenuid"], dr["Lsubsysid"], dr["orderid"], dr["UrlParams"]); SqlHelper.ExecuteNonQuery(sql); } foreach (DataRow dr in EmployeesQuicklyDt.Rows) { //判断是否存在员工独立的快捷设置 if ((AllShortcutSettings.Rows.Cast().Where(x => x["LMenuid"] + "" == dr["LMenuid"] + "" && x["PurviewId"] + "" == dr["PurviewId"] + "")).Count() == 0) { sql = string.Format(@"insert into P_MessageToolLinkDllTab(EmployeeID,GroupTagid,ItemTagid,ObjDll,DllShowCaption,LinkModeTag,LMenuid,Lsubsysid,orderid,UrlParams) values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')", RoledetailedDr["员工ID"], dr["GroupTagid"], dr["ItemTagid"], dr["ObjDll"], dr["DllShowCaption"], dr["LinkModeTag"], dr["LMenuid"], dr["Lsubsysid"], dr["orderid"], dr["UrlParams"]); SqlHelper.ExecuteNonQuery(sql); } } } } } catch (Exception ex) { //MessageUtil.Show(d" 保存失败"); } finally { WaitForm.HideForm(); } } #endregion #region 分割条位置改变 /// /// 说明:分割条位置包含时记录位置 /// 创建人:曹屹峰 /// 创建日期:2021-08-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void PositionChange(object sender, EventArgs e) { PositionSplitter = this.splitMain_Right.SplitterPosition; } #endregion #region 窗口大小改变 /// /// 说明:窗口大小改变时改变分割条位置 /// 创建人:曹屹峰 /// 创建日期:2021-08-25 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// private void maximization(object sender, EventArgs e) { double a = (double)PositionSplitter / (double)WindowHeight; this.splitMain_Right.SplitterPosition = Convert.ToInt32(Math.Round((double)this.Height * a)); WindowHeight = this.Height; } #endregion #region 已有权限改变 /// /// 说明:已有权限框内容改变事件 /// 创建人:曹屹峰 /// 创建日期:2022-06-15 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. //private void gridControlChange(object sender, RowCellClickEventArgs e) //{ // if (this.gcDetail.RowCount == 0) return; // //DataRow rowItem = this.gcDetail.GetFocusedDataRow(); //} #endregion #region 关闭时清空唯一键 /// /// 说明:关闭时清空唯一键 /// 创建人:王一帆 /// 创建日期:2021-07-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void OnFormClosing(object sender, FormClosingEventArgs e) { CurrentOperColumnKey = ""; CurrentOperModel = null; } #endregion #region 确定 /// /// 说明:确定 /// 创建人:龚宇超 /// 创建日期:2018-03-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnOk_Click(object sender, EventArgs e) { //this.EditValue = string.Empty; //this.EditText = string.Empty; DataRow[] rowItems = this.DataSource.Select(_checkFieldName + "=True"); //foreach (DataRow item in rowItems) //{ // this.EditValue += item[ValueMember] + ","; // this.EditText += item[TextField] + ","; //} //this.EditValue = this.EditValue.Trim(','); //this.EditText = this.EditText.Trim(','); this.DialogResult = DialogResult.OK; this.Close(); } #endregion #region 取消 /// /// 说明:取消 /// 创建人:龚宇超 /// 创建日期:2018-03-20 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The source of the event. /// The instance containing the event data. private void btnCancel_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.Cancel; } #endregion #endregion } }