1286 lines
54 KiB
C#
1286 lines
54 KiB
C#
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>
|
|
/// Summary description for HeadOfficeInfoForm.
|
|
/// </summary>
|
|
public class ContractInfoForm : System.Windows.Forms.Form
|
|
{
|
|
// Create a logger for use in this class
|
|
//case 1039 private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
private System.Windows.Forms.CheckBox ckIsDirty;
|
|
private System.Windows.Forms.ErrorProvider ErrorProvider;
|
|
private System.Windows.Forms.Panel panelLeft;
|
|
private System.Windows.Forms.Panel panelRight;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager;
|
|
private System.Windows.Forms.Panel panelCustom;
|
|
private Infragistics.Win.UltraWinGrid.UltraGrid gridCustom;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _HeadOfficeInfoForm_Toolbars_Dock_Area_Left;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _HeadOfficeInfoForm_Toolbars_Dock_Area_Right;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _HeadOfficeInfoForm_Toolbars_Dock_Area_Top;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom;
|
|
private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckActive;
|
|
private Infragistics.Win.Misc.UltraLabel lblDiscountParts;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edName;
|
|
private Infragistics.Win.Misc.UltraLabel lblName;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edNotes;
|
|
private Infragistics.Win.Misc.UltraLabel lblNotes;
|
|
private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckContractRatesOnly;
|
|
private Infragistics.Win.UltraWinGrid.UltraGrid gridContractRates;
|
|
private Infragistics.Win.UltraWinEditors.UltraNumericEditor edDiscountParts;
|
|
private System.Windows.Forms.HelpProvider helpProvider1;
|
|
private GZTW.WinForm.Controls.GZUltraComboEditor cbRegion;
|
|
private Infragistics.Win.Misc.UltraLabel lblRegionID;
|
|
private System.ComponentModel.IContainer components;
|
|
|
|
|
|
public ContractInfoForm()
|
|
{
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
InitializeComponent();
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose( bool disposing )
|
|
{
|
|
if( disposing )
|
|
{
|
|
if(components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose( disposing );
|
|
}
|
|
|
|
#region Windows Form Designer generated code
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.components = new System.ComponentModel.Container();
|
|
Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("ContractEntryMenuBar");
|
|
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 buttonTool13 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:ScheduleMarker.Label.FollowUp");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = 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 buttonTool8 = 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 buttonTool9 = 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 buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete");
|
|
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:ScheduleMarker.Label.FollowUp");
|
|
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:O.WikiPage");
|
|
Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance12 = new Infragistics.Win.Appearance();
|
|
this.ckIsDirty = new System.Windows.Forms.CheckBox();
|
|
this.panelLeft = new System.Windows.Forms.Panel();
|
|
this.cbRegion = new GZTW.WinForm.Controls.GZUltraComboEditor();
|
|
this.lblRegionID = new Infragistics.Win.Misc.UltraLabel();
|
|
this.lblDiscountParts = new Infragistics.Win.Misc.UltraLabel();
|
|
this.edName = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this.lblName = new Infragistics.Win.Misc.UltraLabel();
|
|
this.edNotes = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this.lblNotes = new Infragistics.Win.Misc.UltraLabel();
|
|
this.ckActive = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
|
|
this.edDiscountParts = new Infragistics.Win.UltraWinEditors.UltraNumericEditor();
|
|
this.ErrorProvider = new System.Windows.Forms.ErrorProvider(this.components);
|
|
this.panelRight = new System.Windows.Forms.Panel();
|
|
this.gridContractRates = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
|
this.ckContractRatesOnly = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
|
|
this.panelCustom = new System.Windows.Forms.Panel();
|
|
this.gridCustom = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
|
|
this.panelLeft.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.cbRegion)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edNotes)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckActive)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edDiscountParts)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).BeginInit();
|
|
this.panelRight.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.gridContractRates)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckContractRatesOnly)).BeginInit();
|
|
this.panelCustom.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.gridCustom)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// ckIsDirty
|
|
//
|
|
this.ckIsDirty.Location = new System.Drawing.Point(-336, 28);
|
|
this.ckIsDirty.Name = "ckIsDirty";
|
|
this.ckIsDirty.Size = new System.Drawing.Size(185, 27);
|
|
this.ckIsDirty.TabIndex = 5;
|
|
//
|
|
// panelLeft
|
|
//
|
|
this.panelLeft.Controls.Add(this.cbRegion);
|
|
this.panelLeft.Controls.Add(this.lblRegionID);
|
|
this.panelLeft.Controls.Add(this.lblDiscountParts);
|
|
this.panelLeft.Controls.Add(this.edName);
|
|
this.panelLeft.Controls.Add(this.lblName);
|
|
this.panelLeft.Controls.Add(this.edNotes);
|
|
this.panelLeft.Controls.Add(this.lblNotes);
|
|
this.panelLeft.Controls.Add(this.ckActive);
|
|
this.panelLeft.Controls.Add(this.edDiscountParts);
|
|
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, 483);
|
|
this.panelLeft.TabIndex = 96;
|
|
//
|
|
// cbRegion
|
|
//
|
|
this.cbRegion.AllowEmptySelection = false;
|
|
this.cbRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.cbRegion.Location = new System.Drawing.Point(10, 104);
|
|
this.cbRegion.Name = "cbRegion";
|
|
this.cbRegion.Size = new System.Drawing.Size(259, 24);
|
|
this.cbRegion.TabIndex = 139;
|
|
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(10, 87);
|
|
this.lblRegionID.Name = "lblRegionID";
|
|
this.lblRegionID.Size = new System.Drawing.Size(259, 18);
|
|
this.lblRegionID.TabIndex = 140;
|
|
this.lblRegionID.Tag = "";
|
|
this.lblRegionID.Text = "LT:O.Region";
|
|
this.lblRegionID.WrapText = false;
|
|
//
|
|
// lblDiscountParts
|
|
//
|
|
this.lblDiscountParts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.lblDiscountParts.Location = new System.Drawing.Point(10, 135);
|
|
this.lblDiscountParts.Name = "lblDiscountParts";
|
|
this.lblDiscountParts.Size = new System.Drawing.Size(259, 18);
|
|
this.lblDiscountParts.TabIndex = 136;
|
|
this.lblDiscountParts.Tag = "";
|
|
this.lblDiscountParts.Text = "LT:Contract.Label.DiscountParts";
|
|
//
|
|
// edName
|
|
//
|
|
this.edName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.edName.Location = new System.Drawing.Point(10, 55);
|
|
this.edName.Name = "edName";
|
|
this.edName.Size = new System.Drawing.Size(259, 24);
|
|
this.edName.TabIndex = 1;
|
|
//
|
|
// 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, 37);
|
|
this.lblName.Name = "lblName";
|
|
this.lblName.Size = new System.Drawing.Size(259, 18);
|
|
this.lblName.TabIndex = 134;
|
|
this.lblName.Tag = "";
|
|
this.lblName.Text = "LT:Contract.Label.Name";
|
|
//
|
|
// 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, 209);
|
|
this.edNotes.Multiline = true;
|
|
this.edNotes.Name = "edNotes";
|
|
this.edNotes.Size = new System.Drawing.Size(283, 204);
|
|
this.edNotes.TabIndex = 3;
|
|
//
|
|
// 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, 190);
|
|
this.lblNotes.Name = "lblNotes";
|
|
this.lblNotes.Size = new System.Drawing.Size(259, 19);
|
|
this.lblNotes.TabIndex = 138;
|
|
this.lblNotes.Tag = "";
|
|
this.lblNotes.Text = "LT:Contract.Label.Notes";
|
|
//
|
|
// 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, 9);
|
|
this.ckActive.Name = "ckActive";
|
|
this.ckActive.Size = new System.Drawing.Size(259, 19);
|
|
this.ckActive.TabIndex = 0;
|
|
this.ckActive.Tag = "";
|
|
this.ckActive.Text = "LT:Common.Label.Active";
|
|
//
|
|
// edDiscountParts
|
|
//
|
|
this.edDiscountParts.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.edDiscountParts.FormatString = "P";
|
|
this.edDiscountParts.Location = new System.Drawing.Point(10, 153);
|
|
this.edDiscountParts.MaskInput = "{LOC}-nnnnnnnnnn.nn";
|
|
this.edDiscountParts.Name = "edDiscountParts";
|
|
this.edDiscountParts.NumericType = Infragistics.Win.UltraWinEditors.NumericType.Double;
|
|
this.edDiscountParts.Size = new System.Drawing.Size(259, 24);
|
|
this.edDiscountParts.TabIndex = 2;
|
|
//
|
|
// ErrorProvider
|
|
//
|
|
this.ErrorProvider.ContainerControl = this;
|
|
//
|
|
// panelRight
|
|
//
|
|
this.panelRight.Controls.Add(this.gridContractRates);
|
|
this.panelRight.Controls.Add(this.ckContractRatesOnly);
|
|
this.panelRight.Dock = System.Windows.Forms.DockStyle.Left;
|
|
this.panelRight.Location = new System.Drawing.Point(300, 43);
|
|
this.panelRight.Name = "panelRight";
|
|
this.panelRight.Size = new System.Drawing.Size(300, 483);
|
|
this.panelRight.TabIndex = 101;
|
|
//
|
|
// gridContractRates
|
|
//
|
|
this.gridContractRates.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.gridContractRates.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
this.gridContractRates.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TemplateOnBottom;
|
|
this.gridContractRates.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.True;
|
|
this.gridContractRates.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.True;
|
|
this.gridContractRates.Location = new System.Drawing.Point(16, 37);
|
|
this.gridContractRates.Name = "gridContractRates";
|
|
this.gridContractRates.Size = new System.Drawing.Size(268, 384);
|
|
this.gridContractRates.TabIndex = 1;
|
|
this.gridContractRates.Tag = "";
|
|
this.gridContractRates.Text = "LT:ContractRate.Label.List";
|
|
this.gridContractRates.BeforeRowInsert += new Infragistics.Win.UltraWinGrid.BeforeRowInsertEventHandler(this.gridContractRates_BeforeRowInsert);
|
|
//
|
|
// ckContractRatesOnly
|
|
//
|
|
this.ckContractRatesOnly.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.ckContractRatesOnly.Checked = true;
|
|
this.ckContractRatesOnly.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
this.ckContractRatesOnly.Location = new System.Drawing.Point(20, 9);
|
|
this.ckContractRatesOnly.Name = "ckContractRatesOnly";
|
|
this.ckContractRatesOnly.Size = new System.Drawing.Size(260, 19);
|
|
this.ckContractRatesOnly.TabIndex = 0;
|
|
this.ckContractRatesOnly.Tag = "";
|
|
this.ckContractRatesOnly.Text = "LT:Contract.Label.ContractRatesOnly";
|
|
//
|
|
// panelCustom
|
|
//
|
|
this.panelCustom.Controls.Add(this.gridCustom);
|
|
this.panelCustom.Dock = System.Windows.Forms.DockStyle.Right;
|
|
this.panelCustom.Location = new System.Drawing.Point(459, 43);
|
|
this.panelCustom.Name = "panelCustom";
|
|
this.panelCustom.Size = new System.Drawing.Size(269, 483);
|
|
this.panelCustom.TabIndex = 108;
|
|
//
|
|
// gridCustom
|
|
//
|
|
this.gridCustom.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
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, 483);
|
|
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);
|
|
//
|
|
// _HeadOfficeInfoForm_Toolbars_Dock_Area_Left
|
|
//
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.Name = "_HeadOfficeInfoForm_Toolbars_Dock_Area_Left";
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 483);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
|
|
//
|
|
// 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,
|
|
buttonTool15,
|
|
buttonTool3,
|
|
buttonTool13,
|
|
buttonTool4,
|
|
buttonTool5,
|
|
buttonTool6});
|
|
ultraToolbar1.Text = "ContractEntryMenuBar";
|
|
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;
|
|
buttonTool7.SharedPropsInternal.AccessibleDescription = "recorddd";
|
|
appearance1.Image = global::AyaNova.Resource1.SaveExit32;
|
|
buttonTool7.SharedPropsInternal.AppearancesLarge.Appearance = appearance1;
|
|
appearance2.Image = global::AyaNova.Resource1.SaveExit16;
|
|
buttonTool7.SharedPropsInternal.AppearancesSmall.Appearance = appearance2;
|
|
buttonTool7.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose";
|
|
appearance3.Image = global::AyaNova.Resource1.Documents32;
|
|
buttonTool8.SharedPropsInternal.AppearancesLarge.Appearance = appearance3;
|
|
appearance4.Image = global::AyaNova.Resource1.Documents16;
|
|
buttonTool8.SharedPropsInternal.AppearancesSmall.Appearance = appearance4;
|
|
buttonTool8.SharedPropsInternal.Caption = "LT:AssignedDoc.Label.List";
|
|
appearance5.Image = global::AyaNova.Resource1.RecordHistory32;
|
|
buttonTool9.SharedPropsInternal.AppearancesLarge.Appearance = appearance5;
|
|
appearance6.Image = global::AyaNova.Resource1.RecordHistory16;
|
|
buttonTool9.SharedPropsInternal.AppearancesSmall.Appearance = appearance6;
|
|
buttonTool9.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory";
|
|
buttonTool10.SharedPropsInternal.Caption = "LT:UI.Command.Save";
|
|
buttonTool10.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.Close";
|
|
buttonTool11.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
appearance7.Image = global::AyaNova.Resource1.Delete32;
|
|
buttonTool12.SharedPropsInternal.AppearancesLarge.Appearance = appearance7;
|
|
appearance8.Image = global::AyaNova.Resource1.Delete16;
|
|
buttonTool12.SharedPropsInternal.AppearancesSmall.Appearance = appearance8;
|
|
buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.Delete";
|
|
appearance9.Image = global::AyaNova.Resource1.FollowUp32;
|
|
buttonTool14.SharedPropsInternal.AppearancesLarge.Appearance = appearance9;
|
|
appearance10.Image = global::AyaNova.Resource1.FollowUp16;
|
|
buttonTool14.SharedPropsInternal.AppearancesSmall.Appearance = appearance10;
|
|
buttonTool14.SharedPropsInternal.Caption = "LT:ScheduleMarker.Label.FollowUp";
|
|
buttonTool14.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars;
|
|
appearance11.Image = global::AyaNova.Resource1.Wiki32;
|
|
buttonTool16.SharedPropsInternal.AppearancesLarge.Appearance = appearance11;
|
|
appearance12.Image = global::AyaNova.Resource1.Wiki16;
|
|
buttonTool16.SharedPropsInternal.AppearancesSmall.Appearance = appearance12;
|
|
buttonTool16.SharedPropsInternal.Caption = "LT:O.WikiPage";
|
|
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
buttonTool7,
|
|
buttonTool8,
|
|
buttonTool9,
|
|
buttonTool10,
|
|
buttonTool11,
|
|
buttonTool12,
|
|
buttonTool14,
|
|
buttonTool16});
|
|
this.tbManager.UseLargeImagesOnToolbar = true;
|
|
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
|
|
//
|
|
// _HeadOfficeInfoForm_Toolbars_Dock_Area_Right
|
|
//
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(728, 43);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.Name = "_HeadOfficeInfoForm_Toolbars_Dock_Area_Right";
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 483);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _HeadOfficeInfoForm_Toolbars_Dock_Area_Top
|
|
//
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.Name = "_HeadOfficeInfoForm_Toolbars_Dock_Area_Top";
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(728, 43);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom
|
|
//
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 526);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.Name = "_HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom";
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(728, 0);
|
|
this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
|
|
//
|
|
// ContractInfoForm
|
|
//
|
|
this.AllowDrop = true;
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
|
this.ClientSize = new System.Drawing.Size(728, 526);
|
|
this.Controls.Add(this.panelCustom);
|
|
this.Controls.Add(this.panelRight);
|
|
this.Controls.Add(this.panelLeft);
|
|
this.Controls.Add(this.ckIsDirty);
|
|
this.Controls.Add(this._HeadOfficeInfoForm_Toolbars_Dock_Area_Left);
|
|
this.Controls.Add(this._HeadOfficeInfoForm_Toolbars_Dock_Area_Right);
|
|
this.Controls.Add(this._HeadOfficeInfoForm_Toolbars_Dock_Area_Bottom);
|
|
this.Controls.Add(this._HeadOfficeInfoForm_Toolbars_Dock_Area_Top);
|
|
this.helpProvider1.SetHelpKeyword(this, "");
|
|
this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
|
|
this.MinimumSize = new System.Drawing.Size(614, 563);
|
|
this.Name = "ContractInfoForm";
|
|
this.helpProvider1.SetShowHelp(this, true);
|
|
this.ShowInTaskbar = false;
|
|
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Show;
|
|
this.Closing += new System.ComponentModel.CancelEventHandler(this.ContractInfoForm_Closing);
|
|
this.Load += new System.EventHandler(this.ContractInfoForm_Load);
|
|
this.SizeChanged += new System.EventHandler(this.ContractInfoForm_SizeChanged);
|
|
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.ContractInfoForm_DragDrop);
|
|
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.ContractInfoForm_DragEnter);
|
|
this.panelLeft.ResumeLayout(false);
|
|
this.panelLeft.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.cbRegion)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edNotes)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckActive)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edDiscountParts)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ErrorProvider)).EndInit();
|
|
this.panelRight.ResumeLayout(false);
|
|
((System.ComponentModel.ISupportInitialize)(this.gridContractRates)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckContractRatesOnly)).EndInit();
|
|
this.panelCustom.ResumeLayout(false);
|
|
((System.ComponentModel.ISupportInitialize)(this.gridCustom)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
|
|
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
|
|
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
|
|
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
|
|
//
|
|
|
|
#region Form Load / Close
|
|
//variable to hold user form settings
|
|
//UIUserFormSetting mFormSetting;
|
|
private int mLastDocsCount=-1;
|
|
|
|
/// <summary>
|
|
/// Prepare the form
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ContractInfoForm_Load(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ContractInfoForm_Load");
|
|
//
|
|
// helpProvider1
|
|
//
|
|
this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "contracts.htm";
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
this.Visible=false;
|
|
this.Icon = Resource1.Contract;
|
|
|
|
//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 Contract edit screen from elsewhere in the program)
|
|
if(AyaBizUtils.Right("Object.Contract")< (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.Contract")));
|
|
|
|
this.Close();
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
InitializeComboBoxes();
|
|
DataBind();
|
|
InitializeGrid();
|
|
Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810
|
|
Util.Localize(this);
|
|
Util.LoadFormCustomization("ContractInfo", this, tbManager, false);
|
|
|
|
Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.Contract, mContract, null));//case 941
|
|
Cursor.Current = Cursors.Default;
|
|
//Case 152
|
|
(new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
|
|
//restrict UI based on security settings
|
|
RestrictUI();
|
|
Application.Idle += new EventHandler(Application_Idle);
|
|
this.Visible = true;
|
|
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// Used to track whether the close was done by the program
|
|
/// or done by the user clicking on the upper left corner X control
|
|
/// </summary>
|
|
bool bClosingHandled=false;
|
|
/// <summary>
|
|
/// Save form layout and grid layout for next time
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ContractInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ContractInfoForm_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("ContractInfo", this, tbManager, false);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Form Sizing
|
|
/// <summary>
|
|
/// Adjust the layout proportionately as it's sized by user
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ContractInfoForm_SizeChanged(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ContractInfoForm_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;
|
|
|
|
|
|
//Added: 17-Nov-2006 to avoid key not found exception
|
|
//because key may not exist at this point yet
|
|
if (gridContractRates.DisplayLayout.Bands[0].Columns.Exists("RateID"))
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["RateID"].Width=nWidth-48;
|
|
//this.panelLeft.Height=nHeight;
|
|
//this.panelRight.Height=nHeight;
|
|
//this.panelCustom.Height=nHeight;
|
|
//this.panelBottom.Height=(this.DisplayRectangle.Height/3)-40;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region Toolbar Menu items
|
|
|
|
/// <summary>
|
|
/// Respond to a click on a toolbar menu item
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tbManager_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
|
|
{
|
|
//MessageBox.Show(e.Tool.Key);
|
|
|
|
//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=mContract.Docs;
|
|
d.RootObjectID=mContract.ID;
|
|
d.RootObjectType=RootObjectTypes.Contract;
|
|
d.ShowDialog();
|
|
break;
|
|
|
|
case "LT:UI.Command.RecordHistory": // ButtonTool
|
|
RecordHistoryForm RH=new RecordHistoryForm(mContract.Creator,mContract.Modifier,mContract.Created,mContract.Modified);
|
|
RH.ShowDialog(); RH.Dispose();
|
|
break;
|
|
|
|
case "LT:UI.Command.Save": // ButtonTool
|
|
RecordUpdate(RecordActionType.SaveOnly);
|
|
break;
|
|
|
|
case "LT:UI.Command.Close": // ButtonTool
|
|
this.Close();
|
|
break;
|
|
|
|
case "LT:UI.Command.Delete": // ButtonTool
|
|
RecordUpdate(RecordActionType.DeleteAndExit);
|
|
break;
|
|
|
|
case "LT:ScheduleMarker.Label.FollowUp":
|
|
{
|
|
FollowUpSelector f = new FollowUpSelector(mContract.ID, RootObjectTypes.Contract);
|
|
f.ShowDialog();
|
|
f.Dispose();
|
|
break;
|
|
}
|
|
|
|
case "LT:O.WikiPage":
|
|
{
|
|
Util.OpenWikiPage(RootObjectTypes.Contract, mContract.ID, false);
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
#endregion Toolbar Menu items
|
|
|
|
#region Form UI / Business object synchronization
|
|
/// <summary>
|
|
/// Synchronize the state of the UI to the BO's
|
|
/// </summary>
|
|
private void SyncUI()
|
|
{
|
|
|
|
//Indicate if any docs in icon
|
|
//case 918
|
|
if (this.mLastDocsCount != mContract.Docs.Count)
|
|
{
|
|
this.mLastDocsCount = mContract.Docs.Count;
|
|
Util.AssignedDocsSetImage(tbManager, (mLastDocsCount > 0));
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 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)
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Application_Idle(object sender, EventArgs e)
|
|
{
|
|
SyncUI();
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 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
|
|
/// </summary>
|
|
private void RestrictUI()
|
|
{
|
|
//case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("RestrictUI: " + ((SecurityLevelTypes)AyaBizUtils.Right("Object.Contract")).ToString());
|
|
|
|
//Contract - Full but no delete
|
|
tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=AyaBizUtils.Right("Object.Contract")== (int)SecurityLevelTypes.ReadWriteDelete;
|
|
bool ReadOnly=AyaBizUtils.Right("Object.Contract") < (int)SecurityLevelTypes.ReadWrite;
|
|
|
|
tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!ReadOnly;
|
|
tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible=!ReadOnly;
|
|
|
|
//Case 181
|
|
tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible=false;
|
|
|
|
tbManager.Tools["LT:ScheduleMarker.Label.FollowUp"].SharedProps.Visible = AyaBizUtils.Right("Object.ScheduleMarker") > (int)SecurityLevelTypes.NoAccess;
|
|
|
|
//case 73
|
|
tbManager.Tools["LT:O.WikiPage"].SharedProps.Visible = mContract.CanWiki;
|
|
|
|
//case 1172
|
|
tbManager.Tools["LT:AssignedDoc.Label.List"].SharedProps.Visible = !AyaBizUtils.Lite;
|
|
|
|
|
|
//DISABLE EDITABLE CONTROLS
|
|
|
|
//Text editors
|
|
edName.Enabled=!ReadOnly;
|
|
edDiscountParts.Enabled=!ReadOnly;
|
|
edNotes.Enabled=!ReadOnly;
|
|
|
|
//Check boxes
|
|
ckActive.Enabled=!ReadOnly;
|
|
ckContractRatesOnly.Enabled=!ReadOnly;
|
|
|
|
|
|
//Grids
|
|
|
|
if(ReadOnly)
|
|
{
|
|
gridContractRates.DisplayLayout.Override.AllowAddNew=AllowAddNew.No;
|
|
gridContractRates.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False;
|
|
gridContractRates.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False;
|
|
|
|
gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.No;
|
|
gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.False;
|
|
gridCustom.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.False;
|
|
}
|
|
else
|
|
{
|
|
gridContractRates.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom;
|
|
gridContractRates.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True;
|
|
gridContractRates.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.True;
|
|
|
|
gridCustom.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom;
|
|
gridCustom.DisplayLayout.Override.AllowDelete=DefaultableBoolean.True;
|
|
gridCustom.DisplayLayout.Override.AllowUpdate=DefaultableBoolean.True;
|
|
}
|
|
|
|
//Related object rights
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Form DataBinding and BrokenRules handling
|
|
|
|
bool bShowCustomFields=false;
|
|
/// <summary>
|
|
/// Bind controls to business objects
|
|
/// </summary>
|
|
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
|
|
mContract.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged);
|
|
|
|
|
|
//=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
//Text editors
|
|
Util.BindField(edName,"Text",mContract,"Name");
|
|
Util.BindField(edDiscountParts,"Value",mContract,"DiscountParts");
|
|
Util.BindField(edNotes,"Text",mContract,"Notes");
|
|
|
|
//Check boxes
|
|
Util.BindField(ckActive,"Checked",mContract,"Active");
|
|
Util.BindField(ckContractRatesOnly, "Checked", mContract, "ContractRatesOnly");
|
|
|
|
Util.BindField(cbRegion, "Value", mContract, "RegionID");//case 58
|
|
|
|
|
|
//Grids
|
|
Util.BindField(gridContractRates,"DataSource",mContract,"Rates");
|
|
|
|
|
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
|
|
//display Contract name in title bar
|
|
this.Text=mContract.Name;
|
|
|
|
//Bind IsDirty property to hidden checkbox to
|
|
//ensure isdirtychanged event is available
|
|
//to data binding infrastructure
|
|
Util.BindField(ckIsDirty,"Checked",mContract,"IsDirty");
|
|
|
|
//Setup initial link to broken rules
|
|
OnBrokenRulesChanged(null,null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Handle a change in broken rules
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnBrokenRulesChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
|
|
{
|
|
Util.BrokenRuleFeedback(this,mContract,ErrorProvider);
|
|
|
|
}
|
|
|
|
|
|
|
|
#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, mContract.RegionID, true);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Business object editing / adding / deletion related code
|
|
|
|
|
|
private Contract mContract;
|
|
/// <summary>
|
|
/// Contract record to display
|
|
/// set by caller
|
|
/// </summary>
|
|
public Contract ContractToEdit
|
|
{
|
|
get
|
|
{
|
|
return mContract;
|
|
}
|
|
set
|
|
{
|
|
mContract=value;
|
|
//mContract.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;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Update record and quit if requested
|
|
///
|
|
/// </summary>
|
|
/// <returns>True if handled, false if not handled</returns>
|
|
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();
|
|
|
|
//Added by John Dec 2 2004 (catches change in grid when above is non focusable)
|
|
|
|
switch(SaveType)
|
|
{
|
|
case RecordActionType.DeleteAndExit:
|
|
if(Util.PromptForDelete()==DialogResult.Yes)
|
|
{
|
|
try
|
|
{
|
|
//Delete, then exit
|
|
Contract.DeleteItem(mContract.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(mContract.IsSavable)
|
|
{
|
|
mContract.ApplyEdit();
|
|
mContract.Save();
|
|
bClosingHandled=true;
|
|
mbChangesMade=true;
|
|
this.Close();
|
|
return true;
|
|
}
|
|
if(mContract.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(mContract.IsSavable)
|
|
{
|
|
mContract.ApplyEdit();
|
|
mContract.Save();
|
|
AddNewContract();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
if(mContract.IsDirty)//dirty and unsaveable due to broken rules
|
|
{
|
|
//User says that's ok, continue on?
|
|
if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes)
|
|
{
|
|
//Ok, add new Contract and don't save old record
|
|
AddNewContract();
|
|
return true;
|
|
}
|
|
else return false;
|
|
|
|
}
|
|
|
|
//Current record isn't dirty so just add a new Contract
|
|
AddNewContract();
|
|
return true;
|
|
|
|
case RecordActionType.SaveOnly:
|
|
if(mContract.IsSavable)
|
|
{
|
|
mContract.ApplyEdit();
|
|
mContract=(Contract)mContract.Save();
|
|
DataBind();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
return true;
|
|
|
|
case RecordActionType.PromptToSave:
|
|
//Prompt to save and save if
|
|
//required
|
|
if(mContract.IsDirty)
|
|
{
|
|
DialogResult dr=Util.PromptForSave();
|
|
if(dr==DialogResult.Cancel)
|
|
{
|
|
//Cancel
|
|
return false;
|
|
}
|
|
if(dr==DialogResult.Yes)
|
|
{
|
|
//Save before exit
|
|
|
|
if(mContract.IsSavable)
|
|
{
|
|
mContract.ApplyEdit();
|
|
mContract.Save();
|
|
mbChangesMade=true;
|
|
return true;
|
|
}
|
|
if(mContract.IsDirty)//dirty and unsaveable due to broken rules
|
|
{
|
|
if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes)
|
|
{
|
|
return true;
|
|
}
|
|
else
|
|
return false;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
///Creates a new Contract record and opens it for editing
|
|
/// </summary>
|
|
private void AddNewContract()
|
|
{
|
|
|
|
//case 1039 //log.Debug("AddNewContract");
|
|
|
|
try
|
|
{
|
|
mContract=Contract.NewItem();
|
|
//mContract.BeginEdit();
|
|
DataBind();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
//log.Error("AddNewContact",ex);
|
|
MessageBox.Show(ex.Message+"\r\n"+ex.Source);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Grid Events
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Override the row insert behaviour and do it ourselves
|
|
/// The grid doesn't seem to support adding a new record automatically
|
|
/// with our editable child collection objects, this does the same thing
|
|
/// and works
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void gridContractRates_BeforeRowInsert(object sender, Infragistics.Win.UltraWinGrid.BeforeRowInsertEventArgs e)
|
|
{
|
|
|
|
//case 1039 //log.Debug("gridContractRates_BeforeRowInsert");
|
|
|
|
mContract.Rates.Add(mContract);
|
|
e.Cancel=true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Grid Initialization
|
|
|
|
|
|
/// <summary>
|
|
/// Get grid ready
|
|
/// </summary>
|
|
private void InitializeGrid()
|
|
{
|
|
|
|
//case 1039 //log.Debug("InitializeGrid");
|
|
|
|
Util.GridPreLocalize("ContractRates",gridContractRates.DisplayLayout.Bands[0]);
|
|
|
|
Util.GridHideEditableBizObjectInternalFields(gridContractRates);
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["ContractID"].Hidden=true;
|
|
PopulateGridValueLists();
|
|
//Util.FetchGridLayout("ContractRates",gridContractRates);
|
|
|
|
//When a grid is in a tab control it doesn't seem to be
|
|
//a part of the controls collection so the
|
|
//localize(this) above doesn't catch it, need's to be done separately:
|
|
Util.LocalizeGrid(gridContractRates);
|
|
//Allow empty string entry on grid
|
|
Util.SetTextColumnsNullable(gridContractRates);
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Populate the drop down lists inside the grid
|
|
/// so they display and can select the correct underlying
|
|
/// value
|
|
/// </summary>
|
|
private void PopulateGridValueLists()
|
|
{
|
|
|
|
//case 1039 //log.Debug("PopulateGridValueLists");
|
|
|
|
RatePickList mRateList=RatePickList.GetListAllActiveRates();
|
|
|
|
//Clear any previous value list from this column
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["RateID"].ValueList=null;
|
|
//Add all potential active items
|
|
ValueList vlRates=new ValueList();
|
|
|
|
|
|
//Empty not valid but looks better this way when new record is added
|
|
//biz object's broken rules will catch any invalide entry anyway
|
|
vlRates.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318
|
|
|
|
//fill list with active labor (service) rates
|
|
foreach(RatePickList.RatePickListInfo ui in mRateList)
|
|
{
|
|
if(ui.Selectable==true && ui.IsContract/*&& ui.RateType==RateTypes.Service*/)
|
|
{
|
|
vlRates.ValueListItems.Add(ui.ID,ui.Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vlRates.SortStyle=ValueListSortStyle.Ascending;
|
|
|
|
|
|
//Bind value lists to correct columns in grid
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["RateID"].ValueList=vlRates;
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["RateID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
gridContractRates.DisplayLayout.Bands[0].Columns["RateID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Custom fields
|
|
|
|
/// <summary>
|
|
/// put custom field data into custom grid and show it if applicable
|
|
/// </summary>
|
|
private void FillCustomFieldGrid()
|
|
{
|
|
|
|
//case 1039 //log.Debug("FillCustomFieldGrid");
|
|
|
|
bShowCustomFields=Util.PrepareCustomFieldsGrid("Contract",gridCustom);
|
|
|
|
if(bShowCustomFields)
|
|
{
|
|
this.panelCustom.Visible=true;
|
|
|
|
Util.GridFromCustomFields(mContract,gridCustom);
|
|
|
|
}
|
|
else
|
|
{
|
|
this.panelCustom.Visible=false;
|
|
}
|
|
|
|
}
|
|
private void gridCustom_AfterCellUpdate(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
|
|
{
|
|
|
|
Util.GridToCustomFields(mContract,gridCustom);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Drag and drop docs
|
|
private void ContractInfoForm_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
|
|
{
|
|
Util.DragEnter(e);
|
|
}
|
|
|
|
private void ContractInfoForm_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
|
|
{
|
|
Util.DragDrop(e, mContract.Docs, RootObjectTypes.Contract, mContract.ID, RootObjectTypes.Contract);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Accelerator keys
|
|
/// <summary>
|
|
/// Case 37
|
|
/// </summary>
|
|
/// <param name="msg"></param>
|
|
/// <param name="keyData"></param>
|
|
/// <returns></returns>
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|