Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // **************************************************
- // Custom code for MESMenu
- // Created: 3/27/2017 10:28:19 AM
- // **************************************************
- using System;
- using System.ComponentModel;
- using System.Data;
- using System.Diagnostics;
- using System.Windows.Forms;
- using Erp.Adapters;
- using Ice.BO;
- using Ice.UI;
- using Ice.Lib;
- using Ice.Adapters;
- using Ice.Lib.Customization;
- using Ice.Lib.ExtendedProps;
- using Ice.Lib.Framework;
- using Ice.Lib.Searches;
- using Ice.UI.FormFunctions;
- using System.Collections;
- using System.Collections.Specialized;
- public class Script
- {
- // ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
- // Begin Wizard Added Module Level Variables **
- private EpiDataView edvEmpBasic;
- private EpiDataView edvAutoAttachEmpBasic;
- private EpiDataView edvLaborHed;
- private EpiDataView edvMESControl;
- // End Wizard Added Module Level Variables **
- // Add Custom Module Level Variables Here **
- Timer t = new Timer();
- EpiButton startProd = new EpiButton();
- EpiButton endProd = new EpiButton();
- EpiUltraGrid laborDtl = new EpiUltraGrid();
- public void InitializeCustomCode()
- {
- // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
- // Begin Wizard Added Variable Initialization
- this.LaborHed_Column.ColumnChanged += new DataColumnChangeEventHandler(this.LaborHed_AfterFieldChange);
- this.MESControl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.MESControl_AfterFieldChange);
- this.LaborDtl_Column.ColumnChanged += new DataColumnChangeEventHandler(this.LaborDtl_AfterFieldChange);
- this.edvEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["EmpBasic"]));
- this.edvEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
- this.edvAutoAttachEmpBasic = ((EpiDataView)(this.oTrans.EpiDataViews["AutoAttachEmpBasic"]));
- this.edvAutoAttachEmpBasic.EpiViewNotification += new EpiViewNotification(this.edvAutoAttachEmpBasic_EpiViewNotification);
- this.edvLaborHed = ((EpiDataView)(this.oTrans.EpiDataViews["LaborHed"]));
- this.edvLaborHed.EpiViewNotification += new EpiViewNotification(this.edvLaborHed_EpiViewNotification);
- this.edvMESControl = ((EpiDataView)(this.oTrans.EpiDataViews["MESControl"]));
- this.edvMESControl.EpiViewNotification += new EpiViewNotification(this.edvMESControl_EpiViewNotification);
- // End Wizard Added Variable Initialization
- // Begin Wizard Added Custom Method Calls
- // End Wizard Added Custom Method Calls
- }
- public void DestroyCustomCode()
- {
- // ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
- // Begin Wizard Added Object Disposal
- this.LaborHed_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.LaborHed_AfterFieldChange);
- this.MESControl_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.MESControl_AfterFieldChange);
- this.LaborDtl_Column.ColumnChanged -= new DataColumnChangeEventHandler(this.LaborDtl_AfterFieldChange);
- this.edvEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvEmpBasic_EpiViewNotification);
- this.edvEmpBasic = null;
- this.edvAutoAttachEmpBasic.EpiViewNotification -= new EpiViewNotification(this.edvAutoAttachEmpBasic_EpiViewNotification);
- this.edvAutoAttachEmpBasic = null;
- this.edvLaborHed.EpiViewNotification -= new EpiViewNotification(this.edvLaborHed_EpiViewNotification);
- this.edvLaborHed = null;
- this.edvMESControl.EpiViewNotification -= new EpiViewNotification(this.edvMESControl_EpiViewNotification);
- this.edvMESControl = null;
- // End Wizard Added Object Disposal
- // Begin Custom Code Disposal
- // End Custom Code Disposal
- }
- private void LaborHed_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
- {
- // ** Argument Properties and Uses **
- // args.Row["FieldName"]
- // args.Column, args.ProposedValue, args.Row
- // Add Event Handler Code
- switch (args.Column.ColumnName)
- {
- case "EmployeeNum":
- MessageBox.Show("Num");
- break;
- case "EmployeeNumName":
- MessageBox.Show("Name");
- break;
- }
- }
- private void MESControl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
- {
- // ** Argument Properties and Uses **
- // args.Row["FieldName"]
- // args.Column, args.ProposedValue, args.Row
- // Add Event Handler Code
- switch (args.Column.ColumnName)
- {
- case "EmployeeID":
- break;
- }
- }
- public void StartForm(object sender, EventArgs e)
- {
- t.Stop();
- laborDtl = (EpiUltraGrid)csm.GetNativeControlReference("a9cf2b4f-03f2-499e-9744-c311af7f8172");
- endProd = (EpiButton)csm.GetNativeControlReference("76429950-9d54-46e6-9256-2aa7ad591d23");
- startProd = (EpiButton)csm.GetNativeControlReference("6e0b1e1f-5c18-486b-9dd1-adca4a309737");
- try
- {
- if(laborDtl.ActiveRow.Equals(null)) { } else endProd.PerformClick();
- }
- catch (System.NullReferenceException)
- {
- startProd.PerformClick();
- }
- }
- private void LaborDtl_AfterFieldChange(object sender, DataColumnChangeEventArgs args)
- {
- // ** Argument Properties and Uses **
- // args.Row["FieldName"]
- // args.Column, args.ProposedValue, args.Row
- // Add Event Handler Code
- switch (args.Column.ColumnName)
- {
- case "EmployeeName":
- MessageBox.Show("NAME");
- break;
- }
- }
- private void edvEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
- {
- // ** Argument Properties and Uses **
- // view.dataView[args.Row]["FieldName"]
- // args.Row, args.Column, args.Sender, args.NotifyType
- // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
- if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
- {
- if ((args.Row > -1))
- {
- MessageBox.Show("1");
- }
- }
- }
- private void edvAutoAttachEmpBasic_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
- {
- // ** Argument Properties and Uses **
- // view.dataView[args.Row]["FieldName"]
- // args.Row, args.Column, args.Sender, args.NotifyType
- // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
- if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
- {
- if ((args.Row > -1))
- {
- MessageBox.Show("2");
- }
- }
- }
- private void edvLaborHed_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
- {
- // ** Argument Properties and Uses **
- // view.dataView[args.Row]["FieldName"]
- // args.Row, args.Column, args.Sender, args.NotifyType
- // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
- if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
- {
- if ((args.Row > -1))
- {
- MessageBox.Show("3");
- }
- }
- }
- private void edvMESControl_EpiViewNotification(EpiDataView view, EpiNotifyArgs args)
- {
- // ** Argument Properties and Uses **
- // view.dataView[args.Row]["FieldName"]
- // args.Row, args.Column, args.Sender, args.NotifyType
- // NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
- if ((args.NotifyType == EpiTransaction.NotifyType.AddRow))
- {
- if ((args.Row > -1))
- {
- MessageBox.Show("4");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement