Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.33 KB | None | 0 0
  1. // **************************************************
  2. // Custom code for MESMenu
  3. // Created: 3/27/2017 10:28:19 AM
  4. // **************************************************
  5. using System;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Diagnostics;
  9. using System.Windows.Forms;
  10. using Erp.Adapters;
  11. using Ice.BO;
  12. using Ice.UI;
  13. using Ice.Lib;
  14. using Ice.Adapters;
  15. using Ice.Lib.Customization;
  16. using Ice.Lib.ExtendedProps;
  17. using Ice.Lib.Framework;
  18. using Ice.Lib.Searches;
  19. using Ice.UI.FormFunctions;
  20. using System.Collections;
  21. using System.Collections.Specialized;
  22.  
  23. public class Script
  24. {
  25. // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
  26. // Begin Wizard Added Module Level Variables **
  27.  
  28. private EpiDataView edvEmpBasic;
  29. private EpiDataView edvAutoAttachEmpBasic;
  30. private EpiDataView edvLaborHed;
  31. private EpiDataView edvMESControl;
  32. // End Wizard Added Module Level Variables **
  33.  
  34. // Add Custom Module Level Variables Here **
  35. Timer t = new Timer();
  36. EpiButton startProd = new EpiButton();
  37. EpiButton endProd = new EpiButton();
  38. EpiUltraGrid laborDtl = new EpiUltraGrid();
  39.  
  40. public void InitializeCustomCode()
  41. {
  42. // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
  43. // Begin Wizard Added Variable Initialization
  44.  
  45. this.LaborHed_Column.ColumnChanged += new DataColumnChangeEventHandler(this.LaborHed_AfterFieldChange);
  46. this.MESControl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.MESControl_AfterFieldChange);
  47. this.LaborDtl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.LaborDtl_AfterFieldChange);
  48. this.edvEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["EmpBasic"]));
  49. this.edvEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
  50. this.edvAutoAttachEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["AutoAttachEmpBasic"]));
  51. this.edvAutoAttachEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvAutoAttachEmpBasic_EpiViewNotification);
  52. this.edvLaborHed = ((EpiDataView)(this.oTrans.EpiDataViews["LaborHed"]));
  53. this.edvLaborHed.EpiViewNotification += new EpiViewNotification(this.edvLaborHed_EpiViewNotification);
  54. this.edvMESControl = ((EpiDataView)(this.oTrans.EpiDataViews["MESControl"]));
  55. this.edvMESControl.EpiViewNotification += new EpiViewNotification(this.edvMESControl_EpiViewNotification);
  56. // End Wizard Added Variable Initialization
  57.  
  58. // Begin Wizard Added Custom Method Calls
  59.  
  60. // End Wizard Added Custom Method Calls
  61. }
  62.  
  63. public void DestroyCustomCode()
  64. {
  65. // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
  66. // Begin Wizard Added Object Disposal
  67.  
  68. this.LaborHed_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.LaborHed_AfterFieldChange);
  69. this.MESControl_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.MESControl_AfterFieldChange);
  70. this.LaborDtl_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.LaborDtl_AfterFieldChange);
  71. this.edvEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
  72. this.edvEmpBasic = null;
  73. this.edvAutoAttachEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvAutoAttachEmpBasic_EpiViewNotification);
  74. this.edvAutoAttachEmpBasic = null;
  75. this.edvLaborHed.EpiViewNotification -= new EpiViewNotification(this.edvLaborHed_EpiViewNotification);
  76. this.edvLaborHed = null;
  77. this.edvMESControl.EpiViewNotification -= new EpiViewNotification(this.edvMESControl_EpiViewNotification);
  78. this.edvMESControl = null;
  79. // End Wizard Added Object Disposal
  80.  
  81. // Begin Custom Code Disposal
  82.  
  83. // End Custom Code Disposal
  84. }
  85.  
  86. private void LaborHed_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
  87. {
  88. // ** Argument Properties and Uses **
  89. // args.Row["FieldName"]
  90. // args.Column, args.ProposedValue, args.Row
  91. // Add Event Handler Code
  92. switch (args.Column.ColumnName)
  93. {
  94. case "EmployeeNum":
  95. MessageBox.Show("Num");
  96. break;
  97.  
  98. case "EmployeeNumName":
  99. MessageBox.Show("Name");
  100. break;
  101. }
  102. }
  103.  
  104. private void MESControl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
  105. {
  106. // ** Argument Properties and Uses **
  107. // args.Row["FieldName"]
  108. // args.Column, args.ProposedValue, args.Row
  109. // Add Event Handler Code
  110. switch (args.Column.ColumnName)
  111. {
  112. case "EmployeeID":
  113.  
  114. break;
  115. }
  116. }
  117.  
  118. public void StartForm(object sender, EventArgs e)
  119. {
  120. t.Stop();
  121. laborDtl = (EpiUltraGrid)csm.GetNativeControlReference("a9cf2b4f-03f2-499e-9744-c311af7f8172");
  122. endProd = (EpiButton)csm.GetNativeControlReference("76429950-9d54-46e6-9256-2aa7ad591d23");
  123. startProd = (EpiButton)csm.GetNativeControlReference("6e0b1e1f-5c18-486b-9dd1-adca4a309737");
  124. try
  125. {
  126. if(laborDtl.ActiveRow.Equals(null)) { } else endProd.PerformClick();
  127. }
  128. catch (System.NullReferenceException)
  129. {
  130. startProd.PerformClick();
  131. }
  132. }
  133.  
  134. private void LaborDtl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
  135. {
  136. // ** Argument Properties and Uses **
  137. // args.Row["FieldName"]
  138. // args.Column, args.ProposedValue, args.Row
  139. // Add Event Handler Code
  140. switch (args.Column.ColumnName)
  141. {
  142. case "EmployeeName":
  143. MessageBox.Show("NAME");
  144. break;
  145. }
  146. }
  147.  
  148. private void edvEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
  149. {
  150. // ** Argument Properties and Uses **
  151. // view.dataView[args.Row]["FieldName"]
  152. // args.Row, args.Column, args.Sender, args.NotifyType
  153. // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
  154. if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
  155. {
  156. if ((args.Row > -1))
  157. {
  158. MessageBox.Show("1");
  159. }
  160. }
  161. }
  162.  
  163. private void edvAutoAttachEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
  164. {
  165. // ** Argument Properties and Uses **
  166. // view.dataView[args.Row]["FieldName"]
  167. // args.Row, args.Column, args.Sender, args.NotifyType
  168. // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
  169. if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
  170. {
  171. if ((args.Row > -1))
  172. {
  173. MessageBox.Show("2");
  174. }
  175. }
  176. }
  177.  
  178. private void edvLaborHed_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
  179. {
  180. // ** Argument Properties and Uses **
  181. // view.dataView[args.Row]["FieldName"]
  182. // args.Row, args.Column, args.Sender, args.NotifyType
  183. // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
  184. if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
  185. {
  186. if ((args.Row > -1))
  187. {
  188. MessageBox.Show("3");
  189. }
  190. }
  191. }
  192.  
  193. private void edvMESControl_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
  194. {
  195. // ** Argument Properties and Uses **
  196. // view.dataView[args.Row]["FieldName"]
  197. // args.Row, args.Column, args.Sender, args.NotifyType
  198. // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
  199. if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
  200. {
  201. if ((args.Row > -1))
  202. {
  203. MessageBox.Show("4");
  204. }
  205. }
  206. }
  207. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement