FrmDepartment.cs 47 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using Infragistics.Win.UltraWinTree;
  8. using Infragistics.Win.UltraWinGrid;
  9. using Core.Mes.ClientFrameWork;
  10. using Core.Mes.IBaseInterface ;
  11. namespace Core.Mes.ClientPurviewManager
  12. {
  13. /// <summary>
  14. /// FrmDepartment 的摘要说明。
  15. /// </summary>
  16. public class FrmDepartment : Core.Mes.ClientFrameWork.FrmBase
  17. {
  18. private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager ultraToolbarsManager1;
  19. private Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid1;
  20. private Core.Mes.ClientPurviewManager.UcDepartment ucDepartment1;
  21. private Infragistics.Win.Misc.UltraExpandableGroupBox ultraExpandableGroupBox1;
  22. private Infragistics.Win.Misc.UltraExpandableGroupBoxPanel ultraExpandableGroupBoxPanel1;
  23. private Infragistics.Win.UltraWinEditors.UltraComboEditor edit1;
  24. private Infragistics.Win.UltraWinEditors.UltraTextEditor text3;
  25. private Infragistics.Win.UltraWinEditors.UltraTextEditor text2;
  26. private Infragistics.Win.UltraWinEditors.UltraTextEditor text1;
  27. private Infragistics.Win.Misc.UltraLabel ultraLabel4;
  28. private Infragistics.Win.Misc.UltraLabel ultraLabel3;
  29. private Infragistics.Win.Misc.UltraLabel ultraLabel2;
  30. private Infragistics.Win.Misc.UltraLabel ultraLabel1;
  31. private System.Windows.Forms.Panel panel2;
  32. private System.Windows.Forms.Panel panel1;
  33. private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Left;
  34. private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Right;
  35. private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Top;
  36. private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _panel1_Toolbars_Dock_Area_Bottom;
  37. private System.ComponentModel.IContainer components;
  38. public FrmDepartment()
  39. {
  40. //
  41. // Windows 窗体设计器支持所必需的
  42. //
  43. InitializeComponent();
  44. //
  45. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  46. //
  47. }
  48. /// <summary>
  49. /// 清理所有正在使用的资源。
  50. /// </summary>
  51. protected override void Dispose(bool disposing)
  52. {
  53. if (disposing)
  54. {
  55. if (components != null)
  56. {
  57. components.Dispose();
  58. }
  59. }
  60. base.Dispose(disposing);
  61. }
  62. #region Windows 窗体设计器生成的代码
  63. /// <summary>
  64. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  65. /// 此方法的内容。
  66. /// </summary>
  67. private void InitializeComponent()
  68. {
  69. this.components = new System.ComponentModel.Container();
  70. Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar1");
  71. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add");
  72. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit");
  73. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del");
  74. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close");
  75. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("al");
  76. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("add");
  77. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("edit");
  78. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("query");
  79. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("del");
  80. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("close");
  81. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("all");
  82. Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("al");
  83. Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
  84. Infragistics.Win.UltraWinGrid.UltraGridBand ultraGridBand1 = new Infragistics.Win.UltraWinGrid.UltraGridBand("Band 0", -1);
  85. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn1 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("departcode");
  86. Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
  87. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn2 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("departname");
  88. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn3 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("rome");
  89. Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
  90. Infragistics.Win.UltraWinGrid.UltraGridColumn ultraGridColumn4 = new Infragistics.Win.UltraWinGrid.UltraGridColumn("departid");
  91. Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
  92. Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
  93. Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
  94. Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
  95. Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
  96. Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
  97. Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
  98. Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
  99. Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance();
  100. Infragistics.Win.Appearance appearance13 = new Infragistics.Win.Appearance();
  101. Infragistics.Win.Appearance appearance14 = new Infragistics.Win.Appearance();
  102. Infragistics.Win.Appearance appearance15 = new Infragistics.Win.Appearance();
  103. Infragistics.Win.Appearance appearance16 = new Infragistics.Win.Appearance();
  104. Infragistics.Win.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton("part");
  105. Infragistics.Win.Appearance appearance17 = new Infragistics.Win.Appearance();
  106. Infragistics.Win.Appearance appearance18 = new Infragistics.Win.Appearance();
  107. Infragistics.Win.Appearance appearance19 = new Infragistics.Win.Appearance();
  108. this.ultraToolbarsManager1 = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
  109. this.panel1 = new System.Windows.Forms.Panel();
  110. this.ultraGrid1 = new Infragistics.Win.UltraWinGrid.UltraGrid();
  111. this.ultraExpandableGroupBox1 = new Infragistics.Win.Misc.UltraExpandableGroupBox();
  112. this.ultraExpandableGroupBoxPanel1 = new Infragistics.Win.Misc.UltraExpandableGroupBoxPanel();
  113. this.edit1 = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
  114. this.text3 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
  115. this.text2 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
  116. this.text1 = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
  117. this.ultraLabel4 = new Infragistics.Win.Misc.UltraLabel();
  118. this.ultraLabel3 = new Infragistics.Win.Misc.UltraLabel();
  119. this.ultraLabel2 = new Infragistics.Win.Misc.UltraLabel();
  120. this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel();
  121. this.panel2 = new System.Windows.Forms.Panel();
  122. this._panel1_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
  123. this._panel1_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
  124. this._panel1_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
  125. this._panel1_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
  126. this.ucDepartment1 = new Core.Mes.ClientPurviewManager.UcDepartment();
  127. ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).BeginInit();
  128. this.panel1.SuspendLayout();
  129. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).BeginInit();
  130. ((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).BeginInit();
  131. this.ultraExpandableGroupBox1.SuspendLayout();
  132. this.ultraExpandableGroupBoxPanel1.SuspendLayout();
  133. ((System.ComponentModel.ISupportInitialize)(this.edit1)).BeginInit();
  134. ((System.ComponentModel.ISupportInitialize)(this.text3)).BeginInit();
  135. ((System.ComponentModel.ISupportInitialize)(this.text2)).BeginInit();
  136. ((System.ComponentModel.ISupportInitialize)(this.text1)).BeginInit();
  137. this.SuspendLayout();
  138. //
  139. // ultraToolbarsManager1
  140. //
  141. this.ultraToolbarsManager1.DesignerFlags = 1;
  142. this.ultraToolbarsManager1.DockWithinContainer = this.panel1;
  143. this.ultraToolbarsManager1.ShowFullMenusDelay = 500;
  144. this.ultraToolbarsManager1.ShowQuickCustomizeButton = false;
  145. this.ultraToolbarsManager1.Style = Infragistics.Win.UltraWinToolbars.ToolbarStyle.VisualStudio2005;
  146. ultraToolbar1.DockedColumn = 0;
  147. ultraToolbar1.DockedRow = 0;
  148. ultraToolbar1.Text = "UltraToolbar1";
  149. buttonTool2.InstanceProps.IsFirstInGroup = true;
  150. buttonTool3.InstanceProps.IsFirstInGroup = true;
  151. buttonTool4.InstanceProps.IsFirstInGroup = true;
  152. buttonTool5.InstanceProps.IsFirstInGroup = true;
  153. ultraToolbar1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
  154. buttonTool1,
  155. buttonTool2,
  156. buttonTool3,
  157. buttonTool4,
  158. buttonTool5});
  159. this.ultraToolbarsManager1.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
  160. ultraToolbar1});
  161. buttonTool6.SharedProps.Caption = "新增(&A)";
  162. buttonTool6.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  163. buttonTool6.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
  164. buttonTool7.SharedProps.Caption = "修改(&U)";
  165. buttonTool7.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  166. buttonTool7.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlU;
  167. buttonTool8.SharedProps.Caption = "查询(&Q)";
  168. buttonTool9.SharedProps.Caption = "删除(&D)";
  169. buttonTool9.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  170. buttonTool9.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlD;
  171. buttonTool10.SharedProps.Caption = "关闭(&E)";
  172. buttonTool10.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  173. buttonTool10.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlE;
  174. buttonTool11.SharedProps.Caption = "全部(&L)";
  175. buttonTool11.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  176. buttonTool12.SharedProps.Caption = "全部(&L)";
  177. buttonTool12.SharedProps.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
  178. buttonTool12.SharedProps.Shortcut = System.Windows.Forms.Shortcut.CtrlL;
  179. this.ultraToolbarsManager1.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
  180. buttonTool6,
  181. buttonTool7,
  182. buttonTool8,
  183. buttonTool9,
  184. buttonTool10,
  185. buttonTool11,
  186. buttonTool12});
  187. this.ultraToolbarsManager1.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.ultraToolbarsManager1_ToolClick);
  188. //
  189. // panel1
  190. //
  191. this.panel1.Controls.Add(this.ultraGrid1);
  192. this.panel1.Controls.Add(this.ultraExpandableGroupBox1);
  193. this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Left);
  194. this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Right);
  195. this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Top);
  196. this.panel1.Controls.Add(this._panel1_Toolbars_Dock_Area_Bottom);
  197. this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
  198. this.panel1.Location = new System.Drawing.Point(216, 0);
  199. this.panel1.Name = "panel1";
  200. this.panel1.Size = new System.Drawing.Size(812, 493);
  201. this.panel1.TabIndex = 5;
  202. //
  203. // ultraGrid1
  204. //
  205. appearance1.BackColor = System.Drawing.SystemColors.Window;
  206. appearance1.BorderColor = System.Drawing.SystemColors.InactiveCaption;
  207. this.ultraGrid1.DisplayLayout.Appearance = appearance1;
  208. appearance2.BackColor = System.Drawing.Color.LightGoldenrodYellow;
  209. ultraGridColumn1.CellAppearance = appearance2;
  210. ultraGridColumn1.Header.Caption = "部门编码";
  211. ultraGridColumn1.Header.VisiblePosition = 0;
  212. ultraGridColumn1.Width = 101;
  213. ultraGridColumn2.Header.Caption = "部门名称";
  214. ultraGridColumn2.Header.VisiblePosition = 1;
  215. ultraGridColumn2.Width = 225;
  216. appearance3.BackColor = System.Drawing.Color.LightGoldenrodYellow;
  217. ultraGridColumn3.CellAppearance = appearance3;
  218. ultraGridColumn3.Header.Caption = "备注";
  219. ultraGridColumn3.Header.VisiblePosition = 2;
  220. ultraGridColumn4.Header.VisiblePosition = 3;
  221. ultraGridColumn4.Hidden = true;
  222. ultraGridBand1.Columns.AddRange(new object[] {
  223. ultraGridColumn1,
  224. ultraGridColumn2,
  225. ultraGridColumn3,
  226. ultraGridColumn4});
  227. appearance4.BackColor = System.Drawing.Color.LightSteelBlue;
  228. ultraGridBand1.Override.RowSelectorAppearance = appearance4;
  229. ultraGridBand1.Override.RowSelectorHeaderStyle = Infragistics.Win.UltraWinGrid.RowSelectorHeaderStyle.SeparateElement;
  230. ultraGridBand1.Override.RowSelectorNumberStyle = Infragistics.Win.UltraWinGrid.RowSelectorNumberStyle.RowIndex;
  231. ultraGridBand1.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
  232. this.ultraGrid1.DisplayLayout.BandsSerializer.Add(ultraGridBand1);
  233. this.ultraGrid1.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
  234. this.ultraGrid1.DisplayLayout.CaptionVisible = Infragistics.Win.DefaultableBoolean.False;
  235. appearance5.BackColor = System.Drawing.SystemColors.ActiveBorder;
  236. appearance5.BackColor2 = System.Drawing.SystemColors.ControlDark;
  237. appearance5.BackGradientStyle = Infragistics.Win.GradientStyle.Vertical;
  238. appearance5.BorderColor = System.Drawing.SystemColors.Window;
  239. this.ultraGrid1.DisplayLayout.GroupByBox.Appearance = appearance5;
  240. appearance6.ForeColor = System.Drawing.SystemColors.GrayText;
  241. this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance = appearance6;
  242. this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;
  243. this.ultraGrid1.DisplayLayout.GroupByBox.Hidden = true;
  244. appearance7.BackColor = System.Drawing.SystemColors.ControlLightLight;
  245. appearance7.BackColor2 = System.Drawing.SystemColors.Control;
  246. appearance7.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  247. appearance7.ForeColor = System.Drawing.SystemColors.GrayText;
  248. this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance = appearance7;
  249. this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
  250. this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;
  251. appearance8.BackColor = System.Drawing.SystemColors.Window;
  252. appearance8.ForeColor = System.Drawing.SystemColors.ControlText;
  253. this.ultraGrid1.DisplayLayout.Override.ActiveCellAppearance = appearance8;
  254. appearance9.BackColor = System.Drawing.SystemColors.Highlight;
  255. appearance9.ForeColor = System.Drawing.SystemColors.HighlightText;
  256. this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance = appearance9;
  257. this.ultraGrid1.DisplayLayout.Override.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.RaisedSoft;
  258. this.ultraGrid1.DisplayLayout.Override.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Dotted;
  259. appearance10.BackColor = System.Drawing.SystemColors.Window;
  260. this.ultraGrid1.DisplayLayout.Override.CardAreaAppearance = appearance10;
  261. appearance11.BorderColor = System.Drawing.Color.Silver;
  262. appearance11.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
  263. this.ultraGrid1.DisplayLayout.Override.CellAppearance = appearance11;
  264. this.ultraGrid1.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.EditAndSelectText;
  265. this.ultraGrid1.DisplayLayout.Override.CellPadding = 0;
  266. appearance12.BackColor = System.Drawing.SystemColors.Control;
  267. appearance12.BackColor2 = System.Drawing.SystemColors.ControlDark;
  268. appearance12.BackGradientAlignment = Infragistics.Win.GradientAlignment.Element;
  269. appearance12.BackGradientStyle = Infragistics.Win.GradientStyle.Horizontal;
  270. appearance12.BorderColor = System.Drawing.SystemColors.Window;
  271. this.ultraGrid1.DisplayLayout.Override.GroupByRowAppearance = appearance12;
  272. appearance13.BackColor = System.Drawing.Color.LightSteelBlue;
  273. appearance13.TextHAlign = Infragistics.Win.HAlign.Center;
  274. this.ultraGrid1.DisplayLayout.Override.HeaderAppearance = appearance13;
  275. this.ultraGrid1.DisplayLayout.Override.HeaderStyle = Infragistics.Win.HeaderStyle.Standard;
  276. this.ultraGrid1.DisplayLayout.Override.MinRowHeight = 21;
  277. appearance14.BackColor = System.Drawing.SystemColors.Window;
  278. appearance14.BorderColor = System.Drawing.Color.Silver;
  279. this.ultraGrid1.DisplayLayout.Override.RowAppearance = appearance14;
  280. this.ultraGrid1.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.False;
  281. appearance15.BackColor = System.Drawing.SystemColors.ControlLight;
  282. this.ultraGrid1.DisplayLayout.Override.TemplateAddRowAppearance = appearance15;
  283. this.ultraGrid1.DisplayLayout.ScrollBounds = Infragistics.Win.UltraWinGrid.ScrollBounds.ScrollToFill;
  284. this.ultraGrid1.DisplayLayout.ScrollStyle = Infragistics.Win.UltraWinGrid.ScrollStyle.Immediate;
  285. this.ultraGrid1.DisplayLayout.ViewStyleBand = Infragistics.Win.UltraWinGrid.ViewStyleBand.OutlookGroupBy;
  286. this.ultraGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
  287. this.ultraGrid1.Location = new System.Drawing.Point(0, 26);
  288. this.ultraGrid1.Name = "ultraGrid1";
  289. this.ultraGrid1.RightToLeft = System.Windows.Forms.RightToLeft.No;
  290. this.ultraGrid1.Size = new System.Drawing.Size(812, 331);
  291. this.ultraGrid1.TabIndex = 2;
  292. this.ultraGrid1.Text = "ultraGrid1";
  293. this.ultraGrid1.InitializeLayout += new Infragistics.Win.UltraWinGrid.InitializeLayoutEventHandler(this.ultraGrid1_InitializeLayout);
  294. this.ultraGrid1.AfterRowActivate += new System.EventHandler(this.ultraGrid1_AfterRowActivate);
  295. //
  296. // ultraExpandableGroupBox1
  297. //
  298. this.ultraExpandableGroupBox1.Controls.Add(this.ultraExpandableGroupBoxPanel1);
  299. this.ultraExpandableGroupBox1.Dock = System.Windows.Forms.DockStyle.Bottom;
  300. this.ultraExpandableGroupBox1.ExpandedSize = new System.Drawing.Size(812, 136);
  301. this.ultraExpandableGroupBox1.Location = new System.Drawing.Point(0, 357);
  302. this.ultraExpandableGroupBox1.Name = "ultraExpandableGroupBox1";
  303. this.ultraExpandableGroupBox1.Size = new System.Drawing.Size(812, 136);
  304. this.ultraExpandableGroupBox1.SupportThemes = false;
  305. this.ultraExpandableGroupBox1.TabIndex = 3;
  306. this.ultraExpandableGroupBox1.Text = "编辑区域";
  307. this.ultraExpandableGroupBox1.ViewStyle = Infragistics.Win.Misc.GroupBoxViewStyle.Office2003;
  308. //
  309. // ultraExpandableGroupBoxPanel1
  310. //
  311. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.edit1);
  312. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text3);
  313. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text2);
  314. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.text1);
  315. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel4);
  316. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel3);
  317. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel2);
  318. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.ultraLabel1);
  319. this.ultraExpandableGroupBoxPanel1.Controls.Add(this.panel2);
  320. this.ultraExpandableGroupBoxPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
  321. this.ultraExpandableGroupBoxPanel1.Location = new System.Drawing.Point(2, 22);
  322. this.ultraExpandableGroupBoxPanel1.Name = "ultraExpandableGroupBoxPanel1";
  323. this.ultraExpandableGroupBoxPanel1.Size = new System.Drawing.Size(808, 112);
  324. this.ultraExpandableGroupBoxPanel1.TabIndex = 0;
  325. //
  326. // edit1
  327. //
  328. appearance16.BackColor = System.Drawing.Color.LightCyan;
  329. this.edit1.Appearance = appearance16;
  330. this.edit1.AutoSize = true;
  331. editorButton1.Key = "part";
  332. this.edit1.ButtonsRight.Add(editorButton1);
  333. this.edit1.DropDownButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Never;
  334. this.edit1.DropDownStyle = Infragistics.Win.DropDownStyle.DropDownList;
  335. this.edit1.FlatMode = true;
  336. this.edit1.Location = new System.Drawing.Point(496, 40);
  337. this.edit1.Name = "edit1";
  338. this.edit1.Size = new System.Drawing.Size(184, 21);
  339. this.edit1.TabIndex = 7;
  340. this.edit1.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.edit1_EditorButtonClick);
  341. //
  342. // text3
  343. //
  344. appearance17.BackColor = System.Drawing.Color.LightCyan;
  345. this.text3.Appearance = appearance17;
  346. this.text3.AutoSize = true;
  347. this.text3.BackColor = System.Drawing.Color.LightCyan;
  348. this.text3.FlatMode = true;
  349. this.text3.Location = new System.Drawing.Point(80, 80);
  350. this.text3.Name = "text3";
  351. this.text3.Size = new System.Drawing.Size(600, 21);
  352. this.text3.TabIndex = 6;
  353. //
  354. // text2
  355. //
  356. appearance18.BackColor = System.Drawing.Color.LightCyan;
  357. this.text2.Appearance = appearance18;
  358. this.text2.AutoSize = true;
  359. this.text2.BackColor = System.Drawing.Color.LightCyan;
  360. this.text2.FlatMode = true;
  361. this.text2.Location = new System.Drawing.Point(288, 40);
  362. this.text2.Name = "text2";
  363. this.text2.Size = new System.Drawing.Size(100, 21);
  364. this.text2.TabIndex = 5;
  365. //
  366. // text1
  367. //
  368. appearance19.BackColor = System.Drawing.Color.LightCyan;
  369. this.text1.Appearance = appearance19;
  370. this.text1.AutoSize = true;
  371. this.text1.BackColor = System.Drawing.Color.LightCyan;
  372. this.text1.FlatMode = true;
  373. this.text1.Location = new System.Drawing.Point(80, 40);
  374. this.text1.Name = "text1";
  375. this.text1.Size = new System.Drawing.Size(100, 21);
  376. this.text1.TabIndex = 4;
  377. //
  378. // ultraLabel4
  379. //
  380. this.ultraLabel4.BackColor = System.Drawing.Color.Gainsboro;
  381. this.ultraLabel4.Location = new System.Drawing.Point(32, 82);
  382. this.ultraLabel4.Name = "ultraLabel4";
  383. this.ultraLabel4.Size = new System.Drawing.Size(32, 16);
  384. this.ultraLabel4.TabIndex = 3;
  385. this.ultraLabel4.Text = "备注";
  386. //
  387. // ultraLabel3
  388. //
  389. this.ultraLabel3.BackColor = System.Drawing.Color.Gainsboro;
  390. this.ultraLabel3.Location = new System.Drawing.Point(432, 42);
  391. this.ultraLabel3.Name = "ultraLabel3";
  392. this.ultraLabel3.Size = new System.Drawing.Size(56, 16);
  393. this.ultraLabel3.TabIndex = 2;
  394. this.ultraLabel3.Text = "所属部门";
  395. //
  396. // ultraLabel2
  397. //
  398. this.ultraLabel2.BackColor = System.Drawing.Color.Gainsboro;
  399. this.ultraLabel2.Location = new System.Drawing.Point(224, 42);
  400. this.ultraLabel2.Name = "ultraLabel2";
  401. this.ultraLabel2.Size = new System.Drawing.Size(56, 16);
  402. this.ultraLabel2.TabIndex = 1;
  403. this.ultraLabel2.Text = "部门名称";
  404. //
  405. // ultraLabel1
  406. //
  407. this.ultraLabel1.BackColor = System.Drawing.Color.Gainsboro;
  408. this.ultraLabel1.Location = new System.Drawing.Point(16, 42);
  409. this.ultraLabel1.Name = "ultraLabel1";
  410. this.ultraLabel1.Size = new System.Drawing.Size(56, 16);
  411. this.ultraLabel1.TabIndex = 0;
  412. this.ultraLabel1.Text = "部门编码";
  413. //
  414. // panel2
  415. //
  416. this.panel2.BackColor = System.Drawing.Color.Gainsboro;
  417. this.panel2.Location = new System.Drawing.Point(0, 0);
  418. this.panel2.Name = "panel2";
  419. this.panel2.RightToLeft = System.Windows.Forms.RightToLeft.No;
  420. this.panel2.Size = new System.Drawing.Size(944, 112);
  421. this.panel2.TabIndex = 8;
  422. //
  423. // _panel1_Toolbars_Dock_Area_Left
  424. //
  425. this._panel1_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
  426. this._panel1_Toolbars_Dock_Area_Left.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
  427. this._panel1_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
  428. this._panel1_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
  429. this._panel1_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 26);
  430. this._panel1_Toolbars_Dock_Area_Left.Name = "_panel1_Toolbars_Dock_Area_Left";
  431. this._panel1_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 467);
  432. this._panel1_Toolbars_Dock_Area_Left.ToolbarsManager = this.ultraToolbarsManager1;
  433. //
  434. // _panel1_Toolbars_Dock_Area_Right
  435. //
  436. this._panel1_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
  437. this._panel1_Toolbars_Dock_Area_Right.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
  438. this._panel1_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
  439. this._panel1_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
  440. this._panel1_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(812, 26);
  441. this._panel1_Toolbars_Dock_Area_Right.Name = "_panel1_Toolbars_Dock_Area_Right";
  442. this._panel1_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 467);
  443. this._panel1_Toolbars_Dock_Area_Right.ToolbarsManager = this.ultraToolbarsManager1;
  444. //
  445. // _panel1_Toolbars_Dock_Area_Top
  446. //
  447. this._panel1_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
  448. this._panel1_Toolbars_Dock_Area_Top.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
  449. this._panel1_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
  450. this._panel1_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
  451. this._panel1_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
  452. this._panel1_Toolbars_Dock_Area_Top.Name = "_panel1_Toolbars_Dock_Area_Top";
  453. this._panel1_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(812, 26);
  454. this._panel1_Toolbars_Dock_Area_Top.ToolbarsManager = this.ultraToolbarsManager1;
  455. //
  456. // _panel1_Toolbars_Dock_Area_Bottom
  457. //
  458. this._panel1_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
  459. this._panel1_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(229)))), ((int)(((byte)(229)))), ((int)(((byte)(215)))));
  460. this._panel1_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
  461. this._panel1_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
  462. this._panel1_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 493);
  463. this._panel1_Toolbars_Dock_Area_Bottom.Name = "_panel1_Toolbars_Dock_Area_Bottom";
  464. this._panel1_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(812, 0);
  465. this._panel1_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.ultraToolbarsManager1;
  466. //
  467. // ucDepartment1
  468. //
  469. this.ucDepartment1.Dock = System.Windows.Forms.DockStyle.Left;
  470. this.ucDepartment1.Location = new System.Drawing.Point(0, 0);
  471. this.ucDepartment1.Name = "ucDepartment1";
  472. this.ucDepartment1.Size = new System.Drawing.Size(216, 493);
  473. this.ucDepartment1.TabIndex = 4;
  474. //
  475. // FrmDepartment
  476. //
  477. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  478. this.ClientSize = new System.Drawing.Size(1028, 493);
  479. this.Controls.Add(this.panel1);
  480. this.Controls.Add(this.ucDepartment1);
  481. this.Name = "FrmDepartment";
  482. this.ShowInTaskbar = false;
  483. this.Text = "部门维护";
  484. this.Load += new System.EventHandler(this.FrmDepartment_Load);
  485. ((System.ComponentModel.ISupportInitialize)(this.ultraToolbarsManager1)).EndInit();
  486. this.panel1.ResumeLayout(false);
  487. ((System.ComponentModel.ISupportInitialize)(this.ultraGrid1)).EndInit();
  488. ((System.ComponentModel.ISupportInitialize)(this.ultraExpandableGroupBox1)).EndInit();
  489. this.ultraExpandableGroupBox1.ResumeLayout(false);
  490. this.ultraExpandableGroupBoxPanel1.ResumeLayout(false);
  491. ((System.ComponentModel.ISupportInitialize)(this.edit1)).EndInit();
  492. ((System.ComponentModel.ISupportInitialize)(this.text3)).EndInit();
  493. ((System.ComponentModel.ISupportInitialize)(this.text2)).EndInit();
  494. ((System.ComponentModel.ISupportInitialize)(this.text1)).EndInit();
  495. this.ResumeLayout(false);
  496. }
  497. #endregion
  498. #region " Variable "
  499. public DataSet _departmentData;
  500. public string _selectSQL;
  501. public bool saveFlag = false;
  502. private const string DEPARTMENT_BASE = "ROOT";
  503. private UltraTree ultraTree1;
  504. #endregion
  505. private void FrmDepartment_Load(object sender, System.EventArgs e)
  506. {
  507. ultraTree1 = this.ucDepartment1.ultraTree1;
  508. GetDepartmentData();
  509. InitComboBox();
  510. this.ucDepartment1._departmentData = this._departmentData;
  511. this.ucDepartment1.RefreshTree();
  512. this.ucDepartment1.ultraTree1.ExpandAll();
  513. InitGrid();
  514. this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  515. if (this.ultraTree1.Nodes.Count > 0)
  516. this.ultraTree1.Nodes[0].Selected = true;
  517. string err = "";
  518. //object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("oysrv","ClassLibrary1","ClassLibrary1.Class1","myfun",
  519. // new object[]{}, out err);
  520. if (err == "")
  521. {
  522. //MessageBox.Show((string)obj);
  523. }
  524. }
  525. private void InitComboBox()
  526. {
  527. if (this._departmentData != null && this._departmentData.Tables.Count > 0)
  528. {
  529. DataTable dt = this._departmentData.Tables[0].Copy();
  530. this.edit1.Items.Clear();
  531. foreach (DataRow dr in dt.Rows)
  532. {
  533. try
  534. {
  535. this.edit1.Items.Add(dr["DEPARTMENTID"], dr["DEPARTMENTNAME"].ToString());
  536. }
  537. catch
  538. { }
  539. }
  540. }
  541. }
  542. private void InitGrid()
  543. {
  544. this.ultraGrid1.DataSource = _departmentData.Tables[0];
  545. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Header.Caption = "部门编码";
  546. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].Width = 100;
  547. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
  548. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellActivation = Activation.NoEdit;
  549. this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].CellAppearance.BackColor = Color.LightGoldenrodYellow;
  550. this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Header.Caption = "部门名称";
  551. this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].Width = 200;
  552. this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
  553. this.ultraGrid1.DisplayLayout.Bands[0].Columns[1].CellActivation = Activation.NoEdit;
  554. this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].Header.Caption = "备注";
  555. this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].Width = 100;
  556. this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
  557. this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellActivation = Activation.NoEdit;
  558. this.ultraGrid1.DisplayLayout.Bands[0].Columns[2].CellAppearance.BackColor = Color.LightGoldenrodYellow;
  559. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Header.Caption = "所属部门";
  560. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Width = 100;
  561. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
  562. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellActivation = Activation.NoEdit;
  563. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].CellAppearance.BackColor = Color.LightGoldenrodYellow;
  564. this.ultraGrid1.DisplayLayout.Bands[0].Columns[3].Hidden = true;
  565. this.ultraGrid1.AfterRowActivate += new EventHandler(ultraGrid1_AfterRowActivate);
  566. }
  567. #region "InitTree "
  568. private void ultraTree1_AfterSelect(object sender, Infragistics.Win.UltraWinTree.SelectEventArgs e)
  569. {
  570. try
  571. {
  572. string rowFilter;
  573. if (e.NewSelections == null || e.NewSelections.Count == 0)
  574. rowFilter = "departmentid <> 'ROOT'";
  575. else
  576. {
  577. string str = "'" + e.NewSelections[0].Key + "'";
  578. str = GetSelectedID(ref str, e.NewSelections[0]);
  579. rowFilter = "departmentid in (" + str + ")";
  580. }
  581. DataTable dt = this.ultraGrid1.DataSource as DataTable;
  582. dt.DefaultView.RowFilter = rowFilter;
  583. ultraGrid1_AfterRowActivate(null, null);
  584. }
  585. catch
  586. {
  587. DataTable dt = this.ultraGrid1.DataSource as DataTable;
  588. dt.DefaultView.RowFilter = "1=2";
  589. }
  590. }
  591. private string GetSelectedID(ref string str, UltraTreeNode utn)
  592. {
  593. try
  594. {
  595. foreach (UltraTreeNode ut in utn.Nodes)
  596. {
  597. str += ",'" + ut.Key + "'";
  598. if (ut.Nodes.Count > 0)
  599. GetSelectedID(ref str, ut);
  600. }
  601. return str;
  602. }
  603. catch
  604. {
  605. return "";
  606. }
  607. }
  608. //==========================================================
  609. // 获得部门数据
  610. //==========================================================
  611. private void GetDepartmentData()
  612. {
  613. try
  614. {
  615. CallingMessage par = new CallingMessage();
  616. par.ServerName = "PurviewManager";
  617. //par.AssemblyName = "Core.Mes.PurviewManager";
  618. par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
  619. par.MethodName = "SelectUAM_DEPARTMENT";
  620. par.args = new object[] { " order by DEPARTMENTID " };
  621. par.ServerType = MesServerType.MesSystemBaseServer;
  622. string strOut = "";
  623. _departmentData = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut) as DataSet;
  624. }
  625. catch //(Exception ex)
  626. {
  627. // CoreMesLogger.log(this.GetType()).Error(ex.Message);
  628. }
  629. }
  630. #endregion
  631. #region "button"
  632. private void edit1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
  633. {
  634. FrmSetDepart frm = new FrmSetDepart();
  635. // frm.RemotingHelp = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp;
  636. frm.GetChildIDFlag = false;
  637. frm.Location = GetChildWindowLocation(frm.Size);
  638. frm.ShowDialog();
  639. InitComboBox();
  640. // GetDepartmentData();
  641. if (frm.SelectedID != "" && frm.SelectedName != "")
  642. {
  643. this.edit1.Value = frm.SelectedID;
  644. this.edit1.Tag = frm.ParentID;
  645. }
  646. }
  647. private Point GetChildWindowLocation(Size ChildWindowSize)
  648. {
  649. int width = Cursor.Position.X + ChildWindowSize.Width - Screen.PrimaryScreen.Bounds.Width;
  650. int height = Cursor.Position.Y + ChildWindowSize.Height - Screen.PrimaryScreen.Bounds.Height + 30;
  651. if (width > 0)
  652. width = Cursor.Position.X - width;
  653. else
  654. width = Cursor.Position.X;
  655. if (height > 0)
  656. height = Cursor.Position.Y - height + 10;
  657. else
  658. height = Cursor.Position.Y + 10;
  659. return new Point(width, height);
  660. }
  661. #endregion
  662. #region "toolbars"
  663. private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
  664. {
  665. switch (e.Tool.Key)
  666. {
  667. case "add":
  668. {
  669. Add();
  670. break;
  671. }
  672. case "del":
  673. {
  674. Del();
  675. break;
  676. }
  677. case "edit":
  678. {
  679. Edit();
  680. break;
  681. }
  682. case "close":
  683. {
  684. this.Close();
  685. break;
  686. }
  687. case "al":
  688. {
  689. this.ultraTree1.SelectedNodes.Clear();
  690. break;
  691. }
  692. }
  693. }
  694. private void Add()
  695. {
  696. string OpDpt = RightsComm.CheckNullStr(this.edit1.SelectedItem.DataValue);
  697. if (!RightsComm.CheckRole(OpDpt))
  698. return;
  699. if (this.text1.Text.Trim() == "")
  700. {
  701. MessageBox.Show("请录入部门编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  702. return;
  703. }
  704. if (this.text2.Text.Trim() == "")
  705. {
  706. MessageBox.Show("请录入部门名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  707. return;
  708. }
  709. ArrayList al = new ArrayList();
  710. al.Add(this.text1.Text.Trim());
  711. al.Add(this.text2.Text.Trim());
  712. al.Add(this.text3.Text.Trim());
  713. if (this.edit1.SelectedIndex != -1)
  714. {
  715. al.Add(this.edit1.SelectedItem.DataValue);
  716. }
  717. else
  718. {
  719. al.Add("");
  720. }
  721. try
  722. {
  723. CallingMessage par = new CallingMessage();
  724. par.ServerName = "PurviewManager";
  725. //par.AssemblyName = "Core.Mes.PurviewManager";
  726. par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
  727. par.MethodName = "InsertUAM_DEPARTMENT";
  728. par.args = new object[] { al };
  729. par.ServerType = MesServerType.MesSystemBaseServer;
  730. string strOut = "";
  731. object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut);
  732. if (strOut != "")
  733. {
  734. MessageBox.Show("新增失败! \n" + strOut);
  735. return;
  736. }
  737. else
  738. {
  739. if ((int)obj != 1)
  740. {
  741. MessageBox.Show("新增失败!");
  742. return;
  743. }
  744. }
  745. }
  746. catch //(Exception ex)
  747. {
  748. // CoreMesLogger.log(this.GetType()).Error(ex.Message);
  749. return;
  750. }
  751. this.GetDepartmentData();
  752. string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
  753. this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  754. this.ucDepartment1._departmentData = this._departmentData;
  755. this.ucDepartment1.RefreshTree();
  756. this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  757. if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
  758. {
  759. UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
  760. if (fNd != null)
  761. {
  762. if (fNd.Parent != null)
  763. fNd.Parent.Expanded = true;
  764. fNd.Expanded = true;
  765. ultraTree1.ActiveNode = fNd;
  766. }
  767. }
  768. this.ultraGrid1.AfterRowActivate -= new EventHandler(ultraGrid1_AfterRowActivate);
  769. UltraGridRow ugr = this.ultraGrid1.DisplayLayout.Bands[0].AddNew();
  770. this.ultraGrid1.AfterRowActivate += new EventHandler(ultraGrid1_AfterRowActivate);
  771. ugr.Cells[0].Value = al[0];
  772. ugr.Cells[1].Value = al[1];
  773. ugr.Cells[2].Value = al[2];
  774. ugr.Cells[3].Value = al[3];
  775. this.ultraGrid1.UpdateData();
  776. }
  777. private void Del()
  778. {
  779. int i = 0;
  780. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  781. if (ugr == null)
  782. {
  783. MessageBox.Show("请选择要删除的部门!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  784. return;
  785. }
  786. if (MessageBox.Show("是否确认删除选中的部门?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No)
  787. {
  788. return;
  789. }
  790. try
  791. {
  792. i = ugr.Index;
  793. string strWhere = ugr.Cells[0].Value.ToString();
  794. if (!RightsComm.CheckRole(strWhere))
  795. return;
  796. CallingMessage par = new CallingMessage();
  797. par.ServerName = "PurviewManager";
  798. //par.AssemblyName = "Core.Mes.PurviewManager";
  799. par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
  800. par.MethodName = "DeleteUAM_DEPARTMENT";
  801. par.args = new object[] { strWhere };
  802. par.ServerType = MesServerType.MesSystemBaseServer;
  803. string strOut = "";
  804. object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut);
  805. if (strOut != "")
  806. {
  807. MessageBox.Show("删除失败! \n" + strOut);
  808. return;
  809. }
  810. else
  811. {
  812. if ((int)obj != 1)
  813. {
  814. MessageBox.Show("删除失败!");
  815. return;
  816. }
  817. }
  818. }
  819. catch //(Exception ex)
  820. {
  821. // CoreMesLogger.log(this.GetType()).Error(ex.Message);
  822. return;
  823. }
  824. this.ultraGrid1.ActiveRow.Delete(false);
  825. this.ultraGrid1.UpdateData();
  826. this.GetDepartmentData();
  827. InitComboBox();
  828. string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
  829. this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  830. this.ucDepartment1._departmentData = this._departmentData;
  831. this.ucDepartment1.RefreshTree();
  832. this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  833. if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
  834. {
  835. UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
  836. if (fNd != null)
  837. {
  838. if (fNd.Parent != null)
  839. fNd.Parent.Expanded = true;
  840. fNd.Expanded = true;
  841. ultraTree1.ActiveNode = fNd;
  842. }
  843. }
  844. try
  845. {
  846. this.ultraGrid1.Rows[i].Activate();
  847. }
  848. catch
  849. {
  850. int count = this.ultraGrid1.Rows.Count;
  851. if (count > 0)
  852. this.ultraGrid1.Rows[count - 1].Activate();
  853. }
  854. }
  855. private void Edit()
  856. {
  857. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  858. if (ugr == null)
  859. {
  860. MessageBox.Show("请选择要修改的部门!");
  861. return;
  862. }
  863. if (ugr.Cells["DEPARTMENTID"].Value.ToString() == edit1.SelectedItem.DataValue.ToString())
  864. {
  865. MessageBox.Show("所属部门不可选自己!");
  866. edit1.Focus();
  867. return;
  868. }
  869. if (!RightsComm.CheckRole(RightsComm.CheckNullStr(edit1.SelectedItem.DataValue)))
  870. return;
  871. ArrayList al = new ArrayList();
  872. al.Add(ugr.Cells["DEPARTMENTID"].Value.ToString());
  873. al.Add(this.text2.Text.Trim());
  874. al.Add(this.text3.Text.Trim());
  875. al.Add(this.edit1.SelectedItem.DataValue);
  876. try
  877. {
  878. CallingMessage par = new CallingMessage();
  879. par.ServerName = "PurviewManager";
  880. //par.AssemblyName = "Core.Mes.PurviewManager";
  881. par.ClassName = "Core.Mes.PurviewManager.PurviewManager";
  882. par.MethodName = "UpdateUAM_DEPARTMENT";
  883. par.args = new object[] { al };
  884. par.ServerType = MesServerType.MesSystemBaseServer;
  885. string strOut = "";
  886. object obj = Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod(par, out strOut);
  887. if (strOut != "")
  888. {
  889. MessageBox.Show("修改失败 \n" + strOut);
  890. return;
  891. }
  892. else
  893. {
  894. int i = (int)obj;
  895. if (i != 1)
  896. {
  897. MessageBox.Show("修改失败");
  898. return;
  899. }
  900. }
  901. }
  902. catch //(Exception ex)
  903. {
  904. // CoreMesLogger.log(this.GetType()).Error(ex.Message);
  905. return;
  906. }
  907. ugr.Cells[0].Value = al[0];
  908. ugr.Cells[1].Value = al[1];
  909. ugr.Cells[2].Value = al[2];
  910. ugr.Cells[3].Value = al[3];
  911. this.ultraGrid1.UpdateData();
  912. this.GetDepartmentData();
  913. string chooseKey = (ultraTree1.ActiveNode != null) ? ultraTree1.ActiveNode.Key : "";
  914. this.ultraTree1.AfterSelect -= new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  915. this.ucDepartment1._departmentData = this._departmentData;
  916. this.ucDepartment1.RefreshTree();
  917. this.ultraTree1.AfterSelect += new Infragistics.Win.UltraWinTree.AfterNodeSelectEventHandler(ultraTree1_AfterSelect);
  918. if (chooseKey != "" && ultraTree1.Nodes.Count > 0)
  919. {
  920. UltraTreeNode fNd = activeNode(chooseKey, ultraTree1.Nodes);
  921. if (fNd != null)
  922. {
  923. if (fNd.Parent != null)
  924. fNd.Parent.Expanded = true;
  925. fNd.Expanded = true;
  926. ultraTree1.ActiveNode = fNd;
  927. }
  928. }
  929. }
  930. UltraTreeNode activeNode(string sKey, TreeNodesCollection nodes)
  931. {
  932. foreach (UltraTreeNode nd in nodes)
  933. {
  934. if (nd.Key == sKey)
  935. {
  936. nd.Selected = true;
  937. return nd;
  938. }
  939. else
  940. {
  941. UltraTreeNode nNd = activeNode(sKey, nd.Nodes);
  942. if (nNd != null)
  943. return nNd;
  944. }
  945. }
  946. return null;
  947. }
  948. #endregion
  949. #region "Grid Event"
  950. private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
  951. {
  952. }
  953. private void ultraGrid1_AfterRowActivate(object sender, System.EventArgs e)
  954. {
  955. try
  956. {
  957. if (this.ultraGrid1.ActiveRow == null) return;
  958. UltraGridRow ugr = this.ultraGrid1.ActiveRow;
  959. this.text1.Text = ugr.Cells[0].Value.ToString();
  960. this.text2.Text = ugr.Cells[1].Value.ToString();
  961. this.text3.Text = ugr.Cells[2].Value.ToString();
  962. this.edit1.Value = ugr.Cells[3].Value;
  963. this.edit1.Tag = ucDepartment1.ParentID;
  964. }
  965. catch (Exception ex)
  966. {
  967. Console.WriteLine(ex.Message);
  968. }
  969. }
  970. #endregion
  971. }
  972. }