using System; using System.Data; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using Core.Mes.ClientFrameWork; using Core.Mes.IBaseInterface; //using Core.Mes.ServerFrameWork; using Infragistics.Win.UltraWinGrid; namespace Core.Mes.ClientPurviewManager { /// /// FrmRole 的摘要说明。 /// public class FrmRole : Core.Mes.ClientFrameWork.FrmBase { private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1; private System.Windows.Forms.Panel FrmRole_Fill_Panel; private System.Windows.Forms.Panel panel1; private Infragistics.Win.Misc.UltraExpandableGroupBox ultraExpandableGroupBox1; private Infragistics.Win.Misc.UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel1; private Infragistics.Win.Misc.UltraLabel ultraLabel1; private Infragistics.Win.Misc.UltraLabel ultraLabel2; private Infragistics.Win.Misc.UltraLabel ultraLabel3; private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor1; private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor2; private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor1; // private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor3; private System.ComponentModel.IContainer components; public DataSet _roleData; public string _selectSQL; public bool _saveFlag = false; public bool IsAdminFlag = false; private System.Windows.Forms.Panel panel2; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Bottom; private System.Windows.Forms.Panel panel3; private Infragistics.Win.UltraWinEditors.UltraCheckEditor ultraCheckEditor1; private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1; private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor4; private Infragistics.Win.Misc.UltraLabel ultraLabel8; private string[] _fileNames; private DataSet _departmentData; private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor3; string operDepart = ""; string allDept = ""; private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor4; private Infragistics.Win.Misc.UltraLabel ultraLabel4; string selDept = ""; public FrmRole() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// /// 清理所有正在使用的资源。 /// protected override void Dispose(bool disposing) { if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("Toolbar1"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("back"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("purset"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("back"); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Band 0", -1); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Column 0"); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Column 1"); Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("Column 2"); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance13 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance14 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance15 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance16 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance17 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance18 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance19 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton(); Infragistics.Win.Appearance appearance20 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance21 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance22 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance23 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinEditors.EditorButton editorButton2 = new Infragistics.Win.UltraWinEditors.EditorButton("part"); this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this.panel1 = new System.Windows.Forms.Panel(); this._panel1_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._panel1_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._panel1_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._panel1_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.FrmRole_Fill_Panel = new System.Windows.Forms.Panel(); this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.ultraExpandableGroupBox1 = new Infragistics.Win.Misc.UltraExpandableGroupBox(); this.ultraExpandableGroupBoxPanel1 = new Infragistics.Win.Misc.UltraExpandableGroupBoxPanel(); this.panel3 = new System.Windows.Forms.Panel(); this.ultraTextEditor4 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ultraLabel4 = new Infragistics.Win.Misc.UltraLabel(); this.ultraComboEditor4 = new Infragistics.Win.UltraWinEditors.UltraComboEditor(); this.ultraLabel8 = new Infragistics.Win.Misc.UltraLabel(); this.ultraTextEditor2 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ultraLabel2 = new Infragistics.Win.Misc.UltraLabel(); this.ultraTextEditor1 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel(); this.ultraLabel3 = new Infragistics.Win.Misc.UltraLabel(); this.ultraComboEditor1 = new Infragistics.Win.UltraWinEditors.UltraComboEditor(); this.panel2 = new System.Windows.Forms.Panel(); this.ultraTextEditor3 = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ultraCheckEditor1 = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit(); this.panel1.SuspendLayout(); this.FrmRole_Fill_Panel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).BeginInit(); this.ultraExpandableGroupBox1.SuspendLayout(); this.ultraExpandableGroupBoxPanel1.SuspendLayout(); this.panel3.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).BeginInit(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor3)).BeginInit(); this.SuspendLayout(); // // ultraToolbarsManager1 // this.ultraToolbarsManager1.DesignerFlags = 1; this.ultraToolbarsManager1.DockWithinContainer = this.panel1; this.ultraToolbarsManager1.ShowFullMenusDelay = 500; this.ultraToolbarsManager1.ShowQuickCustomizeButton = false; this.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.VisualStudio2005; ultraToolbar1.DockedColumn = 0; ultraToolbar1.DockedRow = 0; ultraToolbar1.Text = "Toolbar1"; buttonTool1.InstanceProps.IsFirstInGroup = true; buttonTool2.InstanceProps.IsFirstInGroup = true; buttonTool3.InstanceProps.IsFirstInGroup = true; buttonTool4.InstanceProps.IsFirstInGroup = true; buttonTool5.InstanceProps.IsFirstInGroup = true; buttonTool6.InstanceProps.IsFirstInGroup = true; ultraToolbar1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool1, buttonTool2, buttonTool3, buttonTool4, buttonTool5, buttonTool6}); this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { ultraToolbar1}); buttonTool7.SharedProps.Caption = "新增(&A)"; buttonTool7.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool8.SharedProps.Caption = "修改(&U)"; buttonTool8.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool8.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlU; buttonTool9.SharedProps.Caption = "删除(&D)"; buttonTool9.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool10.SharedProps.Caption = "查询(&Q)"; buttonTool10.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool11.SharedProps.Caption = "关闭(&E)"; buttonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool11.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlE; buttonTool12.SharedProps.Caption = "权限设置(&P)"; buttonTool12.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool13.SharedProps.Caption = "返回(&B)"; buttonTool13.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText; buttonTool13.SharedProps.Visible = false; this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool7, buttonTool8, buttonTool9, buttonTool10, buttonTool11, buttonTool12, buttonTool13}); this.ultraToolbarsManager1.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.ultraToolbarsManager1_ToolClick); // // panel1 // this.panel1.BackColor = System.Drawing.Color.Gainsboro; this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Left); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Right); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Top); this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Bottom); this.panel1.Dock = System.Windows.Forms.DockStyle.Top; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(656, 32); this.panel1.TabIndex = 1; // // _panel1_Toolbars_Dock_Area_Left // this._panel1_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._panel1_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._panel1_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 27); this._panel1_Toolbars_Dock_Area_Left.Name = "_panel1_Toolbars_Dock_Area_Left"; this._panel1_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 5); this._panel1_Toolbars_Dock_Area_Left.ToolbarsManager = this.ultraToolbarsManager1; // // _panel1_Toolbars_Dock_Area_Right // this._panel1_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._panel1_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._panel1_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(656, 27); this._panel1_Toolbars_Dock_Area_Right.Name = "_panel1_Toolbars_Dock_Area_Right"; this._panel1_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 5); this._panel1_Toolbars_Dock_Area_Right.ToolbarsManager = this.ultraToolbarsManager1; // // _panel1_Toolbars_Dock_Area_Top // this._panel1_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._panel1_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._panel1_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._panel1_Toolbars_Dock_Area_Top.Name = "_panel1_Toolbars_Dock_Area_Top"; this._panel1_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(656, 27); this._panel1_Toolbars_Dock_Area_Top.ToolbarsManager = this.ultraToolbarsManager1; // // _panel1_Toolbars_Dock_Area_Bottom // this._panel1_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._panel1_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._panel1_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._panel1_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._panel1_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 32); this._panel1_Toolbars_Dock_Area_Bottom.Name = "_panel1_Toolbars_Dock_Area_Bottom"; this._panel1_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(656, 0); this._panel1_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1; // // FrmRole_Fill_Panel // this.FrmRole_Fill_Panel.Controls.Add(this.ultraGrid1); this.FrmRole_Fill_Panel.Controls.Add(this.ultraExpandableGroupBox1); this.FrmRole_Fill_Panel.Controls.Add(this.panel2); this.FrmRole_Fill_Panel.Controls.Add(this.panel1); this.FrmRole_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default; this.FrmRole_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill; this.FrmRole_Fill_Panel.Location = new System.Drawing.Point(0, 0); this.FrmRole_Fill_Panel.Name = "FrmRole_Fill_Panel"; this.FrmRole_Fill_Panel.Size = new System.Drawing.Size(656, 470); this.FrmRole_Fill_Panel.TabIndex = 0; // // ultraGrid1 // appearance1.BackColor = System.Drawing.SystemColors.Window; appearance1.BorderColor = System.Drawing.SystemColors.InactiveCaption; this.ultraGrid1.DisplayLayout.Appearance = appearance1; appearance2.BackColor = System.Drawing.Color.LightGoldenrodYellow; ultraGridColumn1.CellAppearance = appearance2; appearance3.BackColor = System.Drawing.Color.LightSteelBlue; ultraGridColumn1.Header.Appearance = appearance3; ultraGridColumn1.Header.VisiblePosition = 0; ultraGridColumn2.Header.VisiblePosition = 1; appearance4.BackColor = System.Drawing.Color.LightGoldenrodYellow; ultraGridColumn3.CellAppearance = appearance4; appearance5.BackColor = System.Drawing.Color.LightSteelBlue; ultraGridColumn3.Header.Appearance = appearance5; ultraGridColumn3.Header.VisiblePosition = 2; ultraGridBand1.Columns.AddRange(new object[] { ultraGridColumn1, ultraGridColumn2, ultraGridColumn3}); this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1); this.ultraGrid1.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid; this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False; appearance6.BackColor = System.Drawing.SystemColors.ActiveBorder; appearance6.BackColor2 = System.Drawing.SystemColors.ControlDark; appearance6.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical; appearance6.BorderColor = System.Drawing.SystemColors.Window; this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance6; appearance7.ForeColor = System.Drawing.SystemColors.GrayText; this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance7; this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid; this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true; appearance8.BackColor = System.Drawing.SystemColors.ControlLightLight; appearance8.BackColor2 = System.Drawing.SystemColors.Control; appearance8.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal; appearance8.ForeColor = System.Drawing.SystemColors.GrayText; this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance8; this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1; this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1; appearance9.BackColor = System.Drawing.SystemColors.Window; appearance9.ForeColor = System.Drawing.SystemColors.ControlText; this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance9; appearance10.BackColor = System.Drawing.SystemColors.Highlight; appearance10.ForeColor = System.Drawing.SystemColors.HighlightText; this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance10; this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft; this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted; appearance11.BackColor = System.Drawing.SystemColors.Window; this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance11; appearance12.BorderColor = System.Drawing.Color.Silver; appearance12.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter; this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance12; this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText; this.ultraGrid1.DisplayLayout.Override.CellPadding = 0; appearance13.BackColor = System.Drawing.SystemColors.Control; appearance13.BackColor2 = System.Drawing.SystemColors.ControlDark; appearance13.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element; appearance13.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal; appearance13.BorderColor = System.Drawing.SystemColors.Window; this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance13; appearance14.BackColor = System.Drawing.Color.LightSteelBlue; appearance14.ImageHAlign = Infragistics.Win.HAlign.Center; appearance14.TextHAlign = Infragistics.Win.HAlign.Center; this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance14; this.ultraGrid1.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti; this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard; this.ultraGrid1.DisplayLayout.Override.MinRowHeight = 21; appearance15.BackColor = System.Drawing.SystemColors.Window; appearance15.BorderColor = System.Drawing.Color.Silver; this.ultraGrid1.DisplayLayout.Override.RowAppearance = appearance15; appearance16.BackColor = System.Drawing.Color.LightSteelBlue; this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance = appearance16; this.ultraGrid1.DisplayLayout.Override.RowSelectorHeaderStyle = Infragistics.Win.UltraWinGrid.RowSelectorHeaderStyle.SeparateElement; this.ultraGrid1.DisplayLayout.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex; this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True; appearance17.BackColor = System.Drawing.SystemColors.ControlLight; this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance17; this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill; this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate; this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy; this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill; this.ultraGrid1.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.ultraGrid1.Location = new System.Drawing.Point(0, 80); this.ultraGrid1.Name = "ultraGrid1"; this.ultraGrid1.Size = new System.Drawing.Size(656, 278); this.ultraGrid1.TabIndex = 4; this.ultraGrid1.Text = "ultraGrid1"; this.ultraGrid1.AfterRowActivate += new System.EventHandler(this.ultraGrid1_AfterRowActivate); // // ultraExpandableGroupBox1 // this.ultraExpandableGroupBox1.Controls.Add(this.ultraExpandableGroupBoxPanel1); this.ultraExpandableGroupBox1.Dock = System.Windows.Forms.DockStyle.Bottom; this.ultraExpandableGroupBox1.ExpandedSize = new System.Drawing.Size(648, 80); this.ultraExpandableGroupBox1.Location = new System.Drawing.Point(0, 358); this.ultraExpandableGroupBox1.Name = "ultraExpandableGroupBox1"; this.ultraExpandableGroupBox1.Size = new System.Drawing.Size(656, 112); this.ultraExpandableGroupBox1.SupportThemes = false; this.ultraExpandableGroupBox1.TabIndex = 2; this.ultraExpandableGroupBox1.Text = " 编辑区域"; this.ultraExpandableGroupBox1.ViewStyle = Infragistics.Win.Misc.GroupBoxViewStyle.Office2003; // // ultraExpandableGroupBoxPanel1 // this.ultraExpandableGroupBoxPanel1.Controls.Add(this.panel3); this.ultraExpandableGroupBoxPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.ultraExpandableGroupBoxPanel1.Location = new System.Drawing.Point(2, 22); this.ultraExpandableGroupBoxPanel1.Name = "ultraExpandableGroupBoxPanel1"; this.ultraExpandableGroupBoxPanel1.Size = new System.Drawing.Size(652, 88); this.ultraExpandableGroupBoxPanel1.TabIndex = 0; // // panel3 // this.panel3.BackColor = System.Drawing.Color.Gainsboro; this.panel3.Controls.Add(this.ultraTextEditor4); this.panel3.Controls.Add(this.ultraLabel4); this.panel3.Controls.Add(this.ultraComboEditor4); this.panel3.Controls.Add(this.ultraLabel8); this.panel3.Controls.Add(this.ultraTextEditor2); this.panel3.Controls.Add(this.ultraLabel2); this.panel3.Controls.Add(this.ultraTextEditor1); this.panel3.Controls.Add(this.ultraLabel1); this.panel3.Controls.Add(this.ultraLabel3); this.panel3.Controls.Add(this.ultraComboEditor1); this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; this.panel3.Location = new System.Drawing.Point(0, 0); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(652, 88); this.panel3.TabIndex = 6; // // ultraTextEditor4 // appearance18.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor4.Appearance = appearance18; this.ultraTextEditor4.AutoSize = true; this.ultraTextEditor4.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor4.Location = new System.Drawing.Point(73, 56); this.ultraTextEditor4.Name = "ultraTextEditor4"; this.ultraTextEditor4.Size = new System.Drawing.Size(569, 21); this.ultraTextEditor4.TabIndex = 25; // // ultraLabel4 // this.ultraLabel4.Location = new System.Drawing.Point(16, 59); this.ultraLabel4.Name = "ultraLabel4"; this.ultraLabel4.Size = new System.Drawing.Size(54, 16); this.ultraLabel4.TabIndex = 24; this.ultraLabel4.Text = "角色描述"; // // ultraComboEditor4 // appearance19.BackColor = System.Drawing.Color.LightCyan; this.ultraComboEditor4.Appearance = appearance19; this.ultraComboEditor4.AutoSize = true; this.ultraComboEditor4.ButtonsRight.Add(editorButton1); this.ultraComboEditor4.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never; this.ultraComboEditor4.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList; this.ultraComboEditor4.Location = new System.Drawing.Point(482, 16); this.ultraComboEditor4.Name = "ultraComboEditor4"; this.ultraComboEditor4.Size = new System.Drawing.Size(160, 21); this.ultraComboEditor4.TabIndex = 23; this.ultraComboEditor4.SelectionChanged += new System.EventHandler(this.ultraComboEditor4_SelectionChanged); this.ultraComboEditor4.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraComboEditor4_EditorButtonClick); // // ultraLabel8 // this.ultraLabel8.Location = new System.Drawing.Point(450, 16); this.ultraLabel8.Name = "ultraLabel8"; this.ultraLabel8.Size = new System.Drawing.Size(29, 16); this.ultraLabel8.TabIndex = 22; this.ultraLabel8.Text = "部门"; // // ultraTextEditor2 // appearance20.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor2.Appearance = appearance20; this.ultraTextEditor2.AutoSize = true; this.ultraTextEditor2.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor2.Location = new System.Drawing.Point(259, 16); this.ultraTextEditor2.Name = "ultraTextEditor2"; this.ultraTextEditor2.Size = new System.Drawing.Size(160, 21); this.ultraTextEditor2.TabIndex = 4; // // ultraLabel2 // this.ultraLabel2.Location = new System.Drawing.Point(202, 16); this.ultraLabel2.Name = "ultraLabel2"; this.ultraLabel2.Size = new System.Drawing.Size(54, 16); this.ultraLabel2.TabIndex = 1; this.ultraLabel2.Text = "角色名称"; // // ultraTextEditor1 // appearance21.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor1.Appearance = appearance21; this.ultraTextEditor1.AutoSize = true; this.ultraTextEditor1.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor1.Location = new System.Drawing.Point(73, 16); this.ultraTextEditor1.Name = "ultraTextEditor1"; this.ultraTextEditor1.Size = new System.Drawing.Size(92, 21); this.ultraTextEditor1.TabIndex = 3; // // ultraLabel1 // this.ultraLabel1.Location = new System.Drawing.Point(16, 16); this.ultraLabel1.Name = "ultraLabel1"; this.ultraLabel1.Size = new System.Drawing.Size(54, 16); this.ultraLabel1.TabIndex = 0; this.ultraLabel1.Text = "角色编码"; // // ultraLabel3 // this.ultraLabel3.Location = new System.Drawing.Point(16, 41); this.ultraLabel3.Name = "ultraLabel3"; this.ultraLabel3.Size = new System.Drawing.Size(54, 16); this.ultraLabel3.TabIndex = 2; this.ultraLabel3.Text = "权限文件"; this.ultraLabel3.Visible = false; // // ultraComboEditor1 // appearance22.BackColor = System.Drawing.Color.LightCyan; this.ultraComboEditor1.Appearance = appearance22; this.ultraComboEditor1.AutoSize = true; this.ultraComboEditor1.Location = new System.Drawing.Point(73, 41); this.ultraComboEditor1.Name = "ultraComboEditor1"; this.ultraComboEditor1.Size = new System.Drawing.Size(109, 21); this.ultraComboEditor1.TabIndex = 5; this.ultraComboEditor1.Visible = false; // // panel2 // this.panel2.Controls.Add(this.ultraTextEditor3); this.panel2.Controls.Add(this.ultraCheckEditor1); this.panel2.Dock = System.Windows.Forms.DockStyle.Top; this.panel2.Location = new System.Drawing.Point(0, 32); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(656, 48); this.panel2.TabIndex = 3; // // ultraTextEditor3 // appearance23.BackColor = System.Drawing.Color.LightCyan; this.ultraTextEditor3.Appearance = appearance23; this.ultraTextEditor3.AutoSize = true; this.ultraTextEditor3.BackColor = System.Drawing.Color.LightCyan; editorButton2.Key = "part"; editorButton2.Text = "..."; this.ultraTextEditor3.ButtonsRight.Add(editorButton2); this.ultraTextEditor3.Enabled = false; this.ultraTextEditor3.Location = new System.Drawing.Point(88, 8); this.ultraTextEditor3.Name = "ultraTextEditor3"; this.ultraTextEditor3.ReadOnly = true; this.ultraTextEditor3.Size = new System.Drawing.Size(168, 21); this.ultraTextEditor3.TabIndex = 5; this.ultraTextEditor3.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraTextEditor3_EditorButtonClick); // // ultraCheckEditor1 // this.ultraCheckEditor1.Location = new System.Drawing.Point(40, 8); this.ultraCheckEditor1.Name = "ultraCheckEditor1"; this.ultraCheckEditor1.Size = new System.Drawing.Size(48, 20); this.ultraCheckEditor1.TabIndex = 4; this.ultraCheckEditor1.Text = "部门"; this.ultraCheckEditor1.CheckedChanged += new System.EventHandler(this.ultraCheckEditor1_CheckedChanged); // // FrmRole // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.ClientSize = new System.Drawing.Size(656, 470); this.Controls.Add(this.FrmRole_Fill_Panel); this.Name = "FrmRole"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.Manual; this.Text = "角色管理"; this.WindowState = System.Windows.Forms.FormWindowState.Normal; this.Load += new System.EventHandler(this.FrmRole_Load); ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit(); this.panel1.ResumeLayout(false); this.FrmRole_Fill_Panel.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).EndInit(); this.ultraExpandableGroupBox1.ResumeLayout(false); this.ultraExpandableGroupBoxPanel1.ResumeLayout(false); this.panel3.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor4)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).EndInit(); this.panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor3)).EndInit(); this.ResumeLayout(false); } #endregion #region "显示窗体" private void GetChildDept() { try { string strOut = ""; DataSet ds = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("PurviewManager", "Core.Mes.PurviewManager.UAM_USER", "SelectChildDept", new object[] { operDepart }, out strOut) as DataSet; if (ds.Tables[0].Rows[0][0].ToString() != "") { allDept = "'" + ds.Tables[0].Rows[0][0].ToString() + "'" + operDepart + "'"; } else allDept = "'" + operDepart + "'"; } catch(System.Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } private void FrmRole_Load(object sender, System.EventArgs e) { try { operDepart = ClientCommon._UserInfo.UserDepID; GetChildDept(); ultraCheckEditor1.Checked = true; ultraTextEditor3.Text = ClientCommon._UserInfo.UserDepName; ultraTextEditor3.Tag = allDept; if (!IsAdminFlag) this.ultraToolbarsManager1.Tools["purset"].SharedProps.Visible = false; GetDepartmentData(); Getroledata(""); Query(); GetFileNames(); InitGrid(); InitCombo(); this.ultraGrid1.DisplayLayout.Bands[0].Override.AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True; } catch //(Exception ex) { // Core.Mes.ServerFrameWork.CoreMesLogger.log(this.GetType()).Error(ex.Message); } } private void InitCombo() { // if (_roleData != null && _roleData.Tables.Count >0) // { // foreach(DataRow arow in (_roleData).Tables[0].Rows) // this.ultraComboEditor3.Items.Add(arow[1]); // if(!this.ultraComboEditor3.Items.Contains(System.DBNull.Value)) this.ultraComboEditor3.Items.Add(System.DBNull.Value); // } if (_departmentData != null && _departmentData.Tables.Count > 0) { DataTable dt = this._departmentData.Tables[0].Copy(); this.ultraComboEditor4.Items.Clear(); foreach (DataRow dr in dt.Rows) { if (dr["DEPARTMENTID"].ToString() == "ROOT" && operDepart != "ROOT") continue; try { this.ultraComboEditor4.Items.Add(dr["DEPARTMENTID"], dr["DEPARTMENTNAME"].ToString()); } catch { } } } } private void InitGrid() { //SetFileValueList(); GetPartData(); //this.ultraGrid1.DataSource = _roleData.Tables[0]; this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "角色编码"; this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Width = 100; this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellAppearance.BackColor = Color.LightGoldenrodYellow; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Header.Caption = "角色名称"; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Width = 200; this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellActivation = Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].Header.Caption = "角色描述"; this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].Width = 300; this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellActivation = Activation.NoEdit; //this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].ValueList = ultraGrid1.DisplayLayout.ValueLists["file"]; this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellAppearance.BackColor = Color.LightGoldenrodYellow; this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Header.Caption = "部门"; this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Width = 200; this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellActivation = Activation.NoEdit; this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].ValueList = ultraGrid1.DisplayLayout.ValueLists["part"]; } private void Getroledata(string str) { try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "SelectUAM_ROLE"; par.args = new object[] { str }; string strOut = ""; _roleData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet; } catch (Exception ex) { Console.WriteLine(ex.Message); } } private void SetFileValueList() { if (ultraGrid1.DisplayLayout.ValueLists.Exists("file")) ultraGrid1.DisplayLayout.ValueLists["file"].ValueListItems.Clear(); else ultraGrid1.DisplayLayout.ValueLists.Add("file"); //try //{ // ultraGrid1.DisplayLayout.ValueLists["file"].ValueListItems.Clear(); //} //catch //{ // ultraGrid1.DisplayLayout.ValueLists.Add("file"); //} foreach (string str in this._fileNames) { Infragistics.Win.ValueListItem vli = new Infragistics.Win.ValueListItem(); vli.DisplayText = str.Split((char)92)[1]; vli.DataValue = str.Split((char)92)[1]; ultraGrid1.DisplayLayout.ValueLists["file"].ValueListItems.Add(vli); this.ultraComboEditor1.Items.Add(vli.DataValue, vli.DisplayText); // this.ultraComboEditor2.Items.Add(vli); } } private void GetFileNames() { try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; //par.AssemblyName = "Core.Mes.PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "GetFiles"; par.args = null; par.ServerType = MesServerType.MesSystemBaseServer; string strOut = ""; _fileNames = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as string[]; } catch //(Exception ex) { // CoreMesLogger.log(this.GetType()).Error(ex.Message); } } private void GetPartData() { if (ultraGrid1.DisplayLayout.ValueLists.Exists("part")) ultraGrid1.DisplayLayout.ValueLists["part"].ValueListItems.Clear(); else ultraGrid1.DisplayLayout.ValueLists.Add("part"); //try //{ // ultraGrid1.DisplayLayout.ValueLists["part"].ValueListItems.Clear(); //} //catch //{ // ultraGrid1.DisplayLayout.ValueLists.Add("part"); //} DataTable dt = this._departmentData.Tables[0].Copy(); foreach (DataRow dr in dt.Rows) { Infragistics.Win.ValueListItem vli = new Infragistics.Win.ValueListItem(); vli.DisplayText = dr["DEPARTMENTNAME"].ToString(); vli.DataValue = dr["DEPARTMENTID"]; ultraGrid1.DisplayLayout.ValueLists["part"].ValueListItems.Add(vli); } } #endregion private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { switch (e.Tool.Key) { case "purset": FrmFunction frmFunc = new FrmFunction(); frmFunc.ShowDialog(); break; case "add": Add(); break; case "edit": Edit(); break; case "del": Del(); break; case "query": Query(); break; case "close": this.Close(); break; case "back": this.ultraToolbarsManager1.Toolbars[0].Tools["back"].SharedProps.Visible = false; ultraCheckEditor1.Checked = true; ultraTextEditor3.Text = ClientCommon._UserInfo.UserDepName; ultraTextEditor3.Tag = allDept; Query(); this.ultraGrid1.DataSource = _roleData.Tables[0]; break; } } private void Add() { if (this.ultraTextEditor1.Text.Trim() == "") { MessageBox.Show("请录入角色编码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.ultraTextEditor2.Text.Trim() == "") { MessageBox.Show("请录入角色姓名!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //if (this.ultraComboEditor1.Value == null) //{ // MessageBox.Show("请选择权限文件!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} if (this.ultraComboEditor4.Value == null) { MessageBox.Show("请选择角色所属的部门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.ultraComboEditor4.Value.ToString() == "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("必须选择下属部门!"); return; } if (allDept.IndexOf("'" + ultraComboEditor4.Value.ToString() + "'") < 0 && operDepart != "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("你没有配置这一部门角色的权限,请重新选择部门!"); return; } ArrayList al = new ArrayList(); al.Add(this.ultraTextEditor1.Text.Trim()); al.Add(this.ultraTextEditor2.Text.Trim()); al.Add(ultraTextEditor4.Text.Trim()); al.Add(this.ultraComboEditor4.Value); try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; //par.AssemblyName = "Core.Mes.PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "InsertUAM_ROLE"; par.args = new object[] { al }; par.ServerType = MesServerType.MesSystemBaseServer; string strOut = ""; object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut); if (strOut != "") { MessageBox.Show("新增失败! \n" + strOut); return; } else { if ((int)obj != 1) { MessageBox.Show("新增失败!"); return; } } } catch //(Exception ex) { // CoreMesLogger.log(this.GetType()).Error(ex.Message); return; } UltraGridRow ugr = this.ultraGrid1.DisplayLayout.Bands[0].AddNew(); ugr.Cells[0].Value = al[0]; ugr.Cells[1].Value = al[1]; ugr.Cells[2].Value = al[2]; this.ultraGrid1.UpdateData(); Query(); } private void Del() { int i = 0; UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { MessageBox.Show("请选择要删除的角色!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show("是否确认删除选中的角色?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } try { i = ugr.Index; CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; //par.AssemblyName = "Core.Mes.PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "DeleteUAM_ROLE"; par.args = new object[] { ugr.Cells[0].Value.ToString() }; par.ServerType = MesServerType.MesSystemBaseServer; string strOut = ""; object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut); if (strOut != "") { MessageBox.Show("删除失败! \n" + strOut); return; } else { if ((int)obj != 1) { MessageBox.Show("删除失败!"); return; } } } catch //(Exception ex) { // CoreMesLogger.log(this.GetType()).Error(ex.Message); return; } ultraGrid1.ActiveRow.Delete(false); ultraGrid1.UpdateData(); try { ultraGrid1.Rows[i].Activate(); } catch { int count = ultraGrid1.Rows.Count; if (count > 0) ultraGrid1.Rows[count - 1].Activate(); } } private void Edit() { UltraGridRow ugr = this.ultraGrid1.ActiveRow; if (ugr == null) { MessageBox.Show("请选择要修改的角色!"); return; } if (ultraTextEditor1.Text.Trim() != ugr.Cells["ROLEID"].Text.Trim()) { MessageBox.Show("不能修改角色编码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //if (this.ultraComboEditor1.Value == null) //{ // MessageBox.Show("请选择要修改的权限!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); // return; //} if (this.ultraTextEditor2.Text.Trim() == "") { MessageBox.Show("请选择要修改的角色名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.ultraComboEditor4.Value == null) { MessageBox.Show("请选择修改的角色所属部门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (this.ultraComboEditor4.Value.ToString() == "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("必须选择下属部门!"); return; } if (allDept.IndexOf("'" + ultraComboEditor4.Value.ToString() + "'") < 0 && operDepart != "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("你没有配置这一部门角色的权限,请重新选择部门!"); return; } ArrayList al = new ArrayList(); al.Add(this.ultraTextEditor1.Text.Trim()); al.Add(this.ultraTextEditor2.Text.Trim()); al.Add(ultraTextEditor4.Text.Trim()); al.Add(this.ultraComboEditor4.Value); try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; //par.AssemblyName = "Core.Mes.PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "UpdateUAM_ROLE"; par.args = new object[] { al }; par.ServerType = MesServerType.MesSystemBaseServer; string strOut = ""; object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut); if (strOut != "") { MessageBox.Show("修改失败 \n" + strOut); return; } else { int i = (int)obj; if (i != 1) { MessageBox.Show("修改失败"); return; } } } catch //(Exception ex) { // CoreMesLogger.log(this.GetType()).Error(ex.Message); return; } ugr.Cells[0].Value = al[0]; ugr.Cells[1].Value = al[1]; ugr.Cells[2].Value = al[2]; ultraGrid1.UpdateData(); Query(); } private void Query() { if (this.ultraTextEditor3.Text == null || !this.ultraCheckEditor1.Checked) { MessageBox.Show("请选择要查询的部门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } GetSelDept(); if (this.ultraCheckEditor1.Checked && this.ultraTextEditor3.Text != "") { if (operDepart != "ROOT" && allDept.IndexOf("'" + selDept + "'") < 0) { MessageBox.Show("你没有查看这一部门的权限,请重新选择!"); return; } } Getroledata(""); string sqlExt = " where 1=1 "; sqlExt += GetRefreshWhere() + "order by ROLEID"; try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "SelectUAM_ROLE"; par.args = new object[] { sqlExt }; string strOut = ""; DataSet dset = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet; this.ultraGrid1.DataSource = dset.Tables[0]; ultraGrid1.UpdateData(); this.ultraToolbarsManager1.Toolbars[0].Tools["back"].SharedProps.Visible = true; } catch (Exception ex) { Console.WriteLine(ex.Message); } } private string GetRefreshWhere() { string sqlstr = ""; if (this.ultraTextEditor3.Enabled && this.ultraCheckEditor1.Checked && this.ultraTextEditor3.Text != "") { ArrayList al = this.GetRoleID(); if (al == null || al.Count == 0) { sqlstr = "1=2"; } else { sqlstr += "and ROLEID in ('" + al[0].ToString() + "'"; for (int i = 1; i < al.Count; i++) { sqlstr += ", '" + al[i].ToString() + "' "; } sqlstr += ")"; } } return sqlstr; } private ArrayList GetRoleID() { ArrayList al = new ArrayList(); DataTable dt = null; if (this._roleData == null) dt = null; else dt = this._roleData.Tables[0]; if (dt != null) { if (this.ultraTextEditor3.Enabled && this.ultraTextEditor3.Tag != null) { string partid = this.ultraTextEditor3.Tag.ToString(); string strFilter = "DEPARTMENTID in (" + partid + ")"; dt.DefaultView.RowFilter = strFilter; } for (int i = 0; i < dt.DefaultView.Count; i++) { al.Add(dt.DefaultView[i]["ROLEID"].ToString()); } return al; } else return null; } private void ultraGrid1_AfterRowActivate(object sender, System.EventArgs e) { try { if (this.ultraGrid1.ActiveRow == null) return; UltraGridRow ugr = this.ultraGrid1.ActiveRow; this.ultraTextEditor1.Text = ugr.Cells[0].Value.ToString(); this.ultraTextEditor2.Text = ugr.Cells[1].Value.ToString(); //this.ultraComboEditor1.Value=ugr.Cells[2].Value; ultraTextEditor4.Text = ugr.Cells[2].Value.ToString(); this.ultraComboEditor4.Value = ugr.Cells[3].Value; } catch (Exception ex) { Console.WriteLine(ex.Message); } } private void ultraCheckEditor1_CheckedChanged(object sender, System.EventArgs e) { this.ultraTextEditor3.Enabled = this.ultraCheckEditor1.Checked; } /* private void ultraComboEditor2_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { GetFileNames(); if (_fileNames != null) { foreach(string fileNames in _fileNames) this.ultraComboEditor2 .Items .Add (fileNames); if(!this.ultraComboEditor2.Items.Contains(System.DBNull.Value)) this.ultraComboEditor2.Items.Add(System.DBNull.Value); } } */ private void ultraComboEditor4_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { try { FrmSetDepart frm = new FrmSetDepart(); frm.GetChildIDFlag = false; frm.Location = GetChildWindowLocation(frm.Size); frm.ShowDialog(); InitCombo(); if (frm.SelectedID != "" && frm.SelectedName != "") { this.ultraComboEditor4.Value = frm.SelectedID; if (operDepart != "ROOT" && this.ultraComboEditor4.Value.ToString() == "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("所属权限不允许选择选择整个公司!"); return; } if (allDept.IndexOf("'" + ultraComboEditor4.Value.ToString() + "'") < 0 && operDepart != "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("你没有配置这一部门用户的权限,请重新选择部门!"); return; } } } catch { } } private Point GetChildWindowLocation(Size ChildWindowSize) { int width = Cursor.Position.X + ChildWindowSize.Width - Screen.PrimaryScreen.Bounds.Width; int height = Cursor.Position.Y + ChildWindowSize.Height - Screen.PrimaryScreen.Bounds.Height + 30; if (width > 0) width = Cursor.Position.X - width; else width = Cursor.Position.X; if (height > 0) height = Cursor.Position.Y - height + 10; else height = Cursor.Position.Y + 10; return new Point(width, height); } private void GetDepartmentData() { try { CallingMessage par = new CallingMessage(); par.ServerName = "PurviewManager"; par.ClassName = "Core.Mes.PurviewManager.PurviewManager"; par.MethodName = "SelectUAM_DEPARTMENT"; par.args = new object[] { " order by DEPARTMENTID " }; string strOut = ""; _departmentData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet; } catch { } } private void ultraTextEditor3_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e) { try { FrmSetDepart frm = new FrmSetDepart(); frm.Location = GetChildWindowLocation(frm.Size); frm.ShowDialog(); if (frm.SelectedID != "" && frm.SelectedName != "") { this.ultraTextEditor3.Text = frm.SelectedName; this.ultraTextEditor3.Tag = frm.SelectedID; GetSelDept(); if (this.ultraTextEditor3.Text != "" && this.ultraCheckEditor1.Checked) { if (operDepart != "ROOT" && allDept.IndexOf("'" + selDept + "'") < 0) { MessageBox.Show("你没有查看这一部门的权限,请重新选择!"); } } } } catch { } } private void ultraComboEditor4_SelectionChanged(object sender, EventArgs e) { try { if (operDepart != "ROOT" && ultraComboEditor4.Value.ToString() == "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("所属权限不允许选择选择整个公司!"); return; } if (ultraComboEditor4.Value != null && allDept.IndexOf("'" + ultraComboEditor4.Value.ToString() + "'") < 0 && operDepart != "ROOT") { this.ultraComboEditor4.Value = null; MessageBox.Show("你没有配置这一部门用户的权限,请重新选择部门!"); return; } } catch { } } private void GetSelDept() { try { if (this.ultraTextEditor3.Text != "" && this.ultraCheckEditor1.Checked) { DataTable dt = this._departmentData.Tables[0].Copy(); foreach (DataRow dr in dt.Rows) { if (dr["DEPARTMENTNAME"].ToString() == this.ultraTextEditor3.Text) { selDept = dr["DEPARTMENTID"].ToString(); return; } } } } catch { } } } }