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 LoanItemInfoForm. /// public class LoanItemInfoForm : 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 Infragistics.Win.UltraWinEditors.UltraTextEditor edNotes; 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.Misc.UltraLabel lblSerial; private Infragistics.Win.UltraWinEditors.UltraTextEditor edSerial; private Infragistics.Win.UltraWinEditors.UltraTextEditor edName; private Infragistics.Win.Misc.UltraLabel lblName; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _LoanItemInfoForm_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _LoanItemInfoForm_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _LoanItemInfoForm_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _LoanItemInfoForm_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraLabel lblNotes; private System.Windows.Forms.HelpProvider helpProvider1; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateYear; private Infragistics.Win.Misc.UltraLabel lblYear; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateMonth; private Infragistics.Win.Misc.UltraLabel lblMonth; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateWeek; private Infragistics.Win.Misc.UltraLabel lblWeek; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateDay; private Infragistics.Win.Misc.UltraLabel lblDay; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateHalfDay; private Infragistics.Win.Misc.UltraLabel lblHalfDay; private Infragistics.Win.UltraWinEditors.UltraCurrencyEditor edRateHour; private Infragistics.Win.Misc.UltraLabel lblHour; private GZTW.WinForm.Controls.GZUltraComboEditor cbRegion; private Infragistics.Win.Misc.UltraLabel lblRegionID; private System.ComponentModel.IContainer components; public LoanItemInfoForm() { // // 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("LoanItemEntryMenuBar"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Toolbar.Print"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:AssignedDoc.Label.List"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool17 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = 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 buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:AssignedDoc.Label.List"); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory"); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew"); Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool14 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete"); Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool16 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Toolbar.Print"); Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool18 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:O.WikiPage"); Infragistics.Win.Appearance appearance13 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance14 = 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.cbRegion = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.lblRegionID = new Infragistics.Win.Misc.UltraLabel(); this.edRateYear = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblYear = new Infragistics.Win.Misc.UltraLabel(); this.edRateMonth = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblMonth = new Infragistics.Win.Misc.UltraLabel(); this.edRateWeek = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblWeek = new Infragistics.Win.Misc.UltraLabel(); this.edRateDay = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblDay = new Infragistics.Win.Misc.UltraLabel(); this.edRateHalfDay = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblHalfDay = new Infragistics.Win.Misc.UltraLabel(); this.edRateHour = new Infragistics.Win.UltraWinEditors.UltraCurrencyEditor(); this.lblHour = new Infragistics.Win.Misc.UltraLabel(); this.edName = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblName = new Infragistics.Win.Misc.UltraLabel(); this.edSerial = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.lblSerial = new Infragistics.Win.Misc.UltraLabel(); this.ckActive = new Infragistics.Win.UltraWinEditors.UltraCheckEditor(); this.lblNotes = new Infragistics.Win.Misc.UltraLabel(); this.edNotes = new Infragistics.Win.UltraWinEditors.UltraTextEditor(); this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components); this.panelRight = new System.Windows.Forms.Panel(); this.panelCustom = new System.Windows.Forms.Panel(); this.gridCustom = new Infragistics.Win.UltraWinGrid.UltraGrid(); this._LoanItemInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._LoanItemInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._LoanItemInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._LoanItemInfoForm_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.cbRegion)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateYear)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateMonth)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateWeek)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateDay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateHalfDay)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateHour)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edSerial)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ckActive)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit(); this.panelRight.SuspendLayout(); 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(222, 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[] { buttonTool1, buttonTool2, buttonTool3, buttonTool17, buttonTool4, buttonTool5, buttonTool6, buttonTool7, buttonTool8}); ultraToolbar1.Text = "LoanItemEntryMenuBar"; 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; buttonTool9.SharedPropsInternal.AccessibleDescription = "recorddd"; appearance1.Image = global::AyaNova.Resource1.SaveExit32; buttonTool9.SharedPropsInternal.AppearancesLarge.Appearance = appearance1; appearance2.Image = global::AyaNova.Resource1.SaveExit16; buttonTool9.SharedPropsInternal.AppearancesSmall.Appearance = appearance2; buttonTool9.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose"; appearance3.Image = global::AyaNova.Resource1.Documents32; buttonTool10.SharedPropsInternal.AppearancesLarge.Appearance = appearance3; appearance4.Image = global::AyaNova.Resource1.Documents16; buttonTool10.SharedPropsInternal.AppearancesSmall.Appearance = appearance4; buttonTool10.SharedPropsInternal.Caption = "LT:AssignedDoc.Label.List"; appearance5.Image = global::AyaNova.Resource1.RecordHistory32; buttonTool11.SharedPropsInternal.AppearancesLarge.Appearance = appearance5; appearance6.Image = global::AyaNova.Resource1.RecordHistory16; buttonTool11.SharedPropsInternal.AppearancesSmall.Appearance = appearance6; buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory"; buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.Save"; buttonTool12.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance7.Image = global::AyaNova.Resource1.SaveNew32; buttonTool13.SharedPropsInternal.AppearancesLarge.Appearance = appearance7; appearance8.Image = global::AyaNova.Resource1.SaveNew16; buttonTool13.SharedPropsInternal.AppearancesSmall.Appearance = appearance8; buttonTool13.SharedPropsInternal.Caption = "LT:UI.Command.SaveNew"; buttonTool14.SharedPropsInternal.Caption = "LT:UI.Command.Close"; buttonTool14.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways; appearance9.Image = global::AyaNova.Resource1.Delete32; buttonTool15.SharedPropsInternal.AppearancesLarge.Appearance = appearance9; appearance10.Image = global::AyaNova.Resource1.Delete16; buttonTool15.SharedPropsInternal.AppearancesSmall.Appearance = appearance10; buttonTool15.SharedPropsInternal.Caption = "LT:UI.Command.Delete"; appearance11.Image = global::AyaNova.Resource1.Print32; buttonTool16.SharedPropsInternal.AppearancesLarge.Appearance = appearance11; appearance12.Image = global::AyaNova.Resource1.Print16; buttonTool16.SharedPropsInternal.AppearancesSmall.Appearance = appearance12; buttonTool16.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print"; appearance13.Image = global::AyaNova.Resource1.Wiki32; buttonTool18.SharedPropsInternal.AppearancesLarge.Appearance = appearance13; appearance14.Image = global::AyaNova.Resource1.Wiki16; buttonTool18.SharedPropsInternal.AppearancesSmall.Appearance = appearance14; buttonTool18.SharedPropsInternal.Caption = "LT:O.WikiPage"; this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool9, buttonTool10, buttonTool11, buttonTool12, buttonTool13, buttonTool14, buttonTool15, buttonTool16, buttonTool18}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // panelLeft // this.panelLeft.Controls.Add(this.cbRegion); this.panelLeft.Controls.Add(this.lblRegionID); this.panelLeft.Controls.Add(this.edRateYear); this.panelLeft.Controls.Add(this.lblYear); this.panelLeft.Controls.Add(this.edRateMonth); this.panelLeft.Controls.Add(this.lblMonth); this.panelLeft.Controls.Add(this.edRateWeek); this.panelLeft.Controls.Add(this.lblWeek); this.panelLeft.Controls.Add(this.edRateDay); this.panelLeft.Controls.Add(this.lblDay); this.panelLeft.Controls.Add(this.edRateHalfDay); this.panelLeft.Controls.Add(this.lblHalfDay); this.panelLeft.Controls.Add(this.edRateHour); this.panelLeft.Controls.Add(this.lblHour); this.panelLeft.Controls.Add(this.edName); this.panelLeft.Controls.Add(this.lblName); this.panelLeft.Controls.Add(this.edSerial); this.panelLeft.Controls.Add(this.lblSerial); this.panelLeft.Controls.Add(this.ckActive); 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, 359); this.panelLeft.TabIndex = 0; // // cbRegion // this.cbRegion.AllowEmptySelection = false; this.cbRegion.Anchor = System.Windows.Forms.AnchorStyles.Top; this.cbRegion.Location = new System.Drawing.Point(191, 67); this.cbRegion.Name = "cbRegion"; this.cbRegion.Size = new System.Drawing.Size(105, 24); this.cbRegion.TabIndex = 107; this.cbRegion.NeedMoreData += new GZTW.WinForm.Controls.NeedMoreDataHandler(this.cbRegion_NeedMoreData); // // lblRegionID // this.lblRegionID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblRegionID.Location = new System.Drawing.Point(12, 67); this.lblRegionID.Name = "lblRegionID"; this.lblRegionID.Size = new System.Drawing.Size(132, 18); this.lblRegionID.TabIndex = 108; this.lblRegionID.Tag = ""; this.lblRegionID.Text = "LT:O.Region"; this.lblRegionID.WrapText = false; // // edRateYear // this.edRateYear.Location = new System.Drawing.Point(191, 291); this.edRateYear.Name = "edRateYear"; this.edRateYear.Size = new System.Drawing.Size(105, 24); this.edRateYear.TabIndex = 105; // // lblYear // this.lblYear.Location = new System.Drawing.Point(12, 291); this.lblYear.Name = "lblYear"; this.lblYear.Size = new System.Drawing.Size(92, 18); this.lblYear.TabIndex = 106; this.lblYear.Tag = ""; this.lblYear.Text = "LT:LoanItem.Label.RateYear"; this.lblYear.WrapText = false; // // edRateMonth // this.edRateMonth.Location = new System.Drawing.Point(191, 258); this.edRateMonth.Name = "edRateMonth"; this.edRateMonth.Size = new System.Drawing.Size(105, 24); this.edRateMonth.TabIndex = 103; // // lblMonth // this.lblMonth.Location = new System.Drawing.Point(12, 258); this.lblMonth.Name = "lblMonth"; this.lblMonth.Size = new System.Drawing.Size(92, 19); this.lblMonth.TabIndex = 104; this.lblMonth.Tag = ""; this.lblMonth.Text = "LT:LoanItem.Label.RateMonth"; this.lblMonth.WrapText = false; // // edRateWeek // this.edRateWeek.Location = new System.Drawing.Point(191, 226); this.edRateWeek.Name = "edRateWeek"; this.edRateWeek.Size = new System.Drawing.Size(105, 24); this.edRateWeek.TabIndex = 101; // // lblWeek // this.lblWeek.Location = new System.Drawing.Point(12, 226); this.lblWeek.Name = "lblWeek"; this.lblWeek.Size = new System.Drawing.Size(92, 19); this.lblWeek.TabIndex = 102; this.lblWeek.Tag = ""; this.lblWeek.Text = "LT:LoanItem.Label.RateWeek"; this.lblWeek.WrapText = false; // // edRateDay // this.edRateDay.Location = new System.Drawing.Point(191, 194); this.edRateDay.Name = "edRateDay"; this.edRateDay.Size = new System.Drawing.Size(105, 24); this.edRateDay.TabIndex = 99; // // lblDay // this.lblDay.Location = new System.Drawing.Point(12, 194); this.lblDay.Name = "lblDay"; this.lblDay.Size = new System.Drawing.Size(92, 18); this.lblDay.TabIndex = 100; this.lblDay.Tag = ""; this.lblDay.Text = "LT:LoanItem.Label.RateDay"; this.lblDay.WrapText = false; // // edRateHalfDay // this.edRateHalfDay.Location = new System.Drawing.Point(192, 162); this.edRateHalfDay.Name = "edRateHalfDay"; this.edRateHalfDay.Size = new System.Drawing.Size(106, 24); this.edRateHalfDay.TabIndex = 97; // // lblHalfDay // this.lblHalfDay.Location = new System.Drawing.Point(12, 162); this.lblHalfDay.Name = "lblHalfDay"; this.lblHalfDay.Size = new System.Drawing.Size(94, 18); this.lblHalfDay.TabIndex = 98; this.lblHalfDay.Tag = ""; this.lblHalfDay.Text = "LT:LoanItem.Label.RateHalfDay"; this.lblHalfDay.WrapText = false; // // edRateHour // this.edRateHour.Location = new System.Drawing.Point(192, 129); this.edRateHour.Name = "edRateHour"; this.edRateHour.Size = new System.Drawing.Size(106, 24); this.edRateHour.TabIndex = 95; // // lblHour // this.lblHour.Location = new System.Drawing.Point(12, 129); this.lblHour.Name = "lblHour"; this.lblHour.Size = new System.Drawing.Size(94, 19); this.lblHour.TabIndex = 96; this.lblHour.Tag = ""; this.lblHour.Text = "LT:LoanItem.Label.RateHour"; this.lblHour.WrapText = false; // // edName // this.edName.Location = new System.Drawing.Point(192, 37); this.edName.Name = "edName"; this.edName.Size = new System.Drawing.Size(106, 24); this.edName.TabIndex = 0; // // lblName // this.lblName.Location = new System.Drawing.Point(12, 37); this.lblName.Name = "lblName"; this.lblName.Size = new System.Drawing.Size(94, 18); this.lblName.TabIndex = 94; this.lblName.Tag = ""; this.lblName.Text = "LT:LoanItem.Label.Name"; this.lblName.WrapText = false; // // edSerial // this.edSerial.Location = new System.Drawing.Point(192, 97); this.edSerial.Name = "edSerial"; this.edSerial.Size = new System.Drawing.Size(106, 24); this.edSerial.TabIndex = 1; this.edSerial.AfterExitEditMode += new System.EventHandler(this.edSerial_AfterExitEditMode); // // lblSerial // this.lblSerial.Location = new System.Drawing.Point(12, 97); this.lblSerial.Name = "lblSerial"; this.lblSerial.Size = new System.Drawing.Size(94, 18); this.lblSerial.TabIndex = 92; this.lblSerial.Tag = ""; this.lblSerial.Text = "LT:LoanItem.Label.Serial"; this.lblSerial.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(12, 9); this.ckActive.Name = "ckActive"; this.ckActive.Size = new System.Drawing.Size(247, 19); this.ckActive.TabIndex = 2; this.ckActive.Tag = ""; this.ckActive.Text = "LT:Common.Label.Active"; // // lblNotes // this.lblNotes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.lblNotes.Location = new System.Drawing.Point(10, 9); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(279, 19); this.lblNotes.TabIndex = 8; this.lblNotes.Tag = ""; this.lblNotes.Text = "LT:LoanItem.Label.Notes"; // // edNotes // this.edNotes.AcceptsReturn = true; this.edNotes.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.edNotes.Location = new System.Drawing.Point(10, 28); this.edNotes.Multiline = true; this.edNotes.Name = "edNotes"; this.edNotes.Size = new System.Drawing.Size(294, 325); this.edNotes.TabIndex = 0; // // ErrorProvider // this.ErrorProvider.ContainerControl = this; // // panelRight // this.panelRight.Controls.Add(this.lblNotes); this.panelRight.Controls.Add(this.edNotes); 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(320, 359); this.panelRight.TabIndex = 101; // // panelCustom // this.panelCustom.Controls.Add(this.gridCustom); this.panelCustom.Dock = System.Windows.Forms.DockStyle.Right; this.panelCustom.Location = new System.Drawing.Point(626, 43); this.panelCustom.Name = "panelCustom"; this.panelCustom.Size = new System.Drawing.Size(269, 359); 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, 359); 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); // // _LoanItemInfoForm_Toolbars_Dock_Area_Left // this._LoanItemInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._LoanItemInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._LoanItemInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._LoanItemInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._LoanItemInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43); this._LoanItemInfoForm_Toolbars_Dock_Area_Left.Name = "_LoanItemInfoForm_Toolbars_Dock_Area_Left"; this._LoanItemInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 359); this._LoanItemInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // _LoanItemInfoForm_Toolbars_Dock_Area_Right // this._LoanItemInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._LoanItemInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._LoanItemInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._LoanItemInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._LoanItemInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(895, 43); this._LoanItemInfoForm_Toolbars_Dock_Area_Right.Name = "_LoanItemInfoForm_Toolbars_Dock_Area_Right"; this._LoanItemInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 359); this._LoanItemInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _LoanItemInfoForm_Toolbars_Dock_Area_Top // this._LoanItemInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._LoanItemInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._LoanItemInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._LoanItemInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._LoanItemInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._LoanItemInfoForm_Toolbars_Dock_Area_Top.Name = "_LoanItemInfoForm_Toolbars_Dock_Area_Top"; this._LoanItemInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(895, 43); this._LoanItemInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _LoanItemInfoForm_Toolbars_Dock_Area_Bottom // this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 402); this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.Name = "_LoanItemInfoForm_Toolbars_Dock_Area_Bottom"; this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(895, 0); this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // LoanItemInfoForm // this.AllowDrop = true; this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(895, 402); this.Controls.Add(this.panelCustom); this.Controls.Add(this.panelRight); this.Controls.Add(this.panelLeft); this.Controls.Add(this.ckIsDirty); this.Controls.Add(this._LoanItemInfoForm_Toolbars_Dock_Area_Left); this.Controls.Add(this._LoanItemInfoForm_Toolbars_Dock_Area_Right); this.Controls.Add(this._LoanItemInfoForm_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._LoanItemInfoForm_Toolbars_Dock_Area_Top); this.helpProvider1.SetHelpKeyword(this, ""); this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic); this.Name = "LoanItemInfoForm"; this.helpProvider1.SetShowHelp(this, true); this.ShowInTaskbar = false; this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Closing += new System.ComponentModel.CancelEventHandler(this.LoanItemInfoForm_Closing); this.Load += new System.EventHandler(this.LoanItemInfoForm_Load); this.SizeChanged += new System.EventHandler(this.LoanItemInfoForm_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.cbRegion)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateYear)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateMonth)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateWeek)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateDay)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateHalfDay)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edRateHour)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edSerial)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ckActive)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.edNotes)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit(); this.panelRight.ResumeLayout(false); this.panelRight.PerformLayout(); 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 LoanItemInfoForm_Load(object sender, System.EventArgs e) { //case 1039 //log.Debug("LoanItemInfoForm_Load"); // // helpProvider1 // this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "loan_items.htm"; Cursor.Current = Cursors.WaitCursor; this.Visible=false; this.Icon = Resource1.Loan16icon; //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 LoanItem edit screen from elsewhere in the program) if(AyaBizUtils.Right("Object.LoanItem")< (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.LoanItem"))); this.Close(); return; } Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810 InitializeComboBoxes(); DataBind(); // InitializeGrid(); Util.Localize(this); //restrict UI based on security settings RestrictUI(); Util.LoadFormCustomization("LoanItemInfo", this, tbManager, false); Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.LoanItem, mLoanItem, null));//case 941 Cursor.Current = Cursors.Default; //case 1122 Util.ShowAllInsertMenu(tbManager, new TypeAndID(RootObjectTypes.LoanItem, mLoanItem.ID), this); //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 LoanItemInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("LoanItemInfoForm_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("LoanItemInfo", this, tbManager, false); } #endregion #region Form Sizing /// /// Adjust the layout proportionately as it's sized by user /// /// /// private void LoanItemInfoForm_SizeChanged(object sender, System.EventArgs e) { //case 1039 //log.Debug("LoanItemInfoForm_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; //this.panelBottom.Height=(this.DisplayRectangle.Height/3)-40; //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? Not enough room on left so unless sent to back overwrites rigth control int nGap = 16; //Size and align controls in Left panel lblSerial.Width = nLeftWidth - nGap; edSerial.Left=nLeftWidth; edSerial.Width=nRightWidth; lblName.Width = nLeftWidth - nGap; edName.Left=nLeftWidth; edName.Width=nRightWidth; lblRegionID.Width = nLeftWidth - nGap; cbRegion.Left = nLeftWidth; cbRegion.Width = nRightWidth; lblHour.Width = nLeftWidth - nGap; edRateHour.Left = nLeftWidth; edRateHour.Width = nRightWidth; lblHalfDay.Width = nLeftWidth - nGap; edRateHalfDay.Left = nLeftWidth; edRateHalfDay.Width = nRightWidth; lblDay.Width = nLeftWidth - nGap; edRateDay.Left = nLeftWidth; edRateDay.Width = nRightWidth; lblWeek.Width = nLeftWidth - nGap; edRateWeek.Left = nLeftWidth; edRateWeek.Width = nRightWidth; lblMonth.Width = nLeftWidth - nGap; edRateMonth.Left = nLeftWidth; edRateMonth.Width = nRightWidth; lblYear.Width = nLeftWidth - nGap; edRateYear.Left = nLeftWidth; edRateYear.Width = nRightWidth; //Size and align controls in right panel nRightWidth=nRightWidth-8; lblNotes.Width = nLeftWidth - nGap; // edNotes.Left=nLeftWidth+8; // edNotes.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=mLoanItem.Docs; d.RootObjectID=mLoanItem.ID; d.ExactObjectType = d.RootObjectType = RootObjectTypes.LoanItem; d.ShowDialog(); break; case "LT:UI.Command.RecordHistory": // ButtonTool RecordHistoryForm RH=new RecordHistoryForm(mLoanItem.Creator,mLoanItem.Modifier,mLoanItem.Created,mLoanItem.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:O.LoanItemMeterReading": // ButtonTool // TODO: Show LoanItemMeterReading grid break; case "LT:UI.Command.Delete": // ButtonTool RecordUpdate(RecordActionType.DeleteAndExit); break; case "LT:O.WikiPage": { Util.OpenWikiPage(RootObjectTypes.LoanItem, mLoanItem.ID, false); break; } } } #endregion Toolbar menu items #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 LoanItem serial number and LoanItemmodel name in title bar this.Text=mLoanItem.Name + " " + mLoanItem.Serial; //Indicate if any docs in icon //case 918 if (this.mLastDocsCount != mLoanItem.Docs.Count) { this.mLastDocsCount = mLoanItem.Docs.Count; Util.AssignedDocsSetImage(tbManager, (mLastDocsCount > 0)); } } /// /// When the application enters an idle state /// update the UI to reflect changes 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.LoanItem")).ToString()); bool bDelete=AyaBizUtils.Right("Object.LoanItem")== (int)SecurityLevelTypes.ReadWriteDelete; bool bReadOnly=AyaBizUtils.Right("Object.LoanItem") < (int)SecurityLevelTypes.ReadWrite; tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=bDelete; //case 73 tbManager.Tools["LT:O.WikiPage"].SharedProps.Visible = mLoanItem.CanWiki; //case 1172 tbManager.Tools["LT:AssignedDoc.Label.List"].SharedProps.Visible = !AyaBizUtils.Lite; if(bDelete) { gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True; } else { gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False; } //Grids if(bReadOnly) { gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.No; gridCustom.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False; } else { gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom; gridCustom.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 edSerial.Enabled=!bReadOnly; edName.Enabled=!bReadOnly; edNotes.Enabled=!bReadOnly; //case 420 edRateHour.Enabled = !bReadOnly; edRateHalfDay.Enabled = !bReadOnly; edRateDay.Enabled = !bReadOnly; edRateWeek.Enabled = !bReadOnly; edRateMonth.Enabled = !bReadOnly; edRateYear.Enabled = !bReadOnly; //Check boxes ckActive.Enabled=!bReadOnly; } #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 mLoanItem.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged); //=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-= //Text editors Util.BindField(edSerial,"Text",mLoanItem,"Serial"); Util.BindField(edName,"Text",mLoanItem,"Name"); Util.BindField(edNotes,"Text",mLoanItem,"Notes"); //Case 420 Util.BindField(edRateHour, "Value", mLoanItem, "RateHour"); Util.BindField(edRateHalfDay, "Value", mLoanItem, "RateHalfDay"); Util.BindField(edRateDay, "Value", mLoanItem, "RateDay"); Util.BindField(edRateWeek, "Value", mLoanItem, "RateWeek"); Util.BindField(edRateMonth, "Value", mLoanItem, "RateMonth"); Util.BindField(edRateYear, "Value", mLoanItem, "RateYear"); //Combo boxes Util.BindField(cbRegion, "Value", mLoanItem, "RegionID"); //Check boxes Util.BindField(ckActive,"Checked",mLoanItem,"Active"); //Buttons //TODO: need to bind these to the values themselves // Util.BindField(btnAddress,"Visible",mLoanItem,"LoanItemHasOwnAddress"); // Util.BindField(btnRental,"Visible",mLoanItem,"RentalLoanItem"); //Date //=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //Bind IsDirty property to hidden checkbox to //ensure isdirtychanged event is available //to data binding infrastructure Util.BindField(ckIsDirty,"Checked",mLoanItem,"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,mLoanItem,ErrorProvider); } #endregion #region Business object editing / adding / deletion related code private LoanItem mLoanItem; /// /// LoanItem record to display /// set by caller /// public LoanItem LoanItemToEdit { get { return mLoanItem; } set { mLoanItem=value; //mLoanItem.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 lblName.Focus(); switch(SaveType) { case RecordActionType.DeleteAndExit: if(Util.PromptForDelete()==DialogResult.Yes) { //Delete, then exit try { LoanItem.DeleteItem(mLoanItem.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(mLoanItem.IsSavable) { mLoanItem.ApplyEdit(); mLoanItem.Save(); bClosingHandled=true; mbChangesMade=true; this.Close(); return true; } if(mLoanItem.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(mLoanItem.IsSavable) { mLoanItem.ApplyEdit(); mLoanItem.Save(); AddNewLoanItem(); mbChangesMade=true; return true; } if(mLoanItem.IsDirty)//dirty and unsaveable due to broken rules { //User says that's ok, continue on? if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes) { //Ok, add new LoanItem and don't save old record AddNewLoanItem(); return true; } else return false; } //Current record isn't dirty so just add a new LoanItem AddNewLoanItem(); return true; case RecordActionType.SaveOnly: if(mLoanItem.IsSavable) { mLoanItem.ApplyEdit(); mLoanItem=(LoanItem)mLoanItem.Save(); mbChangesMade=true; return true; } return true; case RecordActionType.PromptToSave: //Prompt to save and save if //required if(mLoanItem.IsDirty) { DialogResult dr=Util.PromptForSave(); if(dr==DialogResult.Cancel) { //Cancel return false; } if(dr==DialogResult.Yes) { //Save before exit if(mLoanItem.IsSavable) { mLoanItem.ApplyEdit(); mLoanItem.Save(); mbChangesMade=true; return true; } if(mLoanItem.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 LoanItem record and opens it for editing /// private void AddNewLoanItem() { //case 1039 //log.Debug("AddNewLoanItem"); try { mLoanItem=LoanItem.NewItem(); //mLoanItem.BeginEdit(); DataBind(); } catch(Exception ex) { //log.Error("AddNewLoanItem",ex); MessageBox.Show(ex.Message+"\r\n"+ex.Source); } } #endregion #region Form ComboBoxes (Setup / Events) private void cbRegion_NeedMoreData() { Util.FillGZComboBoxWithNameIDList("Region", cbRegion, false, Guid.Empty, true); } private void InitializeComboBoxes() { //case 1039 //log.Debug("InitializeComboBoxes"); //Load combo boxes with initial values Util.FillGZComboBoxWithNameIDList("Region", cbRegion, true, mLoanItem.RegionID, true); } #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("LoanItem",gridCustom); if(bShowCustomFields) { this.panelCustom.Visible=true; Util.GridFromCustomFields(mLoanItem,gridCustom); } else { this.panelCustom.Visible=false; } } private void gridCustom_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { Util.GridToCustomFields(mLoanItem,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, mLoanItem.Docs, RootObjectTypes.LoanItem, mLoanItem.ID, RootObjectTypes.LoanItem); } #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 //Case 421 private void edSerial_AfterExitEditMode(object sender, EventArgs e) { if (mLoanItem.IsNew) { if (LoanItem.Exists(Guid.Empty, edSerial.Text)) { Util.PromptWithIconOKOnlyFromLocaleKey("Error.Object.DuplicateSerialWarning", MessageBoxIcon.Warning); } } } } }