using System;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.IO;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win.UltraWinEditors;

using Core.Mes.ClientFrameWork;
using Core.Mes.IBaseInterface;
//using Core.Mes.ServerFrameWork;

namespace Core.Mes.ClientPurviewManager
{
    /// <summary>
    /// FrmAuthorization 的摘要说明。
    /// </summary>
    public class FrmAuthorization : Core.Mes.ClientFrameWork.FrmBase
    {
        private System.Windows.Forms.Panel panel1;
        private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1;
        private System.Windows.Forms.Panel FrmAuthorization_Fill_Panel;
        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 Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
        private System.Windows.Forms.Panel panel2;
        private Infragistics.Win.UltraWinEditors.UltraCheckEditor ultraCheckEditor1;
        private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor1;
        private Infragistics.Win.UltraWinEditors.UltraCheckEditor ultraCheckEditor2;
        private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor1;
        private Infragistics.Win.Misc.UltraButton ultraButton1;
        private Infragistics.Win.Misc.UltraButton ultraButton2;
        private Infragistics.Win.Misc.UltraExpandableGroupBox ultraExpandableGroupBox1;
        private Infragistics.Win.Misc.UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel1;
        private System.Windows.Forms.Panel panel3;
        private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor3;
        private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor4;
        private Infragistics.Win.UltraWinEditors.UltraComboEditor ultraComboEditor2;
        private Infragistics.Win.UltraWinEditors.UltraTextEditor ultraTextEditor2;
        private Infragistics.Win.Misc.UltraLabel ultraLabel4;
        private Infragistics.Win.Misc.UltraLabel ultraLabel3;
        private Infragistics.Win.Misc.UltraLabel ultraLabel2;
        private Infragistics.Win.Misc.UltraLabel ultraLabel1;
        private System.Windows.Forms.ToolTip toolTip1;
        private Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter ultraGridExcelExporter1;
        private Infragistics.Win.Misc.UltraLabel ultraLabel5;
        private UltraTextEditor ultLoginID;
        private Infragistics.Win.Misc.UltraLabel ultraLabel6;
        private System.ComponentModel.IContainer components;

        public FrmAuthorization()
        {
            //
            // Windows 窗体设计器支持所必需的
            //
            InitializeComponent();

            //
            // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
            //
        }

        /// <summary>
        /// 清理所有正在使用的资源。
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose(disposing);
        }

        #region Windows 窗体设计器生成的代码
        /// <summary>
        /// 设计器支持所需的方法 - 不要使用代码编辑器修改
        /// 此方法的内容。
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("aubar");
            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("leadin");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("back");
            Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("leadin");
            Infragistics.Win.Appearance appearance2 = 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("LOGINID");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("ROLEID");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("USERID");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("PASSWD");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn5 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("DEPARTMENTID");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn6 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("WORKPOS");
            Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn7 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("ROLEMEMO");
            Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
            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.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton("part");
            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.Appearance appearance20 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinEditors.EditorButton editorButton2 = new Infragistics.Win.UltraWinEditors.EditorButton("SET");
            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.Appearance appearance24 = new Infragistics.Win.Appearance();
            Infragistics.Win.UltraWinEditors.EditorButton editorButton3 = new Infragistics.Win.UltraWinEditors.EditorButton("part");
            this.ultraTextEditor4 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
            this.panel1 = new System.Windows.Forms.Panel();
            this._panel1_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
            this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
            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.FrmAuthorization_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.ultraLabel5 = new Infragistics.Win.Misc.UltraLabel();
            this.ultraComboEditor3 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
            this.ultraComboEditor2 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
            this.ultraTextEditor2 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
            this.ultraLabel4 = new Infragistics.Win.Misc.UltraLabel();
            this.ultraLabel3 = new Infragistics.Win.Misc.UltraLabel();
            this.ultraLabel2 = new Infragistics.Win.Misc.UltraLabel();
            this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel();
            this.panel2 = new System.Windows.Forms.Panel();
            this.ultLoginID = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
            this.ultraLabel6 = new Infragistics.Win.Misc.UltraLabel();
            this.ultraButton2 = new Infragistics.Win.Misc.UltraButton();
            this.ultraButton1 = new Infragistics.Win.Misc.UltraButton();
            this.ultraComboEditor1 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
            this.ultraCheckEditor2 = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
            this.ultraTextEditor1 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
            this.ultraCheckEditor1 = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
            this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
            this.ultraGridExcelExporter1 = new Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor4)).BeginInit();
            this.panel1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit();
            this.FrmAuthorization_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.ultraComboEditor3)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor2)).BeginInit();
            this.panel2.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.ultLoginID)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor1)).BeginInit();
            this.SuspendLayout();
            // 
            // ultraTextEditor4
            // 
            appearance1.BackColor = System.Drawing.Color.LightCyan;
            this.ultraTextEditor4.Appearance = appearance1;
            this.ultraTextEditor4.AutoSize = true;
            this.ultraTextEditor4.BackColor = System.Drawing.Color.LightCyan;
            this.ultraTextEditor4.FlatMode = true;
            this.ultraTextEditor4.Location = new System.Drawing.Point(422, 23);
            this.ultraTextEditor4.Name = "ultraTextEditor4";
            this.ultraTextEditor4.PasswordChar = '*';
            this.ultraTextEditor4.Size = new System.Drawing.Size(224, 19);
            this.ultraTextEditor4.TabIndex = 15;
            // 
            // panel1
            // 
            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(927, 32);
            this.panel1.TabIndex = 0;
            // 
            // _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, 25);
            this._panel1_Toolbars_Dock_Area_Left.Name = "_panel1_Toolbars_Dock_Area_Left";
            this._panel1_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 7);
            this._panel1_Toolbars_Dock_Area_Left.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // ultraToolbarsManager1
            // 
            this.ultraToolbarsManager1.DesignerFlags = 1;
            this.ultraToolbarsManager1.DockWithinContainer = this.panel1;
            this.ultraToolbarsManager1.FlatMode = true;
            this.ultraToolbarsManager1.ShowQuickCustomizeButton = false;
            this.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.VisualStudio2005;
            ultraToolbar1.DockedColumn = 0;
            ultraToolbar1.DockedRow = 0;
            ultraToolbar1.Text = "aubar";
            buttonTool1.InstanceProps.IsFirstInGroup = true;
            buttonTool2.InstanceProps.IsFirstInGroup = true;
            buttonTool3.InstanceProps.IsFirstInGroup = true;
            buttonTool4.InstanceProps.IsFirstInGroup = true;
            buttonTool5.InstanceProps.IsFirstInGroup = true;
            buttonTool6.InstanceProps.IsFirstInGroup = true;
            buttonTool7.InstanceProps.IsFirstInGroup = true;
            ultraToolbar1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            buttonTool1,
            buttonTool2,
            buttonTool3,
            buttonTool4,
            buttonTool5,
            buttonTool6,
            buttonTool7});
            this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
            ultraToolbar1});
            buttonTool8.SharedProps.Caption = "新增(&A)";
            buttonTool8.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool9.SharedProps.Caption = "修改(&U)";
            buttonTool9.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool9.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlU;
            buttonTool10.SharedProps.Caption = "删除(&D)";
            buttonTool10.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool11.SharedProps.Caption = "查询(&Q)";
            buttonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool12.SharedProps.Caption = "关闭(&E)";
            buttonTool12.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool12.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlE;
            buttonTool13.SharedProps.Caption = "返回(&B)";
            buttonTool13.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            buttonTool13.SharedProps.Visible = false;
            buttonTool14.SharedProps.Caption = "导入Excel";
            buttonTool14.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
            this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
            buttonTool8,
            buttonTool9,
            buttonTool10,
            buttonTool11,
            buttonTool12,
            buttonTool13,
            buttonTool14});
            this.ultraToolbarsManager1.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.ultraToolbarsManager1_ToolClick);
            // 
            // _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(927, 25);
            this._panel1_Toolbars_Dock_Area_Right.Name = "_panel1_Toolbars_Dock_Area_Right";
            this._panel1_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 7);
            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(927, 25);
            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(927, 0);
            this._panel1_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1;
            // 
            // FrmAuthorization_Fill_Panel
            // 
            this.FrmAuthorization_Fill_Panel.Controls.Add(this.ultraGrid1);
            this.FrmAuthorization_Fill_Panel.Controls.Add(this.ultraExpandableGroupBox1);
            this.FrmAuthorization_Fill_Panel.Controls.Add(this.panel2);
            this.FrmAuthorization_Fill_Panel.Controls.Add(this.panel1);
            this.FrmAuthorization_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
            this.FrmAuthorization_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
            this.FrmAuthorization_Fill_Panel.Location = new System.Drawing.Point(0, 0);
            this.FrmAuthorization_Fill_Panel.Name = "FrmAuthorization_Fill_Panel";
            this.FrmAuthorization_Fill_Panel.Size = new System.Drawing.Size(927, 509);
            this.FrmAuthorization_Fill_Panel.TabIndex = 0;
            // 
            // ultraGrid1
            // 
            appearance2.BackColor = System.Drawing.SystemColors.Window;
            appearance2.BorderColor = System.Drawing.SystemColors.InactiveCaption;
            this.ultraGrid1.DisplayLayout.Appearance = appearance2;
            ultraGridColumn1.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn1.Header.Caption = "登录帐号";
            ultraGridColumn1.Header.VisiblePosition = 0;
            ultraGridColumn1.Width = 80;
            ultraGridColumn2.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn2.Header.Caption = "角色";
            ultraGridColumn2.Header.VisiblePosition = 5;
            ultraGridColumn2.Width = 150;
            ultraGridColumn3.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn3.Header.Caption = "员工";
            ultraGridColumn3.Header.VisiblePosition = 2;
            ultraGridColumn3.Width = 100;
            ultraGridColumn4.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn4.EditorControl = this.ultraTextEditor4;
            ultraGridColumn4.Format = "*";
            ultraGridColumn4.Header.Caption = "登录密码";
            ultraGridColumn4.Header.VisiblePosition = 1;
            ultraGridColumn4.Width = 80;
            ultraGridColumn5.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn5.Header.Caption = "部门";
            ultraGridColumn5.Header.VisiblePosition = 3;
            ultraGridColumn5.Width = 150;
            ultraGridColumn6.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn6.Header.Caption = "岗位";
            ultraGridColumn6.Header.VisiblePosition = 4;
            ultraGridColumn6.Width = 100;
            ultraGridColumn7.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
            ultraGridColumn7.Header.Caption = "角色描述";
            ultraGridColumn7.Header.VisiblePosition = 6;
            ultraGridColumn7.Width = 300;
            ultraGridBand1.Columns.AddRange(new object[] {
            ultraGridColumn1,
            ultraGridColumn2,
            ultraGridColumn3,
            ultraGridColumn4,
            ultraGridColumn5,
            ultraGridColumn6,
            ultraGridColumn7});
            this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
            this.ultraGrid1.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
            this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
            appearance3.BackColor = System.Drawing.SystemColors.ActiveBorder;
            appearance3.BackColor2 = System.Drawing.SystemColors.ControlDark;
            appearance3.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
            appearance3.BorderColor = System.Drawing.SystemColors.Window;
            this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance3;
            appearance4.ForeColor = System.Drawing.SystemColors.GrayText;
            this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance4;
            this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
            this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
            appearance5.BackColor = System.Drawing.SystemColors.ControlLightLight;
            appearance5.BackColor2 = System.Drawing.SystemColors.Control;
            appearance5.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
            appearance5.ForeColor = System.Drawing.SystemColors.GrayText;
            this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance5;
            this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
            this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
            appearance6.BackColor = System.Drawing.SystemColors.Window;
            appearance6.ForeColor = System.Drawing.SystemColors.ControlText;
            this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance6;
            appearance7.BackColor = System.Drawing.SystemColors.Highlight;
            appearance7.ForeColor = System.Drawing.SystemColors.HighlightText;
            this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance7;
            this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
            this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
            appearance8.BackColor = System.Drawing.SystemColors.Window;
            this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance8;
            appearance9.BorderColor = System.Drawing.Color.Silver;
            appearance9.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
            this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance9;
            this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
            this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
            appearance10.BackColor = System.Drawing.SystemColors.Control;
            appearance10.BackColor2 = System.Drawing.SystemColors.ControlDark;
            appearance10.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
            appearance10.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
            appearance10.BorderColor = System.Drawing.SystemColors.Window;
            this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance10;
            appearance11.BackColor = System.Drawing.Color.LightSteelBlue;
            appearance11.TextHAlign = Infragistics.Win.HAlign.Center;
            this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance11;
            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;
            appearance12.BackColor = System.Drawing.SystemColors.Window;
            appearance12.BorderColor = System.Drawing.Color.Silver;
            this.ultraGrid1.DisplayLayout.Override.RowAppearance = appearance12;
            appearance13.BackColor = System.Drawing.Color.LightSteelBlue;
            this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance = appearance13;
            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;
            appearance14.BackColor = System.Drawing.SystemColors.ControlLight;
            this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance14;
            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.Location = new System.Drawing.Point(0, 80);
            this.ultraGrid1.Name = "ultraGrid1";
            this.ultraGrid1.Size = new System.Drawing.Size(927, 317);
            this.ultraGrid1.TabIndex = 1;
            this.ultraGrid1.Text = "ultraGrid1";
            this.ultraGrid1.AfterRowActivate += new System.EventHandler(this.ultraGrid1_AfterRowActivate);
            // 
            // ultraExpandableGroupBox1
            // 
            this.ultraExpandableGroupBox1.BackColor = System.Drawing.Color.Gainsboro;
            this.ultraExpandableGroupBox1.Controls.Add(this.ultraExpandableGroupBoxPanel1);
            this.ultraExpandableGroupBox1.Dock = System.Windows.Forms.DockStyle.Bottom;
            this.ultraExpandableGroupBox1.ExpandedSize = new System.Drawing.Size(704, 112);
            this.ultraExpandableGroupBox1.Location = new System.Drawing.Point(0, 397);
            this.ultraExpandableGroupBox1.Name = "ultraExpandableGroupBox1";
            this.ultraExpandableGroupBox1.Size = new System.Drawing.Size(927, 112);
            this.ultraExpandableGroupBox1.SupportThemes = false;
            this.ultraExpandableGroupBox1.TabIndex = 3;
            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(923, 88);
            this.ultraExpandableGroupBoxPanel1.TabIndex = 0;
            // 
            // panel3
            // 
            this.panel3.Controls.Add(this.ultraLabel5);
            this.panel3.Controls.Add(this.ultraComboEditor3);
            this.panel3.Controls.Add(this.ultraTextEditor4);
            this.panel3.Controls.Add(this.ultraComboEditor2);
            this.panel3.Controls.Add(this.ultraTextEditor2);
            this.panel3.Controls.Add(this.ultraLabel4);
            this.panel3.Controls.Add(this.ultraLabel3);
            this.panel3.Controls.Add(this.ultraLabel2);
            this.panel3.Controls.Add(this.ultraLabel1);
            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(923, 88);
            this.panel3.TabIndex = 0;
            // 
            // ultraLabel5
            // 
            this.ultraLabel5.Location = new System.Drawing.Point(665, 28);
            this.ultraLabel5.Name = "ultraLabel5";
            this.ultraLabel5.Size = new System.Drawing.Size(54, 16);
            this.ultraLabel5.TabIndex = 17;
            this.ultraLabel5.Text = "登录密码";
            this.ultraLabel5.Visible = false;
            // 
            // ultraComboEditor3
            // 
            appearance15.BackColor = System.Drawing.Color.LightCyan;
            this.ultraComboEditor3.Appearance = appearance15;
            this.ultraComboEditor3.AutoSize = true;
            editorButton1.Key = "part";
            editorButton1.Text = "...";
            this.ultraComboEditor3.ButtonsRight.Add(editorButton1);
            this.ultraComboEditor3.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never;
            this.ultraComboEditor3.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
            this.ultraComboEditor3.FlatMode = true;
            this.ultraComboEditor3.Location = new System.Drawing.Point(168, 56);
            this.ultraComboEditor3.Name = "ultraComboEditor3";
            this.ultraComboEditor3.Size = new System.Drawing.Size(152, 19);
            this.ultraComboEditor3.TabIndex = 16;
            this.ultraComboEditor3.SelectionChanged += new System.EventHandler(this.ultraComboEditor3_SelectionChanged);
            this.ultraComboEditor3.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraComboEditor3_EditorButtonClick_1);
            // 
            // ultraComboEditor2
            // 
            appearance16.BackColor = System.Drawing.Color.LightCyan;
            this.ultraComboEditor2.Appearance = appearance16;
            this.ultraComboEditor2.AutoSize = true;
            this.ultraComboEditor2.FlatMode = true;
            this.ultraComboEditor2.Location = new System.Drawing.Point(422, 56);
            this.ultraComboEditor2.Name = "ultraComboEditor2";
            this.ultraComboEditor2.Size = new System.Drawing.Size(224, 19);
            this.ultraComboEditor2.TabIndex = 14;
            // 
            // ultraTextEditor2
            // 
            appearance17.BackColor = System.Drawing.Color.LightCyan;
            this.ultraTextEditor2.Appearance = appearance17;
            this.ultraTextEditor2.AutoSize = true;
            this.ultraTextEditor2.BackColor = System.Drawing.Color.LightCyan;
            this.ultraTextEditor2.FlatMode = true;
            this.ultraTextEditor2.Location = new System.Drawing.Point(168, 23);
            this.ultraTextEditor2.Name = "ultraTextEditor2";
            this.ultraTextEditor2.Size = new System.Drawing.Size(152, 19);
            this.ultraTextEditor2.TabIndex = 13;
            // 
            // ultraLabel4
            // 
            this.ultraLabel4.Location = new System.Drawing.Point(364, 24);
            this.ultraLabel4.Name = "ultraLabel4";
            this.ultraLabel4.Size = new System.Drawing.Size(54, 16);
            this.ultraLabel4.TabIndex = 12;
            this.ultraLabel4.Text = "登录密码";
            // 
            // ultraLabel3
            // 
            this.ultraLabel3.Location = new System.Drawing.Point(110, 57);
            this.ultraLabel3.Name = "ultraLabel3";
            this.ultraLabel3.Size = new System.Drawing.Size(54, 16);
            this.ultraLabel3.TabIndex = 11;
            this.ultraLabel3.Text = "用户姓名";
            // 
            // ultraLabel2
            // 
            appearance18.BackColor = System.Drawing.Color.Gainsboro;
            this.ultraLabel2.Appearance = appearance18;
            this.ultraLabel2.Location = new System.Drawing.Point(389, 57);
            this.ultraLabel2.Name = "ultraLabel2";
            this.ultraLabel2.Size = new System.Drawing.Size(29, 16);
            this.ultraLabel2.TabIndex = 10;
            this.ultraLabel2.Text = "角色";
            // 
            // ultraLabel1
            // 
            appearance19.BackColor = System.Drawing.Color.Gainsboro;
            this.ultraLabel1.Appearance = appearance19;
            this.ultraLabel1.Location = new System.Drawing.Point(110, 24);
            this.ultraLabel1.Name = "ultraLabel1";
            this.ultraLabel1.Size = new System.Drawing.Size(54, 16);
            this.ultraLabel1.TabIndex = 9;
            this.ultraLabel1.Text = "登录帐号";
            // 
            // panel2
            // 
            this.panel2.BackColor = System.Drawing.Color.Gainsboro;
            this.panel2.Controls.Add(this.ultLoginID);
            this.panel2.Controls.Add(this.ultraLabel6);
            this.panel2.Controls.Add(this.ultraButton2);
            this.panel2.Controls.Add(this.ultraButton1);
            this.panel2.Controls.Add(this.ultraComboEditor1);
            this.panel2.Controls.Add(this.ultraCheckEditor2);
            this.panel2.Controls.Add(this.ultraTextEditor1);
            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(927, 48);
            this.panel2.TabIndex = 2;
            // 
            // ultLoginID
            // 
            appearance20.BackColor = System.Drawing.Color.LightCyan;
            this.ultLoginID.Appearance = appearance20;
            this.ultLoginID.AutoSize = true;
            this.ultLoginID.BackColor = System.Drawing.Color.LightCyan;
            appearance21.TextHAlign = Infragistics.Win.HAlign.Center;
            appearance21.TextVAlign = Infragistics.Win.VAlign.Middle;
            editorButton2.Appearance = appearance21;
            editorButton2.ButtonStyle = Infragistics.Win.UIElementButtonStyle.VisualStudio2005Button;
            editorButton2.Key = "SET";
            editorButton2.Text = "";
            this.ultLoginID.ButtonsRight.Add(editorButton2);
            this.ultLoginID.FlatMode = true;
            this.ultLoginID.Location = new System.Drawing.Point(688, 17);
            this.ultLoginID.Name = "ultLoginID";
            this.ultLoginID.Size = new System.Drawing.Size(152, 19);
            this.ultLoginID.TabIndex = 6;
            this.ultLoginID.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultLoginID_EditorButtonClick);
            // 
            // ultraLabel6
            // 
            appearance22.BackColor = System.Drawing.Color.Gainsboro;
            this.ultraLabel6.Appearance = appearance22;
            this.ultraLabel6.Location = new System.Drawing.Point(630, 21);
            this.ultraLabel6.Name = "ultraLabel6";
            this.ultraLabel6.Size = new System.Drawing.Size(54, 16);
            this.ultraLabel6.TabIndex = 0;
            this.ultraLabel6.Text = "登录帐号";
            // 
            // ultraButton2
            // 
            this.ultraButton2.Location = new System.Drawing.Point(571, 17);
            this.ultraButton2.Name = "ultraButton2";
            this.ultraButton2.Size = new System.Drawing.Size(29, 19);
            this.ultraButton2.TabIndex = 5;
            this.ultraButton2.Text = ">>";
            this.toolTip1.SetToolTip(this.ultraButton2, "角色维护");
            this.ultraButton2.Click += new System.EventHandler(this.ultraButton2_Click);
            // 
            // ultraButton1
            // 
            this.ultraButton1.Location = new System.Drawing.Point(272, 17);
            this.ultraButton1.Name = "ultraButton1";
            this.ultraButton1.Size = new System.Drawing.Size(29, 19);
            this.ultraButton1.TabIndex = 2;
            this.ultraButton1.Text = ">>";
            this.toolTip1.SetToolTip(this.ultraButton1, "部门维护");
            this.ultraButton1.Visible = false;
            this.ultraButton1.Click += new System.EventHandler(this.ultraButton1_Click);
            // 
            // ultraComboEditor1
            // 
            appearance23.BackColor = System.Drawing.Color.LightCyan;
            this.ultraComboEditor1.Appearance = appearance23;
            this.ultraComboEditor1.AutoSize = true;
            this.ultraComboEditor1.Enabled = false;
            this.ultraComboEditor1.FlatMode = true;
            this.ultraComboEditor1.Location = new System.Drawing.Point(387, 17);
            this.ultraComboEditor1.Name = "ultraComboEditor1";
            this.ultraComboEditor1.Size = new System.Drawing.Size(182, 19);
            this.ultraComboEditor1.TabIndex = 4;
            // 
            // ultraCheckEditor2
            // 
            this.ultraCheckEditor2.Location = new System.Drawing.Point(331, 17);
            this.ultraCheckEditor2.Name = "ultraCheckEditor2";
            this.ultraCheckEditor2.Size = new System.Drawing.Size(48, 20);
            this.ultraCheckEditor2.TabIndex = 3;
            this.ultraCheckEditor2.Text = "角色";
            this.ultraCheckEditor2.CheckedChanged += new System.EventHandler(this.ultraCheckEditor2_CheckedChanged);
            // 
            // ultraTextEditor1
            // 
            appearance24.BackColor = System.Drawing.Color.LightCyan;
            this.ultraTextEditor1.Appearance = appearance24;
            this.ultraTextEditor1.AutoSize = true;
            this.ultraTextEditor1.BackColor = System.Drawing.Color.LightCyan;
            editorButton3.ButtonStyle = Infragistics.Win.UIElementButtonStyle.VisualStudio2005Button;
            editorButton3.Key = "part";
            editorButton3.Text = "…";
            this.ultraTextEditor1.ButtonsRight.Add(editorButton3);
            this.ultraTextEditor1.Enabled = false;
            this.ultraTextEditor1.FlatMode = true;
            this.ultraTextEditor1.Location = new System.Drawing.Point(88, 17);
            this.ultraTextEditor1.Name = "ultraTextEditor1";
            this.ultraTextEditor1.ReadOnly = true;
            this.ultraTextEditor1.Size = new System.Drawing.Size(182, 19);
            this.ultraTextEditor1.TabIndex = 1;
            this.ultraTextEditor1.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.ultraTextEditor1_EditorButtonClick_1);
            // 
            // ultraCheckEditor1
            // 
            this.ultraCheckEditor1.Location = new System.Drawing.Point(32, 17);
            this.ultraCheckEditor1.Name = "ultraCheckEditor1";
            this.ultraCheckEditor1.Size = new System.Drawing.Size(48, 20);
            this.ultraCheckEditor1.TabIndex = 0;
            this.ultraCheckEditor1.Text = "部门";
            this.ultraCheckEditor1.CheckedChanged += new System.EventHandler(this.ultraCheckEditor1_CheckedChanged);
            // 
            // FrmAuthorization
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(927, 509);
            this.Controls.Add(this.FrmAuthorization_Fill_Panel);
            this.Name = "FrmAuthorization";
            this.Text = "FrmAuthorization";
            this.Load += new System.EventHandler(this.FrmAuthorization_Load);
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor4)).EndInit();
            this.panel1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit();
            this.FrmAuthorization_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.ultraComboEditor3)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor2)).EndInit();
            this.panel2.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.ultLoginID)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraComboEditor1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.ultraTextEditor1)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

        #region "	Variable	"
        private DataSet _departmentData;
        public TreeView _departmentTree;
        private string _selectPartSQL;

        private DataSet _roleData;
        private string _selectRoleSQL;

        private DataSet _auData;
        private string _selectAuSQL;

        private DataSet _userData;
        DataSet _validUserData;
        private DataSet _fitRole;

        private string userid;
        private string roleid;
        private bool IsAdminFlag = false;

        public string StrUser = "";

        public string operDepart = "";
        public string operDepartname = "";
        public string allDept = "";
        public string selDept = "";
        public string SelComboDept = "";

        #endregion

        private void FrmAuthorization_Load(object sender, System.EventArgs e)
        {
            try
            {
                StrUser = Core.Mes.ClientFrameWork.ClientCommon._UserInfo.UserName;

                GetUserData();
                GetDepartmentData();
                GetOperDepart();
                GetChildDept();
                GetFitRole();
                GetValidUserData();

                GetRoleDataSet();
                InitCombo();
                GetAuData();
                ultraCheckEditor1.CheckedValue = true;
                ultraTextEditor1.Enabled = true;
                ultraTextEditor1.Text = operDepartname;
                ultraTextEditor1.Tag = allDept;

                InitGrid();
                //InitRoleCombo();
                //                GetCombo3Dept();
                IsAdminFlag = CheckRoleID();
                if (operDepart == "ROOT")
                {
                    ultraButton1.Visible = true;
                    ultraButton2.Visible = true;
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }

        }
        private DataSet GetUserData()
        {
            try
            {
                string str = "";

                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "SelectUAM_USER";
                par.args = new object[] { str };
                string strOut = "";

                _userData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                return _userData;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return null;
            }
        }

        private DataSet GetValidUserData()
        {
            try
            {
                string str = "";
                if (operDepart != "ROOT")
                    str = " where DEPARTMENTID in (" + allDept + ") order by 1";
                else
                    str = " order by 1";

                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "SelectUAM_USER";
                par.args = new object[] { str };
                string strOut = "";

                _validUserData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                return _validUserData;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return null;
            }
        }
        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[] { "" };

                string strOut = "";

                _departmentData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                _selectPartSQL = strOut;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void GetRoleDataSet()
        {
            try
            {
                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "SelectUAM_ROLE";
                par.args = new object[] { " order by roleid" };

                string strOut = "";

                _roleData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                _selectRoleSQL = strOut;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void GetCombo3Dept()
        {
            try
            {
                if (_userData != null && _userData.Tables.Count > 0)
                {
                    DataTable dt = this._userData.Tables[0].Copy();

                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["NAME"].ToString() == this.ultraComboEditor3.Text.ToString())
                        {
                            SelComboDept = dr["DEPARTMENTID"].ToString();
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                SelComboDept = "";
            }
        }
        private void GetFitRole()
        {
            try
            {
                string str = "";
                if (operDepart != "ROOT")
                    str = " where DEPARTMENTID in (" + allDept + ") order by roleid";
                else
                    str = " order by roleid";

                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "SelectUAM_ROLE";
                par.args = new object[] { str };

                string strOut = "";
                _fitRole = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void InitCombo()
        {
            if (_validUserData != null && _validUserData.Tables.Count > 0)
            {
                ultraComboEditor3.Items.Clear();
                foreach (DataRow arow in (_validUserData).Tables[0].Rows)
                    ultraComboEditor3.Items.Add(arow[0], arow[2].ToString());
            }
            if (_fitRole != null && _fitRole.Tables.Count > 0)
            {
                ultraComboEditor1.Items.Clear();
                ultraComboEditor2.Items.Clear();
                foreach (DataRow arow in (_fitRole).Tables[0].Rows)
                {
                    ultraComboEditor1.Items.Add(arow[0], arow[1].ToString());
                    ultraComboEditor2.Items.Add(arow[0], arow[1].ToString());
                }
            }
        }
        private void GetOperDepart()
        {
            try
            {
                if (_userData != null && _userData.Tables.Count > 0)
                {
                    DataTable dt = this._userData.Tables[0].Copy();

                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["NAME"].ToString() == StrUser)
                        {
                            operDepart = dr["DEPARTMENTID"].ToString();
                            DataTable dn = this._departmentData.Tables[0].Copy();
                            foreach (DataRow dm in dn.Rows)
                            {
                                if (dm["DEPARTMENTID"].ToString() == operDepart)
                                {
                                    operDepartname = dm["DEPARTMENTNAME"].ToString();
                                }
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }

        private void InitGrid()
        {
            //		    InitRoleCombo();
            GetPartData();
            GetUserDataInGrid();

            this.ultraCheckEditor1.CheckedValue = true;
            this.ultraTextEditor1.Enabled = true;
            this.ultraTextEditor1.Text = operDepartname;
            this.ultraTextEditor1.Tag = allDept;
            Query();
            //			this.ultraGrid1.DataSource =this.ultraDataSource1 ;
            //			ultraGrid1.DataSource = ((DataSet)_auData).Tables[0];

            this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].ValueList = ultraGrid1.DisplayLayout.ValueLists["name"];
            this.ultraGrid1.DisplayLayout.Bands[0].Columns["ROLEID"].ValueList = ultraGrid1.DisplayLayout.ValueLists["role"];
            ultraGrid1.DisplayLayout.Bands[0].Columns["DEPARTMENTID"].ValueList = ultraGrid1.DisplayLayout.ValueLists["department"];

            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["LOGINID"].Header.Caption = "登录帐号";
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["LOGINID"].Width = 80;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["LOGINID"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["LOGINID"].CellActivation = Activation.NoEdit;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["LOGINID"].CellAppearance.BackColor = Color.LightGoldenrodYellow;

            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["ROLEID"].Header.Caption = "角色";
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["ROLEID"].Width = 200;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["ROLEID"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["ROLEID"].CellActivation = Activation.NoEdit;

            //this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Default;

            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].Header.Caption = "用户姓名";
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].Width = 100;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].CellActivation = Activation.NoEdit;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["USERID"].CellAppearance.BackColor = Color.LightGoldenrodYellow;

            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["PASSWD"].Header.Caption = "登录密码";
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["PASSWD"].Width = 100;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["PASSWD"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
            //this.ultraGrid1.DisplayLayout.Bands[0].Columns["PASSWD"].CellActivation = Activation.NoEdit;

        }
        private void InitRoleCombo()
        {
            if (_userData != null && _userData.Tables.Count > 0)
            {
                DataTable dt = _userData.Tables[0].Copy();
                foreach (DataRow dr in dt.Rows)
                {
                    try
                    {
                        this.ultraComboEditor3.Items.Add(dr["USERID"], dr["NAME"].ToString());
                    }
                    catch (System.Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.ToString());
                    }
                }
            }

        }
        private void GetAuData()
        {
            try
            {
                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "SelectUAM_AUTHORIZATION";
                par.args = new object[] { " order by loginID" };

                string strOut = "";

                _auData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                _selectAuSQL = strOut;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void GetPartData()
        {
            if (ultraGrid1.DisplayLayout.ValueLists.Exists("role"))
            {
                ultraGrid1.DisplayLayout.ValueLists["role"].ValueListItems.Clear();
            }
            else
            {
                ultraGrid1.DisplayLayout.ValueLists.Add("role");
            }

            foreach (DataRow dr in this._roleData.Tables[0].Rows)
            {
                Infragistics.Win.ValueListItem vli = new Infragistics.Win.ValueListItem();
                vli.DisplayText = dr["ROLENAME"].ToString();
                vli.DataValue = dr["ROLEID"];
                ultraGrid1.DisplayLayout.ValueLists["role"].ValueListItems.Add(vli);
            }

            if (ultraGrid1.DisplayLayout.ValueLists.Exists("department"))
            {
                ultraGrid1.DisplayLayout.ValueLists["department"].ValueListItems.Clear();
            }
            else
            {
                ultraGrid1.DisplayLayout.ValueLists.Add("department");
            }

            foreach (DataRow dr in this._departmentData.Tables[0].Rows)
            {
                Infragistics.Win.ValueListItem vli = new Infragistics.Win.ValueListItem();
                vli.DisplayText = dr["DEPARTMENTNAME"].ToString();
                vli.DataValue = dr["DEPARTMENTID"];
                ultraGrid1.DisplayLayout.ValueLists["department"].ValueListItems.Add(vli);
            }
        }
        private void GetUserDataInGrid()
        {
            if (ultraGrid1.DisplayLayout.ValueLists.Exists("name"))
            {
                ultraGrid1.DisplayLayout.ValueLists["name"].ValueListItems.Clear();
            }
            else
            {
                ultraGrid1.DisplayLayout.ValueLists.Add("name");
            }

            foreach (DataRow dr in this._userData.Tables[0].Rows)
            {
                Infragistics.Win.ValueListItem vli = new Infragistics.Win.ValueListItem();
                vli.DisplayText = dr["NAME"].ToString();
                vli.DataValue = dr["USERID"];
                ultraGrid1.DisplayLayout.ValueLists["name"].ValueListItems.Add(vli);
            }
        }

        private void ultraGrid1_AfterRowActivate(object sender, System.EventArgs e)
        {
            try
            {
                if (this.ultraGrid1.ActiveRow == null) return;
                UltraGridRow ugr = this.ultraGrid1.ActiveRow;
                this.ultraTextEditor2.Text = ugr.Cells[0].Value.ToString();
                this.ultraTextEditor4.Text = ugr.Cells[3].Value.ToString();

                //Usering();
                //Roleing();
                ultraComboEditor3.Value = ugr.Cells[2].Value.ToString();
                ultraComboEditor2.Value = ugr.Cells[1].Value.ToString();

            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void Usering()
        {
            UltraGridRow ugr = this.ultraGrid1.ActiveRow;
            if (_userData != null && _userData.Tables.Count > 0)
            {
                for (int i = 0; i < _userData.Tables[0].Rows.Count; i++)
                {
                    if (_userData.Tables[0].Rows[i][0].ToString() == ugr.Cells[2].Value.ToString())
                    {
                        this.ultraComboEditor3.Value = (_userData).Tables[0].Rows[i][2];
                        return;
                    }
                }
            }
        }
        private void Userid()
        {

            if (_userData != null && _userData.Tables.Count > 0)
            {
                for (int i = 0; i < _userData.Tables[0].Rows.Count; i++)
                {
                    if (_userData.Tables[0].Rows[i]["NAME"].ToString() == this.ultraComboEditor3.Text.ToString())
                    {
                        userid = (_userData).Tables[0].Rows[i]["USERID"].ToString();
                        return;
                    }
                }
            }
        }
        private void Roleing()
        {
            UltraGridRow ugr = this.ultraGrid1.ActiveRow;
            if (_roleData != null && _roleData.Tables.Count > 0)
            {
                for (int i = 0; i < _roleData.Tables[0].Rows.Count; i++)
                {
                    if (_roleData.Tables[0].Rows[i]["ROLEID"].ToString() == ugr.Cells[1].Value.ToString())
                    {
                        this.ultraComboEditor2.Value = (_roleData).Tables[0].Rows[i]["ROLENAME"];
                        return;
                    }
                }
            }
        }

        private void Roleid()
        {

            if (_roleData != null && _roleData.Tables.Count > 0)
            {
                for (int i = 0; i < _roleData.Tables[0].Rows.Count; i++)
                {
                    if (_roleData.Tables[0].Rows[i]["ROLENAME"].ToString() == this.ultraComboEditor2.Value.ToString())
                    {
                        roleid = (_roleData).Tables[0].Rows[i]["ROLEID"].ToString();
                        return;
                    }
                }
            }
        }
        #region 工具栏操作
        private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
        {

            switch (e.Tool.Key)
            {
                case "add":
                    Add();
                    break;
                case "del":
                    Del();
                    break;
                case "edit":
                    Edit();
                    break;
                case "query":
                    Query();
                    break;
                case "close":
                    this.Close();
                    break;
                case "back":
                    this.ultraToolbarsManager1.Toolbars[0].Tools["back"].SharedProps.Visible = false;
                    //						RefreshData1("");
                    //						ultraCheckEditor1.Checked = false;
                    //						ultraTextEditor1.Text = "";
                    //						ultraCheckEditor2.Checked = false;
                    //						ultraComboEditor1.Text = "";
                    this.ultraCheckEditor1.CheckedValue = true;
                    this.ultraCheckEditor2.CheckedValue = false;
                    if (ultLoginID.Text.Trim().Length > 0)
                    {
                        ultLoginID.Tag = ultLoginID.Text.Trim();
                        ultLoginID.Text = "";
                    }
                    this.ultraTextEditor1.Enabled = true;
                    this.ultraTextEditor1.Text = operDepartname;
                    this.ultraTextEditor1.Tag = allDept;
                    Query();
                    break;
                case "leadin":
                    try
                    {
                        string StrfileName = string.Format("c:\\{0}.xls", this.Text);
                        this.ultraGridExcelExporter1.Export(this.ultraGrid1, StrfileName);

                        ProcessStartInfo p = new ProcessStartInfo(StrfileName);
                        p.WorkingDirectory = Path.GetDirectoryName(StrfileName);
                        Process.Start(p);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    break;
            }
        }
        private void Add()
        {
            //			try
            //			{
            if (this.ultraTextEditor2.Text.Trim() == "")
            {
                MessageBox.Show("请输入登录帐号！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.ultraComboEditor2.Value == null)
            {
                MessageBox.Show("请选择角色！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (this.ultraComboEditor3.Value == null)
            {
                MessageBox.Show("请选择用户！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            GetCombo3Dept();
            if (operDepart != "ROOT")
            {
                if (allDept.IndexOf("'" + SelComboDept + "'") < 0)
                {
                    MessageBox.Show("你没有配置该用户的权限，请重新选择!");
                    return;
                }
            }
            if (this.ultraTextEditor4.Text.Trim() == "")
            {
                MessageBox.Show("请输入登录密码！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            Roleid();
            Userid();
            ArrayList al = new ArrayList();

            al.Add(this.ultraTextEditor2.Text.Trim());

            al.Add(ultraComboEditor2.Value.ToString().Trim());
            al.Add(ultraComboEditor3.Value.ToString().Trim());

            //				al.Add(this.ultraComboEditor3 .Value .ToString ());
            al.Add(this.ultraTextEditor4.Text.Trim());
            try
            {
                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                //  par.AssemblyName  = "Core.Mes.PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "InsertUAM_AUTHORIZATION";
                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 (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                return;
            }
            this.GetDepartmentData();
            UltraGridRow ugr = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
            ugr.Cells["LOGINID"].Value = al[0];
            ugr.Cells["ROLEID"].Value = al[1];
            ugr.Cells["USERID"].Value = al[2];
            ugr.Cells["PASSWD"].Value = al[3];

            foreach (DataRow drow in _userData.Tables[0].Rows)
            {
                if (drow["USERID"].ToString() == al[2].ToString())
                {
                    ugr.Cells["DEPARTMENTID"].Value = drow["DEPARTMENTID"].ToString();
                    ugr.Cells["WORKPOS"].Value = drow["WORKPOS"].ToString();
                    break;
                }
            }

            foreach (DataRow drow in _roleData.Tables[0].Rows)
            {
                if (drow["ROLEID"].ToString() == al[1].ToString())
                {
                    ugr.Cells["ROLEMEMO"].Value = drow["MEMO"].ToString();
                    break;
                }
            }
            this.ultraGrid1.Update();
            //			}
            //			catch
            //			{}
        }
        private void Del()
        {
            int i = 0;
            UltraGridRow ugr = this.ultraGrid1.ActiveRow;
            if (ugr == null)
            {
                MessageBox.Show("请选择要删除的帐户!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            GetCombo3Dept();
            if (operDepart != "ROOT")
            {
                if (allDept.IndexOf("'" + SelComboDept + "'") < 0)
                {
                    MessageBox.Show("你没有删除该帐户的权限，请重新选择!");
                    return;
                }
            }
            if (MessageBox.Show("是否确认删除选中的帐户?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
            {
                return;
            }
            try
            {
                i = ugr.Index;
                string strWhere = " where LOGINID = '" + ugr.Cells[0].Value.ToString() + "'";

                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "DeleteUAM_AUTHORIZATION";
                par.args = new object[] { strWhere };

                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 (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                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()
        {
            try
            {
                UltraGridRow ugr = this.ultraGrid1.ActiveRow;
                if (ugr == null)
                {
                    MessageBox.Show("请选择要修改的用户!");
                    return;
                }
                if (this.ultraTextEditor2.Text.Trim() != ugr.Cells["LOGINID"].Text.Trim())
                {
                    MessageBox.Show("不能修改登录帐号！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (this.ultraComboEditor2.Value == null)
                {
                    MessageBox.Show("请选择角色！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (this.ultraComboEditor3.Value == null)
                {
                    MessageBox.Show("请选择用户！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (this.ultraTextEditor4.Text.Trim() == "")
                {
                    MessageBox.Show("请输入登录密码！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                GetCombo3Dept();
                if (allDept.IndexOf("'" + SelComboDept + "'") < 0 && operDepart != "ROOT")
                {
                    MessageBox.Show("你没有配置这一部门用户的权限，请重新选择!");
                    return;
                }
                Roleid();
                Userid();
                ArrayList al = new ArrayList();
                al.Add(this.ultraTextEditor2.Text.Trim());
                al.Add(ultraComboEditor2.Value.ToString());
                al.Add(userid.Trim());
                al.Add(this.ultraTextEditor4.Text.Trim());
                try
                {
                    CallingMessage par = new CallingMessage();
                    par.ServerName = "PurviewManager";
                    par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                    par.MethodName = "UpdateUAM_AUTHORIZATION";
                    par.args = new object[] { al };

                    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 (System.Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.ToString());
                    return;
                }

                ugr.Cells["LOGINID"].Value = al[0];
                ugr.Cells["ROLEID"].Value = al[1];
                ugr.Cells["USERID"].Value = al[2];
                ugr.Cells["PASSWD"].Value = al[3];

                foreach (DataRow drow in _userData.Tables[0].Rows)
                {
                    if (drow["USERID"].ToString() == al[2].ToString())
                    {
                        ugr.Cells["DEPARTMENTID"].Value = drow["DEPARTMENTID"].ToString();
                        ugr.Cells["WORKPOS"].Value = drow["WORKPOS"].ToString();
                        break;
                    }
                }

                foreach (DataRow drow in _roleData.Tables[0].Rows)
                {
                    if (drow["ROLEID"].ToString() == al[1].ToString())
                    {
                        ugr.Cells["ROLEMEMO"].Value = drow["MEMO"].ToString();
                        break;
                    }
                }

                ultraGrid1.UpdateData();
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void Query()
        {
            if ((this.ultraCheckEditor1.Checked && this.ultraTextEditor1.Text != "") ||
                (this.ultraCheckEditor2.Checked && this.ultraComboEditor1.Text != "") ||
                (this.ultLoginID.Text.Trim().Length > 0))
            {
                if (this.ultraCheckEditor1.Checked && this.ultraTextEditor1.Text != "")
                {
                    GetSelDept();
                    if (selDept == "ROOT")
                    {
                        if (operDepart != "ROOT")
                        {
                            MessageBox.Show("你没有查看整个公司的权限,请重新选择!");
                            return;
                        }
                    }
                    if (operDepart != "ROOT" && allDept.IndexOf("'" + selDept + "'") < 0)
                    {
                        MessageBox.Show("你没有查看这一部门的权限,请重新选择!");
                        return;
                    }
                }
                RefreshGrid();
                this.ultraToolbarsManager1.Toolbars[0].Tools["back"].SharedProps.Visible = true;
            }
            else
                MessageBox.Show("请选择要查询的部门、角色或帐号！", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }
        //private void RefreshData1(string str)
        //{
        //    try
        //    {
        //        CallingMessage par = new CallingMessage();
        //        par.ServerName    = "PurviewManager";
        //        par.ClassName     = "Core.Mes.PurviewManager.PurviewManager";
        //        par.MethodName    = "SelectUAM_AUTHORIZATION";
        //        par.args          = new object[]{str};

        //        string strOut = "";

        //        _auData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

        //        _selectAuSQL = strOut;
        //    }
        //    catch 
        //    {
        //    }	
        //    this.ultraGrid1.DataSource=_auData.Tables[0];
        //    ultraGrid1.UpdateData();
        //}
        private void RefreshGrid()
        {
            string str = "";
            str = GetRefreshWhere();
            //str = " where " + str + " order by loginID";
            try
            {
                CallingMessage par = new CallingMessage();
                par.ServerName = "PurviewManager";
                par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
                par.MethodName = "GetUAM_AUTHORIZATION";
                par.args = new object[] { str };

                string strOut = "";

                _auData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;

                _selectAuSQL = strOut;
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            /*			try
                        {
                            this._auData.Tables[0].DefaultView.RowFilter = GetRefreshWhere();
                        }
                        catch 
                        {
                            this._auData.Tables[0].DefaultView.RowFilter = "1=2";
                        }
            */
            this.ultraGrid1.DataSource = _auData.Tables[0];
            ultraGrid1.UpdateData();
        }
        private string GetRefreshWhere()
        {
            string sqlstr = "";
            if (this.ultraTextEditor1.Enabled && this.ultraCheckEditor1.Checked && this.ultraTextEditor1.Text != "" && ultraTextEditor1.Tag.ToString().Length > 0)
            {
                sqlstr += "AND B.DEPARTMENTID IN (" + this.ultraTextEditor1.Tag + ")";
                //ArrayList al = this.GetUserID();
                //if (al == null || al.Count == 0)
                //{
                //  sqlstr = "1=2";
                //}
                //else
                //{
                //  sqlstr += " USERID in ('" + al[0].ToString() + "'";
                //  for (int i = 1; i < al.Count; i++)
                //  {
                //    sqlstr += ", '" + al[i].ToString() + "' ";
                //  }
                //  sqlstr += ")";

                //}
            }
            if (this.ultraComboEditor1.Enabled && this.ultraCheckEditor2.Checked && this.ultraComboEditor1.Text != "")
            {
                sqlstr += " AND A.ROLEID = '" + this.ultraComboEditor1.Value.ToString() + "'";
            }
            if (this.ultLoginID.Text.Trim().Length > 0)
            {
                sqlstr += " AND A.LOGINID = '" + this.ultLoginID.Text.Trim() + "'";
            }
            return sqlstr;
        }
        private void roling_c1()
        {

            if (_roleData != null && _roleData.Tables.Count > 0)
            {
                for (int i = 0; i < _roleData.Tables[0].Rows.Count; i++)
                {
                    if (_roleData.Tables[0].Rows[i]["ROLENAME"].ToString() == this.ultraComboEditor1.Value.ToString())
                    {
                        this.ultraComboEditor1.Value = (_roleData).Tables[0].Rows[i]["ROLEID"];
                        return;
                    }
                }
            }
        }
        private ArrayList GetUserID()
        {
            ArrayList al = new ArrayList();
            DataTable dt = null;
            if (this._userData == null && this.GetUserData() == null)
                dt = null;
            else
                dt = this._userData.Tables[0];

            if (dt != null)
            {
                if (this.ultraTextEditor1.Enabled && this.ultraTextEditor1.Tag != null)
                {
                    string partid = this.ultraTextEditor1.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]["USERID"].ToString());
                }

                return al;
            }
            else
                return null;
        }
        #endregion


        private bool CheckRoleID()
        {
            try
            {
                string userid = Core.Mes.ClientFrameWork.ClientCommon._UserInfo.LoginID;
                DataRow[] drs = this._auData.Tables[0].Select("LOGINID = '" + userid + "'");
                if (drs.Length > 0)
                {
                    if (drs[0]["ROLEID"].ToString() == "001")
                    {
                        return true;
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
            return false;
        }
        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 ultraComboEditor3_EditorButtonClick_1(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
        {
            FrmSelUserID frm = new FrmSelUserID();
            frm._departmentData = this._departmentData;
            frm._userData = this._userData;
            frm.Location = this.GetChildWindowLocation(frm.Size);
            frm.ShowDialog();

            if (frm._changFlag)
            {
                this.ultraComboEditor3.Value = frm._currSelectID;
            }

            //			if (_userData != null && _userData.Tables.Count > 0)
            //			{
            //				DataTable dt = this._userData.Tables[0].Copy();
            //			
            //				foreach (DataRow dr in dt.Rows)
            //				{
            //					if(dr["NAME"].ToString ()==this.ultraComboEditor3.Text .ToString ())
            //					{
            //						SelComboDept=dr["DEPARTMENTID"];
            //					}
            //				}
            //			}

            GetCombo3Dept();
            if (operDepart != "ROOT")
            {
                if (allDept.IndexOf("'" + SelComboDept + "'") < 0)
                {
                    this.ultraComboEditor3.Text = "";
                    MessageBox.Show("你没有配置该用户的权限，请重新选择!");
                    return;
                }
            }
        }

        private void ultraTextEditor1_EditorButtonClick_1(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
        {
            FrmSetDepart frm = new FrmSetDepart();
            frm.Location = GetChildWindowLocation(frm.Size);
            frm.ShowDialog();
            if (frm.SelectedID != "" && frm.SelectedName != "")
            {
                this.ultraTextEditor1.Text = frm.SelectedName;
                this.ultraTextEditor1.Tag = frm.SelectedID;

                if (this.ultraTextEditor1.Text != "" && this.ultraCheckEditor1.Checked)
                {
                    GetSelDept();
                    if (operDepart != "ROOT" && allDept.IndexOf("'" + selDept + "'") < 0)
                    {
                        MessageBox.Show("你没有查看这一部门的权限,请重新选择!");
                    }
                }
            }
        }

        private void ultraButton1_Click(object sender, System.EventArgs e)
        {
            foreach (Form mdiChild in this.MdiParent.MdiChildren)
            {
                if (mdiChild.Text == "部门维护")
                {
                    mdiChild.Activate();
                    return;
                }
            }

            FrmDepartment frmpart = new FrmDepartment();

            //frmpart.Location = GetChildWindowLocation(frmpart.Size);
            frmpart.MdiParent = this.ParentForm;
            frmpart.Show();
        }

        private void ultraButton2_Click(object sender, System.EventArgs e)
        {
            FrmRole frmRole = new FrmRole();
            frmRole._roleData = this._roleData;
            frmRole._selectSQL = this._selectRoleSQL;
            frmRole.IsAdminFlag = IsAdminFlag;
            //frmRole.ShowDialog(this);

            frmRole.Location = GetChildWindowLocation(frmRole.Size);
            frmRole.ShowDialog(this);
            GetFitRole();
            InitCombo();
            //this._roleData = frmRole._roleData ;
            //this.InitRoleCombo();	
        }

        private void ultraCheckEditor1_CheckedChanged(object sender, System.EventArgs e)
        {
            ultraTextEditor1.Enabled = ultraCheckEditor1.Checked;
        }

        private void ultraCheckEditor2_CheckedChanged(object sender, System.EventArgs e)
        {
            ultraComboEditor1.Enabled = ultraCheckEditor2.Checked;
        }

        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 GetSelDept()
        {
            try
            {
                if (this.ultraTextEditor1.Text != "" && ultraCheckEditor1.Checked)
                {
                    DataTable dt = this._departmentData.Tables[0].Copy();
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["DEPARTMENTNAME"].ToString() == this.ultraTextEditor1.Text)
                        {
                            selDept = dr["DEPARTMENTID"].ToString();
                            return;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
        private void ultraComboEditor3_SelectionChanged(object sender, System.EventArgs e)
        {
            GetCombo3Dept();
            if (operDepart != "ROOT")
            {
                if (allDept.IndexOf("'" + SelComboDept + "'") < 0)
                {
                    this.ultraComboEditor3.Text = "";
                    MessageBox.Show("你没有配置该用户的权限，请重新选择!");
                    return;
                }
            }
        }

        private void ultLoginID_EditorButtonClick(object sender, EditorButtonEventArgs e)
        {
            try
            {
                if (e.Button.Key == "SET")
                {
                    if (ultLoginID.Text.Trim().Length > 0)
                    {
                        ultLoginID.Tag = ultLoginID.Text.Trim();
                        ultLoginID.Text = "";
                    }
                    else
                    {
                        if (ultLoginID.Tag != null)
                            ultLoginID.Text = ultLoginID.Tag.ToString();
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }

    }
}
