using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using GZTW.AyaNova.BLL; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using Infragistics.Win.UltraWinToolbars; using System.Text; using log4net; namespace AyaNova { /// /// Summary description for PartInventoryAdjustmentInfoForm. /// public class PartInventoryAdjustmentInfoForm : System.Windows.Forms.Form { // Create a logger for use in this class //case 1039 private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private System.Windows.Forms.CheckBox ckIsDirty; private System.Windows.Forms.ErrorProvider ErrorProvider; private System.Windows.Forms.Panel panelLeft; private System.Windows.Forms.Panel panelRight; private System.Windows.Forms.Panel panelBottom; private System.Windows.Forms.Splitter splitter1; private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraLabel lblExpectedReceiveDate; private Infragistics.Win.UltraWinGrid.UltraGrid Grid; private GZTW.WinForm.Controls.GZDateTimePicker dtDateAdjusted; private Infragistics.Win.UltraWinEditors.UltraTextEditor edReasonForAdjustment; private Infragistics.Win.Misc.UltraLabel ultraLabel1; private System.Windows.Forms.HelpProvider helpProvider1; private System.ComponentModel.IContainer components; public PartInventoryAdjustmentInfoForm(bool ViewOnlyMode) { mViewOnlyMode=ViewOnlyMode; // // Required for Windows Form Designer support // InitializeComponent(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("PartInventoryAdjustmentEntryMenuBar"); Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ListTool listTool1 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print"); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); this.ckIsDirty = new System.Windows.Forms.CheckBox(); this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this.panelLeft = new System.Windows.Forms.Panel(); this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel(); this.edReasonForAdjustment = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.dtDateAdjusted = new GZTW.WinForm.Controls.GZDateTimePicker(); this.lblExpectedReceiveDate = new Infragistics.Win.Misc.UltraLabel(); this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.panelRight = new System.Windows.Forms.Panel(); this.panelBottom = new System.Windows.Forms.Panel(); this.Grid = new Infragistics.Win.UltraWinGrid.UltraGrid(); this.splitter1 = new System.Windows.Forms.Splitter(); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this.helpProvider1 = new System.Windows.Forms.HelpProvider(); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit(); this.panelLeft.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edReasonForAdjustment)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dtDateAdjusted)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit(); this.panelBottom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit(); this.SuspendLayout(); // // ckIsDirty // this.ckIsDirty.Location = new System.Drawing.Point(-336, 28); this.ckIsDirty.Name = "ckIsDirty"; this.ckIsDirty.Size = new System.Drawing.Size(218, 27); this.ckIsDirty.TabIndex = 5; // // tbManager // this.tbManager.DesignerFlags = 1; this.tbManager.DockWithinContainer = this; this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form); this.tbManager.ShowFullMenusDelay = 500; ultraToolbar1.DockedColumn = 0; ultraToolbar1.DockedRow = 0; ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { popupMenuTool1, buttonTool1, buttonTool2, buttonTool3, buttonTool4}); ultraToolbar1.Text = "PartInventoryAdjustmentEntryMenuBar"; this.tbManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] { ultraToolbar1}); this.tbManager.ToolbarSettings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False; this.tbManager.ToolbarSettings.AllowFloating = Infragistics.Win.DefaultableBoolean.False; this.tbManager.ToolbarSettings.AllowHiding = Infragistics.Win.DefaultableBoolean.False; buttonTool5.SharedPropsInternal.AccessibleDescription = "recorddd"; appearance1.Image = global::AyaNova.Resource1.SaveExit32; buttonTool5.SharedPropsInternal.AppearancesLarge.Appearance = appearance1; appearance2.Image = global::AyaNova.Resource1.SaveExit16; buttonTool5.SharedPropsInternal.AppearancesSmall.Appearance = appearance2; buttonTool5.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose"; appearance3.Image = global::AyaNova.Resource1.RecordHistory32; buttonTool6.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = global::AyaNova.Resource1.RecordHistory16; buttonTool6.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool6.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory"; buttonTool7.SharedPropsInternal.Caption = "LT:UI.Command.Save"; buttonTool7.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; buttonTool8.SharedPropsInternal.Caption = "LT:UI.Command.Close"; buttonTool8.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; listTool1.DisplayCheckmark = false; appearance5.Image = global::AyaNova.Resource1.Print32; popupMenuTool2.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = global::AyaNova.Resource1.Print16; popupMenuTool2.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; popupMenuTool2.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print"; popupMenuTool2.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars; popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { listTool2}); this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool5, buttonTool6, buttonTool7, buttonTool8, listTool1, popupMenuTool2}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // panelLeft // this.panelLeft.Controls.Add(this.ultraLabel1); this.panelLeft.Controls.Add(this.edReasonForAdjustment); this.panelLeft.Controls.Add(this.dtDateAdjusted); this.panelLeft.Controls.Add(this.lblExpectedReceiveDate); this.panelLeft.Dock = System.Windows.Forms.DockStyle.Left; this.panelLeft.Location = new System.Drawing.Point(0, 43); this.panelLeft.Name = "panelLeft"; this.panelLeft.Size = new System.Drawing.Size(300, 178); this.panelLeft.TabIndex = 96; // // ultraLabel1 // this.ultraLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ultraLabel1.Location = new System.Drawing.Point(10, 74); this.ultraLabel1.Name = "ultraLabel1"; this.ultraLabel1.Size = new System.Drawing.Size(268, 18); this.ultraLabel1.TabIndex = 166; this.ultraLabel1.Tag = ""; this.ultraLabel1.Text = "LT:PartInventoryAdjustment.Label.ReasonForAdjustment"; // // edReasonForAdjustment // this.edReasonForAdjustment.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edReasonForAdjustment.Location = new System.Drawing.Point(10, 92); this.edReasonForAdjustment.MaxLength = 255; this.edReasonForAdjustment.Multiline = true; this.edReasonForAdjustment.Name = "edReasonForAdjustment"; this.edReasonForAdjustment.Size = new System.Drawing.Size(259, 102); this.edReasonForAdjustment.TabIndex = 1; // // dtDateAdjusted // this.dtDateAdjusted.GZEnabled = true; this.dtDateAdjusted.GZReadOnly = false; this.dtDateAdjusted.Location = new System.Drawing.Point(10, 28); this.dtDateAdjusted.Name = "dtDateAdjusted"; this.dtDateAdjusted.Size = new System.Drawing.Size(201, 24); this.dtDateAdjusted.TabIndex = 0; // // lblExpectedReceiveDate // this.lblExpectedReceiveDate.Location = new System.Drawing.Point(10, 9); this.lblExpectedReceiveDate.Name = "lblExpectedReceiveDate"; this.lblExpectedReceiveDate.Size = new System.Drawing.Size(259, 19); this.lblExpectedReceiveDate.TabIndex = 163; this.lblExpectedReceiveDate.Tag = ""; this.lblExpectedReceiveDate.Text = "LT:PartInventoryAdjustment.Label.DateAdjusted"; // // ErrorProvider // this.ErrorProvider.ContainerControl = this; // // panelRight // this.panelRight.Dock = System.Windows.Forms.DockStyle.Left; this.panelRight.Location = new System.Drawing.Point(300, 43); this.panelRight.Name = "panelRight"; this.panelRight.Size = new System.Drawing.Size(300, 178); this.panelRight.TabIndex = 101; // // panelBottom // this.panelBottom.Controls.Add(this.Grid); this.panelBottom.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelBottom.Location = new System.Drawing.Point(0, 231); this.panelBottom.Name = "panelBottom"; this.panelBottom.Size = new System.Drawing.Size(608, 295); this.panelBottom.TabIndex = 102; // // Grid // this.Grid.Cursor = System.Windows.Forms.Cursors.Default; this.Grid.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom; this.Grid.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.True; this.Grid.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.True; this.Grid.Dock = System.Windows.Forms.DockStyle.Fill; this.Grid.Location = new System.Drawing.Point(0, 0); this.Grid.Name = "Grid"; this.Grid.Size = new System.Drawing.Size(608, 295); this.Grid.TabIndex = 0; this.Grid.Tag = ""; this.Grid.Text = "LT:O.PartInventoryAdjustmentItem"; this.Grid.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.Grid_AfterCellUpdate); this.Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.Grid_InitializeRow); this.Grid.BeforeRowInsert += new Infragistics.Win.UltraWinGrid.BeforeRowInsertEventHandler(this.Grid_BeforeRowInsert); this.Grid.BeforeCellUpdate += new Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventHandler(this.Grid_BeforeCellUpdate); this.Grid.MouseEnterElement += new Infragistics.Win.UIElementEventHandler(this.Grid_MouseEnterElement); // // splitter1 // this.splitter1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitter1.Location = new System.Drawing.Point(0, 221); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(608, 10); this.splitter1.TabIndex = 103; this.splitter1.TabStop = false; // // _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left // this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.Name = "_PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left"; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 483); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right // this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(608, 43); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.Name = "_PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right"; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 483); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top // this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.Name = "_PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top"; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(608, 43); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom // this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 526); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.Name = "_PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom"; this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(608, 0); this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // PartInventoryAdjustmentInfoForm // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(608, 526); this.Controls.Add(this.panelRight); this.Controls.Add(this.panelLeft); this.Controls.Add(this.splitter1); this.Controls.Add(this.panelBottom); this.Controls.Add(this.ckIsDirty); this.Controls.Add(this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Left); this.Controls.Add(this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Right); this.Controls.Add(this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._PartInventoryAdjustmentInfoForm_Toolbars_Dock_Area_Top); this.helpProvider1.SetHelpKeyword(this, ""); this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); this.MinimumSize = new System.Drawing.Size(614, 563); this.Name = "PartInventoryAdjustmentInfoForm"; this.helpProvider1.SetShowHelp(this, true); this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Closing += new System.ComponentModel.CancelEventHandler(this.PartInventoryAdjustmentInfoForm_Closing); this.Load += new System.EventHandler(this.PartInventoryAdjustmentInfoForm_Load); this.SizeChanged += new System.EventHandler(this.PartInventoryAdjustmentInfoForm_SizeChanged); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit(); this.panelLeft.ResumeLayout(false); this.panelLeft.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edReasonForAdjustment)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dtDateAdjusted)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit(); this.panelBottom.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit(); this.ResumeLayout(false); } #endregion // __ _ _ ___ ____ __ __ __ __ __ ___ ___ // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _) // ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _) // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___) // #region Form Load / Close //variable to hold user form settings //UIUserFormSetting mFormSetting; //Variable to hold whether form is read only or not //this is because purchase order receipts can not be edited once //they have been saved //this is set in constructor private bool mViewOnlyMode=false; //Part list used throughout PartPickList mPartList=null; /// /// Prepare the form /// /// /// private void PartInventoryAdjustmentInfoForm_Load(object sender, System.EventArgs e) { // // helpProvider1 // this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "inventory_adjustments.htm"; //case 1039 //log.Debug("PartInventoryAdjustmentInfoForm_Load"); Cursor.Current = Cursors.WaitCursor; this.Visible=false; this.Icon = Resource1.PartAdjustment16icon; //See if user has any rights to be here... //(this is done here to ensure that no matter what happens if a user has no rights they can't get here //useful in case we miss a way of getting to a client edit screen from elsewhere in the program) if(AyaBizUtils.Right("Object.PartInventoryAdjustment")< (int)SecurityLevelTypes.ReadOnly)//Less than read only instead of NoAccess to catch records where it's zero instead of 1 { //Inform them of their wicked ways and boot them out of here... MessageBox.Show(string.Format( Util.LocaleText.GetLocalizedText("Error.Security.NotAuthorizedToRetrieve"), Util.LocaleText.GetLocalizedText("O.PartInventoryAdjustment"))); this.Close(); return; } //Get a part list mPartList=PartPickList.GetAllParts(); DataBind(); InitializeGrid(); int Split1 = 0; Util.LoadFormCustomization("PartInventoryAdjustmentInfo", this, tbManager, false,ref Split1); splitter1.SplitPosition = Split1; Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.PartInventoryAdjustment, mPartInventoryAdjustment, null));//case 941 if (AyaBizUtils.Right("Object.Report") < (int)SecurityLevelTypes.ReadOnly) { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = false; } else { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = true; Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], PartInventoryAdjustmentList.ReportKey, PartInventoryAdjustmentDetailedReportData.ReportKey); } Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810 Util.Localize(this); Cursor.Current = Cursors.Default; //Case 152 (new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); Application.Idle+= new EventHandler(Application_Idle); Util.LocalizeGrid(Grid); //restrict UI based on security settings RestrictUI(); //Only show expansion indicators for items //that have children (default is to show for all because it's expensive to //check to see if each one has children, but we have a small collection so it //doesn't matter as much) Grid.DisplayLayout.Override.ExpansionIndicator=ShowExpansionIndicator.CheckOnDisplay; this.Visible=true; } /// /// Used to track whether the close was done by the program /// or done by the user clicking on the upper left corner X control /// bool bClosingHandled=false; /// /// Save form layout and grid layout for next time /// /// /// private void PartInventoryAdjustmentInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("PartInventoryAdjustmentInfoForm_Closing"); //TODO: if not mViewOnlyMode: //Remove zero quantity parts, ensure all serial numbers entered etc if(!mViewOnlyMode && !bClosingHandled) { //Save record if necessary //User may opt to not cancel exit if(!RecordUpdate(RecordActionType.PromptToSave) ) { e.Cancel=true; return; } } Application.Idle-= new EventHandler(Application_Idle); //case 1999 Util.SaveGridLayout("PartInventoryAdjustmentItems", "", "", Grid); Util.SaveFormCustomization("PartInventoryAdjustmentInfo", this, tbManager, false, splitter1.SplitPosition); } #endregion #region Form Sizing /// /// Adjust the layout proportionately as it's sized by user /// /// /// private void PartInventoryAdjustmentInfoForm_SizeChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("PartInventoryAdjustmentInfoForm_SizeChanged"); int nWidth=0; int nHeight=(this.DisplayRectangle.Height/3)*2; nWidth=this.DisplayRectangle.Width/2; this.panelLeft.Width=nWidth; this.panelRight.Width=nWidth; this.panelLeft.Height=(this.DisplayRectangle.Height/3)-40; this.panelRight.Height=(this.DisplayRectangle.Height/3)-40; this.panelBottom.Height=nHeight; } #endregion #region Toolbar menu items /// /// Respond to a click on a toolbar menu item /// /// /// private void tbManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e) { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("ToolClick: "+e.Tool.Key); switch (e.Tool.Key) { case "LT:UI.Command.SaveClose": // ButtonTool RecordUpdate(RecordActionType.SaveAndExit); break; case "LT:UI.Command.RecordHistory": // ButtonTool RecordHistoryForm RH=new RecordHistoryForm(mPartInventoryAdjustment.Creator,mPartInventoryAdjustment.Modifier,mPartInventoryAdjustment.Created,mPartInventoryAdjustment.Modified); RH.ShowDialog(); RH.Dispose(); break; case "LT:UI.Command.Save": // ButtonTool RecordUpdate(RecordActionType.SaveOnly); break; case "LT:UI.Command.Close": // ButtonTool this.Close(); break; case "REPORTLIST": { if(Util.ReportHandleToolClickIsSummary(e.Tool)) Util.ReportHandleToolClick(e.Tool,PartInventoryAdjustmentList.ReportKey, PartInventoryAdjustmentList.GetListForSingleItem(this.mPartInventoryAdjustment.ID)); else { Util.ReportHandleToolClick(e.Tool,PartInventoryAdjustmentDetailedReportData.ReportKey, PartInventoryAdjustmentDetailedReportData.GetItem(this.mPartInventoryAdjustment.ID)); } Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], PartInventoryAdjustmentList.ReportKey, PartInventoryAdjustmentDetailedReportData.ReportKey); break; } } } #endregion Toolbar menu items #region Form UI / Business object synchronization /// /// Synchronize the state of the UI to the BO's /// private void SyncUI() { //Ensure record history can't be clicked until date modified is not null tbManager.Tools["LT:UI.Command.RecordHistory"].SharedProps.Enabled=(mPartInventoryAdjustment.Created!=null); } /// /// When the application enters an idle state /// update the UI to reflect changs in BO status /// (required because grids don't tell the UI to update when they are /// bound to a business object and are edited) /// /// /// private void Application_Idle(object sender, EventArgs e) { SyncUI(); } #endregion #region Access rights /// /// Adapt UI to accomodate users security access level /// private void RestrictUI() { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("RestrictUI: " + ((SecurityLevelTypes)AyaBizUtils.Right("Object.PartInventoryAdjustment")).ToString()); bool bDelete=AyaBizUtils.Right("Object.PartInventoryAdjustment")== (int)SecurityLevelTypes.ReadWriteDelete; bool bReadOnly=AyaBizUtils.Right("Object.PartInventoryAdjustment") < (int)SecurityLevelTypes.ReadWrite; if (mViewOnlyMode) { bReadOnly = true; bDelete = false; } if(bDelete) { Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True; } else { Grid.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; } //Grids if(bReadOnly) { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; Grid.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False; } else { Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom; Grid.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.True; } tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!bReadOnly; //tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Visible=!bReadOnly; tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible=!bReadOnly; //Case 181 tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible=false; //DISABLE EDITABLE CONTROLS //Text editors edReasonForAdjustment.Enabled=!bReadOnly; dtDateAdjusted.Enabled=!bReadOnly; } #endregion #region Form DataBinding and BrokenRules handling /// /// Bind controls to business objects /// private void DataBind() { //case 1039 //log.Debug("DataBind"); //Subscribe to broken rules changed event OnBrokenRulesChanged mPartInventoryAdjustment.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged); //=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-= //Grids Util.BindField(Grid,"DataSource",mPartInventoryAdjustment,"Items"); //Dates Util.BindField(dtDateAdjusted,"Value", mPartInventoryAdjustment, "DateAdjusted"); //edit box Util.BindField(edReasonForAdjustment,"Text",mPartInventoryAdjustment,"ReasonForAdjustment"); //Bind IsDirty property to hidden checkbox to //ensure isdirtychanged event is available //to data binding infrastructure Util.BindField(ckIsDirty,"Checked",mPartInventoryAdjustment,"IsDirty"); //Setup initial link to broken rules OnBrokenRulesChanged(null,null); } /// /// Handle a change in broken rules /// /// /// private void OnBrokenRulesChanged(object sender, System.ComponentModel.ListChangedEventArgs e) { Util.BrokenRuleFeedback(this,mPartInventoryAdjustment,ErrorProvider); } #endregion #region GridBrokenRuleFeedBack /// /// Show error icons if rules broken /// /// /// private void Grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { Util.GridShowBrokenRulesErrorIcons(e); } //Tool tip to use for displaying broken rules private System.Windows.Forms.ToolTip tipError = new System.Windows.Forms.ToolTip(); /// /// Display broken rules in tool tip if hovering over /// error icon /// /// /// private void Grid_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e) { Util.GridShowBrokenRulesToolTip(e,tipError); } #endregion #region Business object editing / adding / deletion related code private PartInventoryAdjustment mPartInventoryAdjustment; /// /// PartInventoryAdjustment record to display /// set by caller /// public PartInventoryAdjustment PartInventoryAdjustmentToEdit { get { return mPartInventoryAdjustment; } set { mPartInventoryAdjustment=value; //mPartInventoryAdjustment.BeginEdit(); } } //Used to signal to main form that there are changes //which could affect it if true private bool mbChangesMade=false; public bool ChangesMade { get { return mbChangesMade; } } /// /// Update record and quit if requested /// /// /// True if handled, false if not handled private bool RecordUpdate(RecordActionType SaveType) { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("SaveHandler(Action="+SaveType.ToString()+")"); //switch the focus to a non-editable control //so that any changes in the current editable control //will get updated before attempting to save lblExpectedReceiveDate.Focus(); //Added by John Dec 2 2004 (catches change in grid when above is non focusable) Grid.UpdateData(); switch(SaveType) { // case RecordActionType.SaveAndExit: //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; //Save if necessary and exit if(mPartInventoryAdjustment.IsSavable) { mPartInventoryAdjustment.ApplyEdit(); mPartInventoryAdjustment.Save(); bClosingHandled=true; mbChangesMade=true; this.Close(); return true; } if(mPartInventoryAdjustment.IsDirty)//dirty and unsaveable due to broken rules { //expand all serial number rows //to point user in direction of broken rule //because that's the only possible broken rule //on a receipt Grid.Rows.ExpandAll(false); if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { bClosingHandled=true; this.Close(); return true; } else return false; } //not dirty so just exit bClosingHandled=true; this.Close(); return true; case RecordActionType.SaveOnly: if(mPartInventoryAdjustment.IsSavable) { //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; mPartInventoryAdjustment.ApplyEdit(); mPartInventoryAdjustment=(PartInventoryAdjustment)mPartInventoryAdjustment.Save(); DataBind(); mbChangesMade=true; mViewOnlyMode=true; RestrictUI(); return true; } return true; case RecordActionType.PromptToSave: //Prompt to save and save if //required if(mPartInventoryAdjustment.IsDirty) { DialogResult dr=Util.PromptForSave(); if(dr==DialogResult.Cancel) { //Cancel return false; } if(dr==DialogResult.Yes) { //Save before exit //warn user save is permanent, no going back... if(Util.PromptYesNoCancelFromLocaleKey("PurchaseOrderItem.Label.UI.SaveWarning")!=DialogResult.Yes) return false; if(mPartInventoryAdjustment.IsSavable) { mPartInventoryAdjustment.ApplyEdit(); mPartInventoryAdjustment.Save(); mbChangesMade=true; return true; } if(mPartInventoryAdjustment.IsDirty)//dirty and unsaveable due to broken rules { //expand all serial number rows //to point user in direction of broken rule //because that's the only possible broken rule //on a receipt Grid.Rows.ExpandAll(false); if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { return true; } else return false; } } } return true; } return false; } /// /// ///Creates a new PartInventoryAdjustment record and opens it for editing /// private void AddNewPartInventoryAdjustment() { //case 1039 //log.Debug("AddNewPartInventoryAdjustment"); try { mPartInventoryAdjustment=PartInventoryAdjustment.NewItem(); //mPartInventoryAdjustment.BeginEdit(); DataBind(); } catch(Exception ex) { //log.Error("AddNewPartInventoryAdjustment",ex); MessageBox.Show(ex.Message+"\r\n"+ex.Source); } } #endregion #region Grid Events /// /// Set the serial numbers as a pick list /// or as a text entry depending /// called by cell item changed in grid /// for quantity change /// /// If Guid.Empty signifies don't use a picklist public void SetSerialNumber(Guid PartID,Guid PartWarehouseID, RowsCollection SerialRows) { //case 1039 //log.Debug("SetSerialNumber"); if(PartID==Guid.Empty) { foreach(UltraGridRow r in SerialRows) { r.Cells["SerialNumber"].ValueList=null; r.Cells["SerialNumber"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Edit; } return; } //Is there a valid warehouse? if(PartWarehouseID==Guid.Empty) return; //Fetch serial numbers for specified part and warehouse ValueList vl= new ValueList(); PartSerialPickList ps=PartSerialPickList.GetList(PartID,PartWarehouseID); //fill list foreach(PartSerialPickList.PartSerialPickListInfo i in ps) { vl.ValueListItems.Add(i.ID,i.SerialNumber); } foreach(UltraGridRow r in SerialRows) { r.Cells["SerialNumber"].ValueList=vl; r.Cells["SerialNumber"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList) r.Cells["SerialNumber"].Column.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend; } } /// /// /// /// /// private void Grid_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { //Adjust serial number row field based on users selections //Is it serialized? //(this is set by before cell update in business object //so by the time we get here it's got a serial number row if it's a serialized part //or it doesn't if it isn't) if(!e.Cell.Row.HasChild()) goto QuantityDone; //Is it zero quantity? if((decimal)e.Cell.Row.Cells["QuantityAdjustment"].Value==0) { goto QuantityDone; } //Is it negative? if((decimal)e.Cell.Row.Cells["QuantityAdjustment"].Value<0) { SetSerialNumber((Guid)e.Cell.Row.Cells["PartID"].Value,(Guid)e.Cell.Row.Cells["PartWarehouseID"].Value,e.Cell.Row.ChildBands[0].Rows); } else { SetSerialNumber(Guid.Empty,Guid.Empty,e.Cell.Row.ChildBands[0].Rows); } //expand to show serial numbers e.Cell.Row.Expanded=true; QuantityDone: //Set broken rule on identical serial number in same parts mPartInventoryAdjustment.CheckForDuplicateSerialNumbers(); //set broken rule on identical part/warehouse entries mPartInventoryAdjustment.Items.CheckForDuplicateParts(); return; } /// /// /// /// /// private void Grid_BeforeCellUpdate(object sender, Infragistics.Win.UltraWinGrid.BeforeCellUpdateEventArgs e) { //Don't allow the entry of zero quantity adjustments if("QuantityAdjustment"==e.Cell.Column.Key) { //Is it zero? if((decimal)e.NewValue==0) { e.Cancel=true; return; } } } private void Grid_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e) { //case 1039 //log.Debug("Grid_BeforeRowInsert"); mPartInventoryAdjustment.Items.Add(mPartInventoryAdjustment); //Don't allow the default behaviour of the row insert e.Cancel=true; } #endregion #region Grid Initialization /// /// Get grid ready /// private void InitializeGrid() { //case 1039 //log.Debug("InitializeGrid"); Grid.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle; Util.FetchGridLayout("PartInventoryAdjustmentItems","",Grid); Util.GridPreLocalize("PartInventoryAdjustmentItem",Grid.DisplayLayout.Bands[0]); Util.GridPreLocalize("PartInventoryAdjustmentItem",Grid.DisplayLayout.Bands[1]); //Localize headers properly Grid.DisplayLayout.Bands[0].Columns["PartWarehouseID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.PartWarehouse"); Grid.DisplayLayout.Bands[0].Columns["PartID"].Header.Caption=Util.LocaleText.GetLocalizedText("O.Part"); Util.GridHideEditableBizObjectInternalFields(Grid); //hide band 0 items Grid.DisplayLayout.Bands[0].Columns["PartInventoryAdjustmentID"].Hidden=true; //Hide band 1 (all but serial number) items //Hide unwanted workorder item ScheduledUsers fields in that grid foreach(UltraGridColumn c in Grid.DisplayLayout.Bands[1].Columns) { c.Hidden=true; } Grid.DisplayLayout.Bands[1].Columns["SerialNumber"].Hidden=false; Grid.DisplayLayout.Bands[0].Columns["QuantityAdjustment"].Format = "g29"; //Don't allow user to add Band 1 serial numbers Grid.DisplayLayout.Bands[1].Override.AllowAddNew=AllowAddNew.No; //------------------------------------------------------------------------------------------------- PopulateGridValueLists(); //Allow empty string entry on grid Util.SetTextColumnsNullable(Grid); } /// /// Populate the drop down lists inside the grid /// so they display and can select the correct underlying /// value /// private void PopulateGridValueLists() { //case 1039 //log.Debug("PopulateGridValueLists"); //Empty the existing value lists if present Grid.DisplayLayout.ValueLists.Clear(); //Populate value lists ValueList vl=Grid.DisplayLayout.ValueLists.Add("Parts"); foreach(PartPickList.PartPickListInfo ppi in mPartList) { if(ppi.Active) vl.ValueListItems.Add(ppi.ID,ppi.DisplayName(Util.GlobalSettings.DefaultPartDisplayFormat)); } vl.SortStyle=ValueListSortStyle.Ascending; //Bind value lists to correct columns in grid Grid.DisplayLayout.Bands[0].Columns["PartID"].ValueList=Grid.DisplayLayout.ValueLists["Parts"]; //Set column to dropdownlist style so that user can not type an invalid value in a cell //but must select from the list only Grid.DisplayLayout.Bands[0].Columns["PartID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList) Grid.DisplayLayout.Bands[0].Columns["PartID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend; //------------------------------------------------------------------------------------------------- //Warehouses vl=Grid.DisplayLayout.ValueLists.Add("Warehouses"); //NVCHANGED GenericNVList l=GenericNVList.GetList("aPartWarehouse","aID","aName",true,false, true); //Loop through the items in the list and put them //into the valuelist for(int x=0;x /// Case 37 /// /// /// /// protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //Short circuit: //Only process modified keystrokes (i.e. when a modifier like ctrl-alt-or shift is also //being held down if (ModifierKeys == Keys.None) return base.ProcessCmdKey(ref msg, keyData); switch (Util.HotKeys(keyData)) { //Close form case HotKeyAction.CloseForm: this.Close(); return true; } return base.ProcessCmdKey(ref msg, keyData); } #endregion } }