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 log4net; namespace AyaNova { /// /// Summary description for UnitModelInfoForm. /// public class UnitModelInfoForm : 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 Infragistics.Win.UltraWinEditors.UltraTextEditor edName; private Infragistics.Win.Misc.UltraLabel lblName; private System.Windows.Forms.ErrorProvider ErrorProvider; private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckActive; private System.Windows.Forms.Panel panelLeft; private System.Windows.Forms.Panel panelRight; private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager; private System.Windows.Forms.Panel panelCustom; private Infragistics.Win.UltraWinGrid.UltraGrid gridCustom; private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckDiscontinued; private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckLifeTimeWarranty; private Infragistics.Win.Misc.UltraLabel lblWarrantyTerms; private Infragistics.Win.Misc.UltraLabel lblNotes; private Infragistics.Win.Misc.UltraLabel lblWarrantyLength; private Infragistics.Win.Misc.UltraLabel lblUnitModelNumber; private GZTW.WinForm.Controls.GZUltraComboEditor cbVendorID; private Infragistics.Win.Misc.UltraLabel lblIntroducedDate; private Infragistics.Win.Misc.UltraLabel lblDiscontinuedDate; private GZTW.WinForm.Controls.GZUltraComboEditor cbUnitModelCategoryID; private Infragistics.Win.UltraWinEditors.UltraTextEditor edModelNumber; private GZTW.WinForm.Controls.GZDateTimePicker dtDiscontinuedDate; private GZTW.WinForm.Controls.GZDateTimePicker dtIntroducedDate; private Infragistics.Win.UltraWinEditors.UltraTextEditor edWarrantyLength; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _UnitModelInfoForm_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _UnitModelInfoForm_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _UnitModelInfoForm_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _UnitModelInfoForm_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraButton btnCategoryID; private Infragistics.Win.Misc.UltraButton btnVendorID; private Infragistics.Win.UltraWinEditors.UltraTextEditor edWarrantyTerms; private Infragistics.Win.UltraWinEditors.UltraTextEditor edNotes; private Infragistics.Win.UltraWinEditors.UltraTextEditor edModelUPC; private Infragistics.Win.Misc.UltraLabel lblModelUPC; private System.Windows.Forms.HelpProvider helpProvider1; private System.ComponentModel.IContainer components; public UnitModelInfoForm() { // // 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("UnitModelEntryMenuBar"); 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:AssignedDoc.Label.List"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:AssignedDoc.Label.List"); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance(); 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 appearance13 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance14 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool16 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.Appearance appearance15 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance16 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); this.ckIsDirty = new System.Windows.Forms.CheckBox(); this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this.panelLeft = new System.Windows.Forms.Panel(); this.edModelUPC = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblModelUPC = new Infragistics.Win.Misc.UltraLabel(); this.edNotes = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.btnVendorID = new Infragistics.Win.Misc.UltraButton(); this.btnCategoryID = new Infragistics.Win.Misc.UltraButton(); this.cbUnitModelCategoryID = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.edModelNumber = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblUnitModelNumber = new Infragistics.Win.Misc.UltraLabel(); this.edName = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblName = new Infragistics.Win.Misc.UltraLabel(); this.ckActive = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); this.cbVendorID = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.lblNotes = new Infragistics.Win.Misc.UltraLabel(); this.lblWarrantyTerms = new Infragistics.Win.Misc.UltraLabel(); this.edWarrantyLength = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ckLifeTimeWarranty = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); this.lblWarrantyLength = new Infragistics.Win.Misc.UltraLabel(); this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.panelRight = new System.Windows.Forms.Panel(); this.edWarrantyTerms = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.dtIntroducedDate = new GZTW.WinForm.Controls.GZDateTimePicker(); this.dtDiscontinuedDate = new GZTW.WinForm.Controls.GZDateTimePicker(); this.lblIntroducedDate = new Infragistics.Win.Misc.UltraLabel(); this.lblDiscontinuedDate = new Infragistics.Win.Misc.UltraLabel(); this.ckDiscontinued = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); this.panelCustom = new System.Windows.Forms.Panel(); this.gridCustom = new Infragistics.Win.UltraWinGrid.UltraGrid(); this._UnitModelInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._UnitModelInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._UnitModelInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._UnitModelInfoForm_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.edModelUPC)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbUnitModelCategoryID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edModelNumber)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ckActive)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbVendorID)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edWarrantyLength)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ckLifeTimeWarranty)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit(); this.panelRight.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.edWarrantyTerms)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dtIntroducedDate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dtDiscontinuedDate)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ckDiscontinued)).BeginInit(); this.panelCustom.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.gridCustom)).BeginInit(); this.SuspendLayout(); // // ckIsDirty // this.ckIsDirty.Location = new System.Drawing.Point(-336, 28); this.ckIsDirty.Name = "ckIsDirty"; this.ckIsDirty.Size = new System.Drawing.Size(184, 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, buttonTool15, buttonTool3, buttonTool4, buttonTool5, buttonTool6, buttonTool7}); ultraToolbar1.Text = "UnitModelEntryMenuBar"; 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; buttonTool8.SharedPropsInternal.AccessibleDescription = "recorddd"; appearance3.Image = global::AyaNova.Resource1.SaveExit32; buttonTool8.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = global::AyaNova.Resource1.SaveExit16; buttonTool8.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool8.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose"; appearance5.Image = global::AyaNova.Resource1.Documents32; buttonTool9.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = global::AyaNova.Resource1.Documents16; buttonTool9.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; buttonTool9.SharedPropsInternal.Caption = "LT:AssignedDoc.Label.List"; appearance7.Image = global::AyaNova.Resource1.RecordHistory32; buttonTool10.SharedPropsInternal.AppearancesLarge.Appearance = appearance7; appearance8.Image = global::AyaNova.Resource1.RecordHistory16; buttonTool10.SharedPropsInternal.AppearancesSmall.Appearance = appearance8; buttonTool10.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory"; buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.Save"; buttonTool11.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance9.Image = global::AyaNova.Resource1.SaveNew32; buttonTool12.SharedPropsInternal.AppearancesLarge.Appearance = appearance9; appearance10.Image = global::AyaNova.Resource1.SaveNew16; buttonTool12.SharedPropsInternal.AppearancesSmall.Appearance = appearance10; buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.SaveNew"; buttonTool13.SharedPropsInternal.Caption = "LT:UI.Command.Close"; buttonTool13.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance11.Image = global::AyaNova.Resource1.Delete32; buttonTool14.SharedPropsInternal.AppearancesLarge.Appearance = appearance11; appearance12.Image = global::AyaNova.Resource1.Delete16; buttonTool14.SharedPropsInternal.AppearancesSmall.Appearance = appearance12; buttonTool14.SharedPropsInternal.Caption = "LT:UI.Command.Delete"; appearance13.Image = global::AyaNova.Resource1.Print32; popupMenuTool2.SharedPropsInternal.AppearancesLarge.Appearance = appearance13; appearance14.Image = global::AyaNova.Resource1.Print16; popupMenuTool2.SharedPropsInternal.AppearancesSmall.Appearance = appearance14; popupMenuTool2.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print"; popupMenuTool2.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars; popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { listTool2}); appearance15.Image = global::AyaNova.Resource1.Wiki32; buttonTool16.SharedPropsInternal.AppearancesLarge.Appearance = appearance15; appearance16.Image = global::AyaNova.Resource1.Wiki16; buttonTool16.SharedPropsInternal.AppearancesSmall.Appearance = appearance16; buttonTool16.SharedPropsInternal.Caption = "LT:O.WikiPage"; this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool8, buttonTool9, buttonTool10, buttonTool11, buttonTool12, buttonTool13, buttonTool14, listTool1, popupMenuTool2, buttonTool16}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // panelLeft // this.panelLeft.Controls.Add(this.edModelUPC); this.panelLeft.Controls.Add(this.lblModelUPC); this.panelLeft.Controls.Add(this.edNotes); this.panelLeft.Controls.Add(this.btnVendorID); this.panelLeft.Controls.Add(this.btnCategoryID); this.panelLeft.Controls.Add(this.cbUnitModelCategoryID); this.panelLeft.Controls.Add(this.edModelNumber); this.panelLeft.Controls.Add(this.lblUnitModelNumber); this.panelLeft.Controls.Add(this.edName); this.panelLeft.Controls.Add(this.lblName); this.panelLeft.Controls.Add(this.ckActive); this.panelLeft.Controls.Add(this.cbVendorID); this.panelLeft.Controls.Add(this.lblNotes); 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, 382); this.panelLeft.TabIndex = 0; // // edModelUPC // this.edModelUPC.Location = new System.Drawing.Point(192, 194); this.edModelUPC.Name = "edModelUPC"; this.edModelUPC.Size = new System.Drawing.Size(102, 24); this.edModelUPC.TabIndex = 6; // // lblModelUPC // this.lblModelUPC.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblModelUPC.Location = new System.Drawing.Point(10, 194); this.lblModelUPC.Name = "lblModelUPC"; this.lblModelUPC.Size = new System.Drawing.Size(158, 24); this.lblModelUPC.TabIndex = 125; this.lblModelUPC.Tag = ""; this.lblModelUPC.Text = "LT:UnitModel.Label.UPC"; this.lblModelUPC.WrapText = false; // // edNotes // this.edNotes.AcceptsReturn = true; this.edNotes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edNotes.Location = new System.Drawing.Point(10, 249); this.edNotes.Multiline = true; this.edNotes.Name = "edNotes"; this.edNotes.Size = new System.Drawing.Size(284, 120); this.edNotes.TabIndex = 7; // // btnVendorID // appearance1.TextHAlignAsString = "Left"; this.btnVendorID.Appearance = appearance1; this.btnVendorID.Location = new System.Drawing.Point(10, 157); this.btnVendorID.Name = "btnVendorID"; this.btnVendorID.Size = new System.Drawing.Size(158, 24); this.btnVendorID.TabIndex = 5; this.btnVendorID.Tag = ""; this.btnVendorID.Text = "LT:O.Vendor"; this.btnVendorID.UseHotTracking = Infragistics.Win.DefaultableBoolean.True; this.btnVendorID.WrapText = false; this.btnVendorID.Click += new System.EventHandler(this.btnVendorID_Click); // // btnCategoryID // appearance2.TextHAlignAsString = "Left"; this.btnCategoryID.Appearance = appearance2; this.btnCategoryID.Location = new System.Drawing.Point(10, 120); this.btnCategoryID.Name = "btnCategoryID"; this.btnCategoryID.Size = new System.Drawing.Size(158, 24); this.btnCategoryID.TabIndex = 3; this.btnCategoryID.Tag = ""; this.btnCategoryID.Text = "LT:O.UnitModelCategory"; this.btnCategoryID.UseHotTracking = Infragistics.Win.DefaultableBoolean.True; this.btnCategoryID.WrapText = false; this.btnCategoryID.Click += new System.EventHandler(this.btnCategoryID_Click); // // cbUnitModelCategoryID // this.cbUnitModelCategoryID.Location = new System.Drawing.Point(192, 120); this.cbUnitModelCategoryID.Name = "cbUnitModelCategoryID"; this.cbUnitModelCategoryID.Size = new System.Drawing.Size(106, 24); this.cbUnitModelCategoryID.TabIndex = 2; this.cbUnitModelCategoryID.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbUnitModelCategoryID_NeedMoreData); // // edModelNumber // this.edModelNumber.Location = new System.Drawing.Point(192, 83); this.edModelNumber.Name = "edModelNumber"; this.edModelNumber.Size = new System.Drawing.Size(106, 24); this.edModelNumber.TabIndex = 1; // // lblUnitModelNumber // this.lblUnitModelNumber.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblUnitModelNumber.Location = new System.Drawing.Point(10, 83); this.lblUnitModelNumber.Name = "lblUnitModelNumber"; this.lblUnitModelNumber.Size = new System.Drawing.Size(158, 24); this.lblUnitModelNumber.TabIndex = 94; this.lblUnitModelNumber.Tag = ""; this.lblUnitModelNumber.Text = "LT:UnitModel.Label.ModelNumber"; this.lblUnitModelNumber.WrapText = false; // // edName // this.edName.Location = new System.Drawing.Point(192, 46); this.edName.Name = "edName"; this.edName.Size = new System.Drawing.Size(106, 24); this.edName.TabIndex = 0; // // lblName // this.lblName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblName.Location = new System.Drawing.Point(10, 46); this.lblName.Name = "lblName"; this.lblName.Size = new System.Drawing.Size(158, 24); this.lblName.TabIndex = 92; this.lblName.Tag = ""; this.lblName.Text = "LT:UnitModel.Label.Name"; this.lblName.WrapText = false; // // ckActive // this.ckActive.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ckActive.Checked = true; this.ckActive.CheckState = System.Windows.Forms.CheckState.Checked; this.ckActive.Location = new System.Drawing.Point(10, 18); this.ckActive.Name = "ckActive"; this.ckActive.Size = new System.Drawing.Size(259, 19); this.ckActive.TabIndex = 8; this.ckActive.Tag = ""; this.ckActive.Text = "LT:Common.Label.Active"; // // cbVendorID // this.cbVendorID.Location = new System.Drawing.Point(192, 157); this.cbVendorID.Name = "cbVendorID"; this.cbVendorID.Size = new System.Drawing.Size(106, 24); this.cbVendorID.TabIndex = 4; this.cbVendorID.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbVendorID_NeedMoreData); // // lblNotes // this.lblNotes.Location = new System.Drawing.Point(10, 231); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(249, 18); this.lblNotes.TabIndex = 124; this.lblNotes.Tag = ""; this.lblNotes.Text = "LT:UnitModel.Label.Notes"; // // lblWarrantyTerms // this.lblWarrantyTerms.Location = new System.Drawing.Point(10, 231); this.lblWarrantyTerms.Name = "lblWarrantyTerms"; this.lblWarrantyTerms.Size = new System.Drawing.Size(288, 18); this.lblWarrantyTerms.TabIndex = 124; this.lblWarrantyTerms.Tag = ""; this.lblWarrantyTerms.Text = "LT:UnitModel.Label.WarrantyTerms"; // // edWarrantyLength // this.edWarrantyLength.Location = new System.Drawing.Point(192, 194); this.edWarrantyLength.Name = "edWarrantyLength"; this.edWarrantyLength.Size = new System.Drawing.Size(106, 24); this.edWarrantyLength.TabIndex = 4; // // ckLifeTimeWarranty // this.ckLifeTimeWarranty.Location = new System.Drawing.Point(10, 157); this.ckLifeTimeWarranty.Name = "ckLifeTimeWarranty"; this.ckLifeTimeWarranty.Size = new System.Drawing.Size(288, 18); this.ckLifeTimeWarranty.TabIndex = 3; this.ckLifeTimeWarranty.Tag = ""; this.ckLifeTimeWarranty.Text = "LT:UnitModel.Label.LifeTimeWarranty"; // // lblWarrantyLength // this.lblWarrantyLength.Location = new System.Drawing.Point(10, 194); this.lblWarrantyLength.Name = "lblWarrantyLength"; this.lblWarrantyLength.Size = new System.Drawing.Size(168, 24); this.lblWarrantyLength.TabIndex = 125; this.lblWarrantyLength.Tag = ""; this.lblWarrantyLength.Text = "LT:UnitModel.Label.WarrantyLength"; this.lblWarrantyLength.WrapText = false; // // ErrorProvider // this.ErrorProvider.ContainerControl = this; // // panelRight // this.panelRight.Controls.Add(this.edWarrantyTerms); this.panelRight.Controls.Add(this.dtIntroducedDate); this.panelRight.Controls.Add(this.dtDiscontinuedDate); this.panelRight.Controls.Add(this.lblIntroducedDate); this.panelRight.Controls.Add(this.lblDiscontinuedDate); this.panelRight.Controls.Add(this.ckDiscontinued); this.panelRight.Controls.Add(this.ckLifeTimeWarranty); this.panelRight.Controls.Add(this.edWarrantyLength); this.panelRight.Controls.Add(this.lblWarrantyLength); this.panelRight.Controls.Add(this.lblWarrantyTerms); 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(312, 382); this.panelRight.TabIndex = 101; // // edWarrantyTerms // this.edWarrantyTerms.AcceptsReturn = true; this.edWarrantyTerms.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edWarrantyTerms.Location = new System.Drawing.Point(6, 249); this.edWarrantyTerms.Multiline = true; this.edWarrantyTerms.Name = "edWarrantyTerms"; this.edWarrantyTerms.Size = new System.Drawing.Size(292, 120); this.edWarrantyTerms.TabIndex = 5; // // dtIntroducedDate // this.dtIntroducedDate.GZEnabled = true; this.dtIntroducedDate.GZReadOnly = false; this.dtIntroducedDate.Location = new System.Drawing.Point(192, 46); this.dtIntroducedDate.Name = "dtIntroducedDate"; this.dtIntroducedDate.Size = new System.Drawing.Size(106, 24); this.dtIntroducedDate.TabIndex = 0; // // dtDiscontinuedDate // this.dtDiscontinuedDate.GZEnabled = true; this.dtDiscontinuedDate.GZReadOnly = false; this.dtDiscontinuedDate.Location = new System.Drawing.Point(192, 120); this.dtDiscontinuedDate.Name = "dtDiscontinuedDate"; this.dtDiscontinuedDate.Size = new System.Drawing.Size(106, 24); this.dtDiscontinuedDate.TabIndex = 2; // // lblIntroducedDate // this.lblIntroducedDate.Location = new System.Drawing.Point(10, 46); this.lblIntroducedDate.Name = "lblIntroducedDate"; this.lblIntroducedDate.Size = new System.Drawing.Size(168, 24); this.lblIntroducedDate.TabIndex = 127; this.lblIntroducedDate.Tag = ""; this.lblIntroducedDate.Text = "LT:UnitModel.Label.IntroducedDate"; this.lblIntroducedDate.WrapText = false; // // lblDiscontinuedDate // this.lblDiscontinuedDate.Location = new System.Drawing.Point(10, 120); this.lblDiscontinuedDate.Name = "lblDiscontinuedDate"; this.lblDiscontinuedDate.Size = new System.Drawing.Size(168, 24); this.lblDiscontinuedDate.TabIndex = 125; this.lblDiscontinuedDate.Tag = ""; this.lblDiscontinuedDate.Text = "LT:UnitModel.Label.DiscontinuedDate"; this.lblDiscontinuedDate.WrapText = false; // // ckDiscontinued // this.ckDiscontinued.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ckDiscontinued.Location = new System.Drawing.Point(10, 83); this.ckDiscontinued.Name = "ckDiscontinued"; this.ckDiscontinued.Size = new System.Drawing.Size(288, 19); this.ckDiscontinued.TabIndex = 1; this.ckDiscontinued.Tag = ""; this.ckDiscontinued.Text = "LT:UnitModel.Label.Discontinued"; // // panelCustom // this.panelCustom.Controls.Add(this.gridCustom); this.panelCustom.Dock = System.Windows.Forms.DockStyle.Right; this.panelCustom.Location = new System.Drawing.Point(609, 43); this.panelCustom.Name = "panelCustom"; this.panelCustom.Size = new System.Drawing.Size(269, 382); this.panelCustom.TabIndex = 108; // // gridCustom // this.gridCustom.Cursor = System.Windows.Forms.Cursors.Default; this.gridCustom.Dock = System.Windows.Forms.DockStyle.Fill; this.gridCustom.Location = new System.Drawing.Point(0, 0); this.gridCustom.Name = "gridCustom"; this.gridCustom.Size = new System.Drawing.Size(269, 382); this.gridCustom.TabIndex = 0; this.gridCustom.Tag = ""; this.gridCustom.Text = "LT:ObjectCustomField.Label.CustomGrid"; this.gridCustom.AfterCellUpdate += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridCustom_AfterCellUpdate); // // _UnitModelInfoForm_Toolbars_Dock_Area_Left // this._UnitModelInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._UnitModelInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._UnitModelInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._UnitModelInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._UnitModelInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43); this._UnitModelInfoForm_Toolbars_Dock_Area_Left.Name = "_UnitModelInfoForm_Toolbars_Dock_Area_Left"; this._UnitModelInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 382); this._UnitModelInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // _UnitModelInfoForm_Toolbars_Dock_Area_Right // this._UnitModelInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._UnitModelInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._UnitModelInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._UnitModelInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._UnitModelInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(878, 43); this._UnitModelInfoForm_Toolbars_Dock_Area_Right.Name = "_UnitModelInfoForm_Toolbars_Dock_Area_Right"; this._UnitModelInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 382); this._UnitModelInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _UnitModelInfoForm_Toolbars_Dock_Area_Top // this._UnitModelInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._UnitModelInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._UnitModelInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._UnitModelInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._UnitModelInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._UnitModelInfoForm_Toolbars_Dock_Area_Top.Name = "_UnitModelInfoForm_Toolbars_Dock_Area_Top"; this._UnitModelInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(878, 43); this._UnitModelInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _UnitModelInfoForm_Toolbars_Dock_Area_Bottom // this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 425); this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.Name = "_UnitModelInfoForm_Toolbars_Dock_Area_Bottom"; this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(878, 0); this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // UnitModelInfoForm // this.AllowDrop = true; this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(878, 425); this.Controls.Add(this.panelCustom); this.Controls.Add(this.panelRight); this.Controls.Add(this.panelLeft); this.Controls.Add(this.ckIsDirty); this.Controls.Add(this._UnitModelInfoForm_Toolbars_Dock_Area_Left); this.Controls.Add(this._UnitModelInfoForm_Toolbars_Dock_Area_Right); this.Controls.Add(this._UnitModelInfoForm_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._UnitModelInfoForm_Toolbars_Dock_Area_Top); this.helpProvider1.SetHelpKeyword(this, ""); this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); this.MinimumSize = new System.Drawing.Size(614, 462); this.Name = "UnitModelInfoForm"; this.helpProvider1.SetShowHelp(this, true); this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.Closing += new System.ComponentModel.CancelEventHandler(this.UnitModelInfoForm_Closing); this.Load += new System.EventHandler(this.UnitModelInfoForm_Load); this.SizeChanged += new System.EventHandler(this.UnitModelInfoForm_SizeChanged); this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Form_DragDrop); this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form_DragEnter); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit(); this.panelLeft.ResumeLayout(false); this.panelLeft.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edModelUPC)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cbUnitModelCategoryID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edModelNumber)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ckActive)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cbVendorID)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edWarrantyLength)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ckLifeTimeWarranty)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit(); this.panelRight.ResumeLayout(false); this.panelRight.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.edWarrantyTerms)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dtIntroducedDate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dtDiscontinuedDate)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ckDiscontinued)).EndInit(); this.panelCustom.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.gridCustom)).EndInit(); this.ResumeLayout(false); } #endregion // __ _ _ ___ ____ __ __ __ __ __ ___ ___ // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _) // ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _) // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___) // #region Form Load / Close //variable to hold user form settings //UIUserFormSetting mFormSetting; /// /// Prepare the form /// /// /// private void UnitModelInfoForm_Load(object sender, System.EventArgs e) { // // helpProvider1 // this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "unit_models.htm"; //case 1039 //log.Debug("UnitModelInfoForm_Load"); Cursor.Current = Cursors.WaitCursor; this.Visible=false; this.Icon = Resource1.UnitModel16icon; //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 UnitModel edit screen from elsewhere in the program) if(AyaBizUtils.Right("Object.UnitModel")< (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.UnitModel"))); this.Close(); return; } InitializeComboBoxes(); DataBind(); Util.LoadFormCustomization("UnitModelInfo", this, tbManager, false); Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.UnitModel, mUnitModel, null));//case 941 Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810 Util.Localize(this); //restrict UI based on security settings RestrictUI(); if (AyaBizUtils.Right("Object.Report") < (int)SecurityLevelTypes.ReadOnly) { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = false; }//LT:UI.Toolbar.Print else { tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = true; Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], UnitModelList.ReportKey, UnitModelList.DetailedReportKey); } Cursor.Current = Cursors.Default; //Case 152 (new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst); Application.Idle+= new EventHandler(Application_Idle); 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 UnitModelInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("UnitModelInfoForm_Closing"); if(!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); Util.SaveFormCustomization("UnitModelInfo", this, tbManager, false); } #endregion #region Form Sizing /// /// Adjust the layout proportionately as it's sized by user /// /// /// private void UnitModelInfoForm_SizeChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("UnitModelInfoForm_SizeChanged"); int nWidth=0; int nHeight=(this.DisplayRectangle.Height/3)*2; if(bShowCustomFields) //there are three panels nWidth=this.DisplayRectangle.Width/3; else//there are two panels nWidth=this.DisplayRectangle.Width/2; this.panelLeft.Width=nWidth; this.panelRight.Width=nWidth; if(bShowCustomFields) this.panelCustom.Width=nWidth; this.panelLeft.Height=nHeight; this.panelRight.Height=nHeight; this.panelCustom.Height=nHeight; //Size of controls in panel //One third int nLeftWidth=(this.panelLeft.Width/3); //two thirds int nRightWidth=this.panelLeft.Width-nLeftWidth; //make room for error icons nRightWidth-=16; //case 3179 overlapping int nGap = 16; //Size and align controls in Left panel lblName.Width = nLeftWidth - nGap; edName.Left=nLeftWidth; edName.Width=nRightWidth; lblUnitModelNumber.Width = nLeftWidth - nGap; edModelNumber.Left=nLeftWidth; edModelNumber.Width=nRightWidth; btnCategoryID.Width = nLeftWidth - nGap; cbUnitModelCategoryID.Left=nLeftWidth; cbUnitModelCategoryID.Width=nRightWidth; btnVendorID.Width = nLeftWidth - nGap; cbVendorID.Left=nLeftWidth; cbVendorID.Width=nRightWidth; lblModelUPC.Width = nLeftWidth - nGap; edModelUPC.Left=nLeftWidth; edModelUPC.Width=nRightWidth; //Size and align controls in right panel nRightWidth=nRightWidth-8; lblIntroducedDate.Width = nLeftWidth - nGap; dtIntroducedDate.Left=nLeftWidth+8; dtIntroducedDate.Width=nRightWidth; lblDiscontinuedDate.Width = nLeftWidth - nGap; dtDiscontinuedDate.Left=nLeftWidth+8; dtDiscontinuedDate.Width=nRightWidth; lblWarrantyLength.Width = nLeftWidth - nGap; edWarrantyLength.Left=nLeftWidth+8; edWarrantyLength.Width=nRightWidth; } #endregion #region Form UI commands #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:AssignedDoc.Label.List": // ButtonTool DocsForm d=new DocsForm(); d.DocsToEdit=mUnitModel.Docs; d.RootObjectID=mUnitModel.ID; d.ExactObjectType = d.RootObjectType = RootObjectTypes.UnitModel; d.ShowDialog(); break; case "LT:UI.Command.RecordHistory": // ButtonTool RecordHistoryForm RH=new RecordHistoryForm(mUnitModel.Creator,mUnitModel.Modifier,mUnitModel.Created,mUnitModel.Modified); RH.ShowDialog(); RH.Dispose(); break; case "LT:UI.Command.Save": // ButtonTool RecordUpdate(RecordActionType.SaveOnly); break; case "LT:UI.Command.SaveNew": // ButtonTool RecordUpdate(RecordActionType.SaveAndNew); break; case "LT:UI.Command.Close": // ButtonTool this.Close(); break; case "LT:UI.Command.Delete": // ButtonTool RecordUpdate(RecordActionType.DeleteAndExit); break; case "REPORTLIST": { //case 3736 RecordUpdate(RecordActionType.PromptToSave); if (Util.ReportHandleToolClickIsSummary(e.Tool)) Util.ReportHandleToolClick(e.Tool, UnitModelList.ReportKey, UnitModelList.GetListForSingleItem(mUnitModel.ID)); //else //{ // Util.ReportHandleToolClick(e.Tool, MemoListDetailed.ReportKey, // MemoListDetailed.GetListForSingleItem(mMemo.ID)); //} Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], UnitModelList.ReportKey, UnitModelList.DetailedReportKey); break; } case "LT:O.WikiPage": { Util.OpenWikiPage(RootObjectTypes.UnitModel, mUnitModel.ID, false); break; } } } #endregion Toolbar menu items #region hyperButtons private void btnCategoryID_Click(object sender, System.EventArgs e) { //case 1039 //log.Debug("btnCategoryID_Click"); GenericListForm g = new GenericListForm(); UnitModelCategories o = UnitModelCategories.GetItems(); g.SelectedRecordID=cbUnitModelCategoryID.Value; g.GridDataSource=o; g.ShowDialog(); if(g.ChangesMade) { mUnitModel.UnitModelCategoryID=Guid.Empty; Util.FillGZComboBoxWithNameIDList("UnitModelCategory",cbUnitModelCategoryID,false,Guid.Empty,false); mUnitModel.UnitModelCategoryID=(Guid)g.SelectedRecordID; } } private void btnVendorID_Click(object sender, System.EventArgs e) { //case 1039 //log.Debug("btnVendorID_Click"); VendorInfoForm cf=new VendorInfoForm(VendorTypes.All); if(cbVendorID.Value!=null && (Guid)cbVendorID.Value!=Guid.Empty) { cf.VendorToEdit=Vendor.GetItem((Guid)cbVendorID.Value); } else { if(AyaBizUtils.Right("Object.Vendor")< (int)SecurityLevelTypes.ReadWrite) { //case 1039 //log.Debug("No Vendor selected to view and user has no rights to create a new one."); return; } cf.VendorToEdit=Vendor.NewItem(); } cf.Visible=false; cf.ShowDialog(); if(cf.ChangesMade) { mUnitModel.VendorID=Guid.Empty; Util.FillGZComboBoxWithNameIDList("Vendor",cbVendorID,false,Guid.Empty,false); mUnitModel.VendorID=cf.VendorToEdit.ID; } } #endregion hyperButtons #region Visibility of warranty private void ckDiscontinued_AfterCheckStateChanged(object sender, System.EventArgs e) { } #endregion #endregion #region Form UI / Business object synchronization private int mLastDocsCount=-1; /// /// Synchronize the state of the UI to the BO's /// private void SyncUI() { //display name in title bar this.Text=mUnitModel.Name; if(AyaBizUtils.Right("Object.UnitModel")> (int)SecurityLevelTypes.ReadOnly) { if(ckLifeTimeWarranty.Checked) { edWarrantyLength.Enabled=false; lblWarrantyLength.Enabled=false; } else { edWarrantyLength.Enabled=true; lblWarrantyLength.Enabled=true; } if(ckDiscontinued.Checked) { dtDiscontinuedDate.Enabled=true; lblDiscontinuedDate.Enabled=true; } else { dtDiscontinuedDate.Enabled=false; lblDiscontinuedDate.Enabled=false; } } //Indicate if any docs in icon //case 918 if (this.mLastDocsCount != mUnitModel.Docs.Count) { this.mLastDocsCount = mUnitModel.Docs.Count; Util.AssignedDocsSetImage(tbManager, (mLastDocsCount > 0)); } } /// /// 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(); } /// /// Adapt UI to accomodate users security access level /// by default form is set with full rights in mind /// so this code just needs to restrict them as required /// private void RestrictUI() { //case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("RestrictUI: " + ((SecurityLevelTypes)AyaBizUtils.Right("Object.UnitModel")).ToString()); bool bDelete=AyaBizUtils.Right("Object.UnitModel")== (int)SecurityLevelTypes.ReadWriteDelete; bool bReadOnly=AyaBizUtils.Right("Object.UnitModel") < (int)SecurityLevelTypes.ReadWrite; tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=bDelete; 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; //case 73 tbManager.Tools["LT:O.WikiPage"].SharedProps.Visible = mUnitModel.CanWiki; //case 1172 tbManager.Tools["LT:AssignedDoc.Label.List"].SharedProps.Visible = !AyaBizUtils.Lite; //DISABLE EDITABLE CONTROLS //Text editors edName.Enabled=!bReadOnly; edModelNumber.Enabled=!bReadOnly; edNotes.Enabled=!bReadOnly; edWarrantyLength.Enabled=!bReadOnly; edWarrantyTerms.Enabled=!bReadOnly; edModelUPC.Enabled=!bReadOnly; //Combo boxes cbUnitModelCategoryID.Enabled=!bReadOnly; cbVendorID.Enabled=!bReadOnly; //Check boxes ckActive.Enabled=!bReadOnly; ckLifeTimeWarranty.Enabled=!bReadOnly; ckDiscontinued.Enabled=!bReadOnly; //Dates dtIntroducedDate.Enabled=!bReadOnly; dtDiscontinuedDate.Enabled=!bReadOnly; //Buttons btnCategoryID.Enabled=!bReadOnly; btnCategoryID.Appearance.ForeColorDisabled=System.Drawing.SystemColors.ControlText; btnVendorID.Enabled=!bReadOnly; btnVendorID.Appearance.ForeColorDisabled=System.Drawing.SystemColors.ControlText; } #endregion #region Form DataBinding and BrokenRules handling bool bShowCustomFields=false; /// /// Bind controls to business objects /// private void DataBind() { //case 1039 //log.Debug("DataBind"); //Custom fields are not databound, but must be initiated manually... FillCustomFieldGrid(); //Subscribe to broken rules changed event OnBrokenRulesChanged mUnitModel.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged); //=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-= //Text editors Util.BindField(edName,"Text",mUnitModel,"Name"); Util.BindField(edModelNumber,"Text",mUnitModel,"ModelNumber"); Util.BindField(edNotes,"Text",mUnitModel,"Notes"); Util.BindField(edWarrantyTerms,"Text",mUnitModel,"WarrantyTerms"); Util.BindField(edWarrantyLength,"Text",mUnitModel,"WarrantyLength"); Util.BindField(edModelUPC,"Text",mUnitModel,"UPC"); //Combo boxes Util.BindField(cbUnitModelCategoryID,"Value",mUnitModel,"UnitModelCategoryID"); Util.BindField(cbVendorID,"Value",mUnitModel,"VendorID"); //Check boxes Util.BindField(ckActive,"Checked",mUnitModel,"Active"); Util.BindField(ckLifeTimeWarranty,"Checked",mUnitModel,"LifeTimeWarranty"); Util.BindField(ckDiscontinued,"Checked",mUnitModel,"Discontinued"); //Date Util.BindField(dtIntroducedDate, "Value", mUnitModel, "IntroducedDate"); Util.BindField(dtDiscontinuedDate, "Value", mUnitModel, "DiscontinuedDate"); //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //Bind IsDirty property to hidden checkbox to //ensure isdirtychanged event is available //to data binding infrastructure Util.BindField(ckIsDirty,"Checked",mUnitModel,"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,mUnitModel,ErrorProvider); } #endregion #region Business object editing / adding / deletion related code private UnitModel mUnitModel; /// /// UnitModel record to display /// set by caller /// public UnitModel UnitModelToEdit { get { return mUnitModel; } set { mUnitModel=value; //mUnitModel.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 lblNotes.Focus(); switch(SaveType) { case RecordActionType.DeleteAndExit: if(Util.PromptForDelete()==DialogResult.Yes) { //Delete, then exit try { UnitModel.DeleteItem(mUnitModel.ID); } catch(Exception ex) { Util.ReportSQLError(ex); return false; } bClosingHandled=true; this.Close(); mbChangesMade=true; return true; } else return false; case RecordActionType.SaveAndExit: //Save if necessary and exit if(mUnitModel.IsSavable) { mUnitModel.ApplyEdit(); mUnitModel.Save(); bClosingHandled=true; mbChangesMade=true; this.Close(); return true; } if(mUnitModel.IsDirty)//dirty and unsaveable due to broken rules { 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.SaveAndNew: if(mUnitModel.IsSavable) { mUnitModel.ApplyEdit(); mUnitModel.Save(); AddNewUnitModel(); mbChangesMade=true; return true; } if(mUnitModel.IsDirty)//dirty and unsaveable due to broken rules { //User says that's ok, continue on? if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { //Ok, add new UnitModel and don't save old record AddNewUnitModel(); return true; } else return false; } //Current record isn't dirty so just add a new UnitModel AddNewUnitModel(); return true; case RecordActionType.SaveOnly: if(mUnitModel.IsSavable) { mUnitModel.ApplyEdit(); mUnitModel=(UnitModel)mUnitModel.Save(); DataBind(); mbChangesMade=true; return true; } return true; case RecordActionType.PromptToSave: //Prompt to save and save if //required if(mUnitModel.IsDirty) { DialogResult dr=Util.PromptForSave(); if(dr==DialogResult.Cancel) { //Cancel return false; } if(dr==DialogResult.Yes) { //Save before exit if(mUnitModel.IsSavable) { mUnitModel.ApplyEdit(); mUnitModel.Save(); mbChangesMade=true; return true; } if(mUnitModel.IsDirty)//dirty and unsaveable due to broken rules { if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { return true; } else return false; } } } return true; } return false; } /// /// ///Creates a new UnitModel record and opens it for editing /// private void AddNewUnitModel() { //case 1039 //log.Debug("AddNewUnitModel"); try { mUnitModel=UnitModel.NewItem(); //mUnitModel.BeginEdit(); DataBind(); } catch(Exception ex) { //log.Error("AddNewUnitModel",ex); MessageBox.Show(ex.Message+"\r\n"+ex.Source); } } #endregion #region Form ComboBoxes (Setup / Events) private void InitializeComboBoxes() { //case 1039 //log.Debug("InitializeComboBoxes"); //Load combo boxes with initial values Util.FillGZComboBoxWithNameIDList("UnitModelCategory",cbUnitModelCategoryID,true,mUnitModel.UnitModelCategoryID,false); Util.FillGZComboBoxWithNameIDList("Vendor",cbVendorID,true,mUnitModel.VendorID,false); } private void cbUnitModelCategoryID_NeedMoreData() { Util.FillGZComboBoxWithNameIDList("UnitModelCategory",cbUnitModelCategoryID,false,Guid.Empty,false); } private void cbVendorID_NeedMoreData() { Util.FillGZComboBoxWithNameIDList("Vendor",cbVendorID,false,Guid.Empty,false); } #endregion #region Custom fields /// /// put custom field data into custom grid and show it if applicable /// private void FillCustomFieldGrid() { //case 1039 //log.Debug("FillCustomFieldGrid"); bShowCustomFields=Util.PrepareCustomFieldsGrid("UnitModel",gridCustom); if(bShowCustomFields) { this.panelCustom.Visible=true; Util.GridFromCustomFields(mUnitModel,gridCustom); } else { this.panelCustom.Visible=false; } } private void gridCustom_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { Util.GridToCustomFields(mUnitModel,gridCustom); } #endregion #region Drag and drop docs private void Form_DragEnter(object sender, System.Windows.Forms.DragEventArgs e) { Util.DragEnter(e); } private void Form_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { Util.DragDrop(e, mUnitModel.Docs, RootObjectTypes.UnitModel, mUnitModel.ID, RootObjectTypes.UnitModel); } #endregion #region Accelerator keys /// /// 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 } }