using System;
using System.Data;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Infragistics.Win.UltraWinTree;
using Infragistics.Win.UltraWinGrid;
using Core.Mes.ClientFrameWork;
using Core.Mes.IBaseInterface ;
namespace Core.Mes.ClientPurviewManager
{
///
/// FrmDepartment 的摘要说明。
///
public class FrmDepartment : Core.Mes.ClientFrameWork.FrmBase
{
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1;
private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
private Core.Mes.ClientPurviewManager.UcDepartment ucDepartment1;
private Infragistics.Win.Misc.UltraExpandableGroupBox ultraExpandableGroupBox1;
private Infragistics.Win.Misc.UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel1;
private Infragistics.Win.UltraWinEditors.UltraComboEditor edit1;
private Infragistics.Win.UltraWinEditors.UltraTextEditor text3;
private Infragistics.Win.UltraWinEditors.UltraTextEditor text2;
private Infragistics.Win.UltraWinEditors.UltraTextEditor text1;
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.Panel panel2;
private System.Windows.Forms.Panel panel1;
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.ComponentModel.IContainer components;
public FrmDepartment()
{
//
// 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("UltraToolbar1");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("al");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("all");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("al");
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("departcode");
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("departname");
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("rome");
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("departid");
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.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton("part");
Infragistics.Win.Appearance appearance17 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance18 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance19 = new Infragistics.Win.Appearance();
this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
this.panel1 = 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.edit1 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.text3 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
this.text2 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
this.text1 = 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._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.ucDepartment1 = new Core.Mes.ClientPurviewManager.UcDepartment();
((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).BeginInit();
this.ultraExpandableGroupBox1.SuspendLayout();
this.ultraExpandableGroupBoxPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.edit1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.text3)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.text2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.text1)).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 = "UltraToolbar1";
buttonTool2.InstanceProps.IsFirstInGroup = true;
buttonTool3.InstanceProps.IsFirstInGroup = true;
buttonTool4.InstanceProps.IsFirstInGroup = true;
buttonTool5.InstanceProps.IsFirstInGroup = true;
ultraToolbar1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool1,
buttonTool2,
buttonTool3,
buttonTool4,
buttonTool5});
this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
ultraToolbar1});
buttonTool6.SharedProps.Caption = "新增(&A)";
buttonTool6.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool6.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
buttonTool7.SharedProps.Caption = "修改(&U)";
buttonTool7.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool7.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlU;
buttonTool8.SharedProps.Caption = "查询(&Q)";
buttonTool9.SharedProps.Caption = "删除(&D)";
buttonTool9.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool9.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlD;
buttonTool10.SharedProps.Caption = "关闭(&E)";
buttonTool10.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool10.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlE;
buttonTool11.SharedProps.Caption = "全部(&L)";
buttonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool12.SharedProps.Caption = "全部(&L)";
buttonTool12.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
buttonTool12.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlL;
this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool6,
buttonTool7,
buttonTool8,
buttonTool9,
buttonTool10,
buttonTool11,
buttonTool12});
this.ultraToolbarsManager1.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.ultraToolbarsManager1_ToolClick);
//
// panel1
//
this.panel1.Controls.Add(this.ultraGrid1);
this.panel1.Controls.Add(this.ultraExpandableGroupBox1);
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.Fill;
this.panel1.Location = new System.Drawing.Point(216, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(812, 493);
this.panel1.TabIndex = 5;
//
// 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;
ultraGridColumn1.Header.Caption = "部门编码";
ultraGridColumn1.Header.VisiblePosition = 0;
ultraGridColumn1.Width = 101;
ultraGridColumn2.Header.Caption = "部门名称";
ultraGridColumn2.Header.VisiblePosition = 1;
ultraGridColumn2.Width = 225;
appearance3.BackColor = System.Drawing.Color.LightGoldenrodYellow;
ultraGridColumn3.CellAppearance = appearance3;
ultraGridColumn3.Header.Caption = "备注";
ultraGridColumn3.Header.VisiblePosition = 2;
ultraGridColumn4.Header.VisiblePosition = 3;
ultraGridColumn4.Hidden = true;
ultraGridBand1.Columns.AddRange(new object[] {
ultraGridColumn1,
ultraGridColumn2,
ultraGridColumn3,
ultraGridColumn4});
appearance4.BackColor = System.Drawing.Color.LightSteelBlue;
ultraGridBand1.Override.RowSelectorAppearance = appearance4;
ultraGridBand1.Override.RowSelectorHeaderStyle = Infragistics.Win.UltraWinGrid.RowSelectorHeaderStyle.SeparateElement;
ultraGridBand1.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
ultraGridBand1.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
this.ultraGrid1.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
appearance5.BackColor = System.Drawing.SystemColors.ActiveBorder;
appearance5.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance5.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
appearance5.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance5;
appearance6.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance6;
this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
appearance7.BackColor = System.Drawing.SystemColors.ControlLightLight;
appearance7.BackColor2 = System.Drawing.SystemColors.Control;
appearance7.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance7.ForeColor = System.Drawing.SystemColors.GrayText;
this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance7;
this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
appearance8.BackColor = System.Drawing.SystemColors.Window;
appearance8.ForeColor = System.Drawing.SystemColors.ControlText;
this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance8;
appearance9.BackColor = System.Drawing.SystemColors.Highlight;
appearance9.ForeColor = System.Drawing.SystemColors.HighlightText;
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance9;
this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
appearance10.BackColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance10;
appearance11.BorderColor = System.Drawing.Color.Silver;
appearance11.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance11;
this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
appearance12.BackColor = System.Drawing.SystemColors.Control;
appearance12.BackColor2 = System.Drawing.SystemColors.ControlDark;
appearance12.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
appearance12.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
appearance12.BorderColor = System.Drawing.SystemColors.Window;
this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance12;
appearance13.BackColor = System.Drawing.Color.LightSteelBlue;
appearance13.TextHAlign = Infragistics.Win.HAlign.Center;
this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance13;
this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
this.ultraGrid1.DisplayLayout.Override.MinRowHeight = 21;
appearance14.BackColor = System.Drawing.SystemColors.Window;
appearance14.BorderColor = System.Drawing.Color.Silver;
this.ultraGrid1.DisplayLayout.Override.RowAppearance = appearance14;
this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
appearance15.BackColor = System.Drawing.SystemColors.ControlLight;
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance15;
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, 26);
this.ultraGrid1.Name = "ultraGrid1";
this.ultraGrid1.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.ultraGrid1.Size = new System.Drawing.Size(812, 331);
this.ultraGrid1.TabIndex = 2;
this.ultraGrid1.Text = "ultraGrid1";
this.ultraGrid1.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ultraGrid1_InitializeLayout);
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(812, 136);
this.ultraExpandableGroupBox1.Location = new System.Drawing.Point(0, 357);
this.ultraExpandableGroupBox1.Name = "ultraExpandableGroupBox1";
this.ultraExpandableGroupBox1.Size = new System.Drawing.Size(812, 136);
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.edit1);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text3);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text2);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text1);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel4);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel3);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel2);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel1);
this.ultraExpandableGroupBoxPanel1.Controls.Add(this.panel2);
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(808, 112);
this.ultraExpandableGroupBoxPanel1.TabIndex = 0;
//
// edit1
//
appearance16.BackColor = System.Drawing.Color.LightCyan;
this.edit1.Appearance = appearance16;
this.edit1.AutoSize = true;
editorButton1.Key = "part";
this.edit1.ButtonsRight.Add(editorButton1);
this.edit1.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never;
this.edit1.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
this.edit1.FlatMode = true;
this.edit1.Location = new System.Drawing.Point(496, 40);
this.edit1.Name = "edit1";
this.edit1.Size = new System.Drawing.Size(184, 21);
this.edit1.TabIndex = 7;
this.edit1.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.edit1_EditorButtonClick);
//
// text3
//
appearance17.BackColor = System.Drawing.Color.LightCyan;
this.text3.Appearance = appearance17;
this.text3.AutoSize = true;
this.text3.BackColor = System.Drawing.Color.LightCyan;
this.text3.FlatMode = true;
this.text3.Location = new System.Drawing.Point(80, 80);
this.text3.Name = "text3";
this.text3.Size = new System.Drawing.Size(600, 21);
this.text3.TabIndex = 6;
//
// text2
//
appearance18.BackColor = System.Drawing.Color.LightCyan;
this.text2.Appearance = appearance18;
this.text2.AutoSize = true;
this.text2.BackColor = System.Drawing.Color.LightCyan;
this.text2.FlatMode = true;
this.text2.Location = new System.Drawing.Point(288, 40);
this.text2.Name = "text2";
this.text2.Size = new System.Drawing.Size(100, 21);
this.text2.TabIndex = 5;
//
// text1
//
appearance19.BackColor = System.Drawing.Color.LightCyan;
this.text1.Appearance = appearance19;
this.text1.AutoSize = true;
this.text1.BackColor = System.Drawing.Color.LightCyan;
this.text1.FlatMode = true;
this.text1.Location = new System.Drawing.Point(80, 40);
this.text1.Name = "text1";
this.text1.Size = new System.Drawing.Size(100, 21);
this.text1.TabIndex = 4;
//
// ultraLabel4
//
this.ultraLabel4.BackColor = System.Drawing.Color.Gainsboro;
this.ultraLabel4.Location = new System.Drawing.Point(32, 82);
this.ultraLabel4.Name = "ultraLabel4";
this.ultraLabel4.Size = new System.Drawing.Size(32, 16);
this.ultraLabel4.TabIndex = 3;
this.ultraLabel4.Text = "备注";
//
// ultraLabel3
//
this.ultraLabel3.BackColor = System.Drawing.Color.Gainsboro;
this.ultraLabel3.Location = new System.Drawing.Point(432, 42);
this.ultraLabel3.Name = "ultraLabel3";
this.ultraLabel3.Size = new System.Drawing.Size(56, 16);
this.ultraLabel3.TabIndex = 2;
this.ultraLabel3.Text = "所属部门";
//
// ultraLabel2
//
this.ultraLabel2.BackColor = System.Drawing.Color.Gainsboro;
this.ultraLabel2.Location = new System.Drawing.Point(224, 42);
this.ultraLabel2.Name = "ultraLabel2";
this.ultraLabel2.Size = new System.Drawing.Size(56, 16);
this.ultraLabel2.TabIndex = 1;
this.ultraLabel2.Text = "部门名称";
//
// ultraLabel1
//
this.ultraLabel1.BackColor = System.Drawing.Color.Gainsboro;
this.ultraLabel1.Location = new System.Drawing.Point(16, 42);
this.ultraLabel1.Name = "ultraLabel1";
this.ultraLabel1.Size = new System.Drawing.Size(56, 16);
this.ultraLabel1.TabIndex = 0;
this.ultraLabel1.Text = "部门编码";
//
// panel2
//
this.panel2.BackColor = System.Drawing.Color.Gainsboro;
this.panel2.Location = new System.Drawing.Point(0, 0);
this.panel2.Name = "panel2";
this.panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.panel2.Size = new System.Drawing.Size(944, 112);
this.panel2.TabIndex = 8;
//
// _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.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
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, 26);
this._panel1_Toolbars_Dock_Area_Left.Name = "_panel1_Toolbars_Dock_Area_Left";
this._panel1_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 467);
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.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
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(812, 26);
this._panel1_Toolbars_Dock_Area_Right.Name = "_panel1_Toolbars_Dock_Area_Right";
this._panel1_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 467);
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.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
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(812, 26);
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.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
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, 493);
this._panel1_Toolbars_Dock_Area_Bottom.Name = "_panel1_Toolbars_Dock_Area_Bottom";
this._panel1_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(812, 0);
this._panel1_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1;
//
// ucDepartment1
//
this.ucDepartment1.Dock = System.Windows.Forms.DockStyle.Left;
this.ucDepartment1.Location = new System.Drawing.Point(0, 0);
this.ucDepartment1.Name = "ucDepartment1";
this.ucDepartment1.Size = new System.Drawing.Size(216, 493);
this.ucDepartment1.TabIndex = 4;
//
// FrmDepartment
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(1028, 493);
this.Controls.Add(this.panel1);
this.Controls.Add(this.ucDepartment1);
this.Name = "FrmDepartment";
this.ShowInTaskbar = false;
this.Text = "部门维护";
this.Load += new System.EventHandler(this.FrmDepartment_Load);
((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).EndInit();
this.ultraExpandableGroupBox1.ResumeLayout(false);
this.ultraExpandableGroupBoxPanel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.edit1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.text3)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.text2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.text1)).EndInit();
this.ResumeLayout(false);
}
#endregion
#region " Variable "
public DataSet _departmentData;
public string _selectSQL;
public bool saveFlag = false;
private const string DEPARTMENT_BASE = "ROOT";
private UltraTree ultraTree1;
#endregion
private void FrmDepartment_Load(object sender, System.EventArgs e)
{
ultraTree1 = this.ucDepartment1.ultraTree1;
GetDepartmentData();
InitComboBox();
this.ucDepartment1._departmentData = this._departmentData;
this.ucDepartment1.RefreshTree();
this.ucDepartment1.ultraTree1.ExpandAll();
InitGrid();
this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
if (this.ultraTree1.Nodes.Count > 0)
this.ultraTree1.Nodes[0].Selected = true;
string err = "";
//object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("oysrv","ClassLibrary1","ClassLibrary1.Class1","myfun",
// new object[]{}, out err);
if (err == "")
{
//MessageBox.Show((string)obj);
}
}
private void InitComboBox()
{
if (this._departmentData != null && this._departmentData.Tables.Count > 0)
{
DataTable dt = this._departmentData.Tables[0].Copy();
this.edit1.Items.Clear();
foreach (DataRow dr in dt.Rows)
{
try
{
this.edit1.Items.Add(dr["DEPARTMENTID"], dr["DEPARTMENTNAME"].ToString());
}
catch
{ }
}
}
}
private void InitGrid()
{
this.ultraGrid1.DataSource = _departmentData.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].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
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].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
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 = 100;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellActivation = Activation.NoEdit;
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 = 100;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellActivation = Activation.NoEdit;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellAppearance.BackColor = Color.LightGoldenrodYellow;
this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Hidden = true;
this.ultraGrid1.AfterRowActivate += new EventHandler(ultraGrid1_AfterRowActivate);
}
#region "InitTree "
private void ultraTree1_AfterSelect(object sender, Infragistics.Win.UltraWinTree.SelectEventArgs e)
{
try
{
string rowFilter;
if (e.NewSelections == null || e.NewSelections.Count == 0)
rowFilter = "departmentid <> 'ROOT'";
else
{
string str = "'" + e.NewSelections[0].Key + "'";
str = GetSelectedID(ref str, e.NewSelections[0]);
rowFilter = "departmentid in (" + str + ")";
}
DataTable dt = this.ultraGrid1.DataSource as DataTable;
dt.DefaultView.RowFilter = rowFilter;
ultraGrid1_AfterRowActivate(null, null);
}
catch
{
DataTable dt = this.ultraGrid1.DataSource as DataTable;
dt.DefaultView.RowFilter = "1=2";
}
}
private string GetSelectedID(ref string str, UltraTreeNode utn)
{
try
{
foreach (UltraTreeNode ut in utn.Nodes)
{
str += ",'" + ut.Key + "'";
if (ut.Nodes.Count > 0)
GetSelectedID(ref str, ut);
}
return str;
}
catch
{
return "";
}
}
//==========================================================
// 获得部门数据
//==========================================================
private void GetDepartmentData()
{
try
{
CallingMessage par = new CallingMessage();
par.ServerName = "PurviewManager";
//par.AssemblyName = "Core.Mes.PurviewManager";
par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
par.MethodName = "SelectUAM_DEPARTMENT";
par.args = new object[] { " order by DEPARTMENTID " };
par.ServerType = MesServerType.MesSystemBaseServer;
string strOut = "";
_departmentData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
}
catch //(Exception ex)
{
// CoreMesLogger.log(this.GetType()).Error(ex.Message);
}
}
#endregion
#region "button"
private void edit1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
FrmSetDepart frm = new FrmSetDepart();
// frm.RemotingHelp = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp;
frm.GetChildIDFlag = false;
frm.Location = GetChildWindowLocation(frm.Size);
frm.ShowDialog();
InitComboBox();
// GetDepartmentData();
if (frm.SelectedID != "" && frm.SelectedName != "")
{
this.edit1.Value = frm.SelectedID;
this.edit1.Tag = frm.ParentID;
}
}
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);
}
#endregion
#region "toolbars"
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 "close":
{
this.Close();
break;
}
case "al":
{
this.ultraTree1.SelectedNodes.Clear();
break;
}
}
}
private void Add()
{
string OpDpt = RightsComm.CheckNullStr(this.edit1.SelectedItem.DataValue);
if (!RightsComm.CheckRole(OpDpt))
return;
if (this.text1.Text.Trim() == "")
{
MessageBox.Show("请录入部门编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
if (this.text2.Text.Trim() == "")
{
MessageBox.Show("请录入部门名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ArrayList al = new ArrayList();
al.Add(this.text1.Text.Trim());
al.Add(this.text2.Text.Trim());
al.Add(this.text3.Text.Trim());
if (this.edit1.SelectedIndex != -1)
{
al.Add(this.edit1.SelectedItem.DataValue);
}
else
{
al.Add("");
}
try
{
CallingMessage par = new CallingMessage();
par.ServerName = "PurviewManager";
//par.AssemblyName = "Core.Mes.PurviewManager";
par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
par.MethodName = "InsertUAM_DEPARTMENT";
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;
}
this.GetDepartmentData();
string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
this.ucDepartment1._departmentData = this._departmentData;
this.ucDepartment1.RefreshTree();
this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
{
UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
if (fNd != null)
{
if (fNd.Parent != null)
fNd.Parent.Expanded = true;
fNd.Expanded = true;
ultraTree1.ActiveNode = fNd;
}
}
this.ultraGrid1.AfterRowActivate -= new EventHandler(ultraGrid1_AfterRowActivate);
UltraGridRow ugr = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
this.ultraGrid1.AfterRowActivate += new EventHandler(ultraGrid1_AfterRowActivate);
ugr.Cells[0].Value = al[0];
ugr.Cells[1].Value = al[1];
ugr.Cells[2].Value = al[2];
ugr.Cells[3].Value = al[3];
this.ultraGrid1.UpdateData();
}
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;
string strWhere = ugr.Cells[0].Value.ToString();
if (!RightsComm.CheckRole(strWhere))
return;
CallingMessage par = new CallingMessage();
par.ServerName = "PurviewManager";
//par.AssemblyName = "Core.Mes.PurviewManager";
par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
par.MethodName = "DeleteUAM_DEPARTMENT";
par.args = new object[] { strWhere };
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;
}
this.ultraGrid1.ActiveRow.Delete(false);
this.ultraGrid1.UpdateData();
this.GetDepartmentData();
InitComboBox();
string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
this.ucDepartment1._departmentData = this._departmentData;
this.ucDepartment1.RefreshTree();
this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
{
UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
if (fNd != null)
{
if (fNd.Parent != null)
fNd.Parent.Expanded = true;
fNd.Expanded = true;
ultraTree1.ActiveNode = fNd;
}
}
try
{
this.ultraGrid1.Rows[i].Activate();
}
catch
{
int count = this.ultraGrid1.Rows.Count;
if (count > 0)
this.ultraGrid1.Rows[count - 1].Activate();
}
}
private void Edit()
{
UltraGridRow ugr = this.ultraGrid1.ActiveRow;
if (ugr == null)
{
MessageBox.Show("请选择要修改的部门!");
return;
}
if (ugr.Cells["DEPARTMENTID"].Value.ToString() == edit1.SelectedItem.DataValue.ToString())
{
MessageBox.Show("所属部门不可选自己!");
edit1.Focus();
return;
}
if (!RightsComm.CheckRole(RightsComm.CheckNullStr(edit1.SelectedItem.DataValue)))
return;
ArrayList al = new ArrayList();
al.Add(ugr.Cells["DEPARTMENTID"].Value.ToString());
al.Add(this.text2.Text.Trim());
al.Add(this.text3.Text.Trim());
al.Add(this.edit1.SelectedItem.DataValue);
try
{
CallingMessage par = new CallingMessage();
par.ServerName = "PurviewManager";
//par.AssemblyName = "Core.Mes.PurviewManager";
par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
par.MethodName = "UpdateUAM_DEPARTMENT";
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];
ugr.Cells[3].Value = al[3];
this.ultraGrid1.UpdateData();
this.GetDepartmentData();
string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
this.ucDepartment1._departmentData = this._departmentData;
this.ucDepartment1.RefreshTree();
this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
{
UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
if (fNd != null)
{
if (fNd.Parent != null)
fNd.Parent.Expanded = true;
fNd.Expanded = true;
ultraTree1.ActiveNode = fNd;
}
}
}
UltraTreeNode activeNode(string sKey, TreeNodesCollection nodes)
{
foreach (UltraTreeNode nd in nodes)
{
if (nd.Key == sKey)
{
nd.Selected = true;
return nd;
}
else
{
UltraTreeNode nNd = activeNode(sKey, nd.Nodes);
if (nNd != null)
return nNd;
}
}
return null;
}
#endregion
#region "Grid Event"
private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
}
private void ultraGrid1_AfterRowActivate(object sender, System.EventArgs e)
{
try
{
if (this.ultraGrid1.ActiveRow == null) return;
UltraGridRow ugr = this.ultraGrid1.ActiveRow;
this.text1.Text = ugr.Cells[0].Value.ToString();
this.text2.Text = ugr.Cells[1].Value.ToString();
this.text3.Text = ugr.Cells[2].Value.ToString();
this.edit1.Value = ugr.Cells[3].Value;
this.edit1.Tag = ucDepartment1.ParentID;
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
#endregion
}
}