1317 lines
56 KiB
C#
1317 lines
56 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 log4net;
|
|
|
|
namespace AyaNova
|
|
{
|
|
/// <summary>
|
|
/// Summary description for ScheduleMarkerForm.
|
|
/// </summary>
|
|
public class ScheduleMarkerForm : 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 Infragistics.Win.Misc.UltraLabel lblColor;
|
|
private Infragistics.Win.UltraWinEditors.UltraColorPicker cpColor;
|
|
private Infragistics.Win.Misc.UltraLabel lblName;
|
|
private Infragistics.Win.Misc.UltraLabel lblNotes;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edNotes;
|
|
private Infragistics.Win.Misc.UltraLabel lblContractExpireDate;
|
|
private Infragistics.Win.Misc.UltraLabel lblContractStartDate;
|
|
private System.Windows.Forms.Panel ScheduleMarkerForm_Fill_Panel;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleMarkerForm_Toolbars_Dock_Area_Left;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleMarkerForm_Toolbars_Dock_Area_Right;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleMarkerForm_Toolbars_Dock_Area_Top;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleMarkerForm_Toolbars_Dock_Area_Bottom;
|
|
private GZTW.WinForm.Controls.GZDateTimePicker dtStartDate;
|
|
private GZTW.WinForm.Controls.GZDateTimePicker dtStopDate;
|
|
private System.Windows.Forms.CheckBox ckIsDirty;
|
|
private Infragistics.Win.UltraWinEditors.UltraComboEditor cbScheduleMarkerSourceID;
|
|
private Infragistics.Win.Misc.UltraLabel lblScheduleMarkerSourceID;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager;
|
|
private System.Windows.Forms.ErrorProvider epSchedMarker;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edName;
|
|
private Button btnOpenFollowObject;
|
|
private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckCompleted;
|
|
private System.ComponentModel.IContainer components;
|
|
|
|
public ScheduleMarkerForm()
|
|
{
|
|
//
|
|
// 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("PurchaseOrderEntryMenuBar");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew");
|
|
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.Duplicate");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose");
|
|
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory");
|
|
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew");
|
|
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.Close");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool13 = 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:UI.Command.Ordered");
|
|
Infragistics.Win.UltraWinToolbars.ControlContainerTool controlContainerTool1 = new Infragistics.Win.UltraWinToolbars.ControlContainerTool("LT:UI.Command.Closed");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool15 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Duplicate");
|
|
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
|
|
this.lblColor = new Infragistics.Win.Misc.UltraLabel();
|
|
this.cpColor = new Infragistics.Win.UltraWinEditors.UltraColorPicker();
|
|
this.lblName = new Infragistics.Win.Misc.UltraLabel();
|
|
this.lblNotes = new Infragistics.Win.Misc.UltraLabel();
|
|
this.edNotes = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this.lblContractExpireDate = new Infragistics.Win.Misc.UltraLabel();
|
|
this.lblContractStartDate = new Infragistics.Win.Misc.UltraLabel();
|
|
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
|
|
this.ScheduleMarkerForm_Fill_Panel = new System.Windows.Forms.Panel();
|
|
this.ckCompleted = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
|
|
this.btnOpenFollowObject = new System.Windows.Forms.Button();
|
|
this.ckIsDirty = new System.Windows.Forms.CheckBox();
|
|
this.dtStopDate = new GZTW.WinForm.Controls.GZDateTimePicker();
|
|
this.dtStartDate = new GZTW.WinForm.Controls.GZDateTimePicker();
|
|
this.cbScheduleMarkerSourceID = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
|
|
this.lblScheduleMarkerSourceID = new Infragistics.Win.Misc.UltraLabel();
|
|
this.edName = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this.epSchedMarker = new System.Windows.Forms.ErrorProvider(this.components);
|
|
((System.ComponentModel.ISupportInitialize)(this.cpColor)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edNotes)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
|
|
this.ScheduleMarkerForm_Fill_Panel.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckCompleted)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.dtStopDate)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.dtStartDate)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.cbScheduleMarkerSourceID)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.epSchedMarker)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// lblColor
|
|
//
|
|
this.lblColor.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
|
|
this.lblColor.Location = new System.Drawing.Point(3, 157);
|
|
this.lblColor.Name = "lblColor";
|
|
this.lblColor.Size = new System.Drawing.Size(160, 18);
|
|
this.lblColor.TabIndex = 59;
|
|
this.lblColor.Tag = "";
|
|
this.lblColor.Text = "LT:ScheduleMarker.Label.Color";
|
|
//
|
|
// cpColor
|
|
//
|
|
this.cpColor.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
|
this.cpColor.Location = new System.Drawing.Point(298, 157);
|
|
this.cpColor.Name = "cpColor";
|
|
this.cpColor.Size = new System.Drawing.Size(163, 24);
|
|
this.cpColor.TabIndex = 4;
|
|
this.cpColor.Text = "Control";
|
|
//
|
|
// lblName
|
|
//
|
|
this.lblName.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
|
|
this.lblName.Location = new System.Drawing.Point(3, 46);
|
|
this.lblName.Name = "lblName";
|
|
this.lblName.Size = new System.Drawing.Size(160, 19);
|
|
this.lblName.TabIndex = 66;
|
|
this.lblName.Tag = "";
|
|
this.lblName.Text = "LT:ScheduleMarker.Label.Name";
|
|
//
|
|
// 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(3, 275);
|
|
this.lblNotes.Name = "lblNotes";
|
|
this.lblNotes.Size = new System.Drawing.Size(477, 18);
|
|
this.lblNotes.TabIndex = 69;
|
|
this.lblNotes.Tag = "";
|
|
this.lblNotes.Text = "LT:ScheduleMarker.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(3, 300);
|
|
this.edNotes.Multiline = true;
|
|
this.edNotes.Name = "edNotes";
|
|
this.edNotes.Scrollbars = System.Windows.Forms.ScrollBars.Vertical;
|
|
this.edNotes.Size = new System.Drawing.Size(458, 223);
|
|
this.edNotes.TabIndex = 5;
|
|
//
|
|
// lblContractExpireDate
|
|
//
|
|
this.lblContractExpireDate.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
|
|
this.lblContractExpireDate.Location = new System.Drawing.Point(3, 120);
|
|
this.lblContractExpireDate.Name = "lblContractExpireDate";
|
|
this.lblContractExpireDate.Size = new System.Drawing.Size(160, 18);
|
|
this.lblContractExpireDate.TabIndex = 71;
|
|
this.lblContractExpireDate.Tag = "";
|
|
this.lblContractExpireDate.Text = "LT:ScheduleMarker.Label.StopDate";
|
|
//
|
|
// lblContractStartDate
|
|
//
|
|
this.lblContractStartDate.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
|
|
this.lblContractStartDate.Location = new System.Drawing.Point(3, 83);
|
|
this.lblContractStartDate.Name = "lblContractStartDate";
|
|
this.lblContractStartDate.Size = new System.Drawing.Size(160, 19);
|
|
this.lblContractStartDate.TabIndex = 70;
|
|
this.lblContractStartDate.Tag = "";
|
|
this.lblContractStartDate.Text = "LT:ScheduleMarker.Label.StartDate";
|
|
//
|
|
// tbManager
|
|
//
|
|
this.tbManager.DesignerFlags = 1;
|
|
this.tbManager.DockWithinContainer = this;
|
|
this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form);
|
|
this.tbManager.SettingsKey = "ScheduleMarkerForm.tbManager";
|
|
this.tbManager.ShowFullMenusDelay = 500;
|
|
ultraToolbar1.DockedColumn = 0;
|
|
ultraToolbar1.DockedRow = 0;
|
|
ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
buttonTool1,
|
|
buttonTool2,
|
|
buttonTool3,
|
|
buttonTool4,
|
|
buttonTool5,
|
|
buttonTool6,
|
|
buttonTool7});
|
|
ultraToolbar1.Text = "PurchaseOrderEntryMenuBar";
|
|
this.tbManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
|
|
ultraToolbar1});
|
|
this.tbManager.ToolbarSettings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False;
|
|
this.tbManager.ToolbarSettings.AllowFloating = Infragistics.Win.DefaultableBoolean.False;
|
|
this.tbManager.ToolbarSettings.AllowHiding = Infragistics.Win.DefaultableBoolean.False;
|
|
buttonTool8.SharedPropsInternal.AccessibleDescription = "recorddd";
|
|
appearance1.Image = global::AyaNova.Resource1.SaveExit32;
|
|
buttonTool8.SharedPropsInternal.AppearancesLarge.Appearance = appearance1;
|
|
appearance2.Image = global::AyaNova.Resource1.SaveExit16;
|
|
buttonTool8.SharedPropsInternal.AppearancesSmall.Appearance = appearance2;
|
|
buttonTool8.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose";
|
|
appearance3.Image = global::AyaNova.Resource1.RecordHistory32;
|
|
buttonTool9.SharedPropsInternal.AppearancesLarge.Appearance = appearance3;
|
|
appearance4.Image = global::AyaNova.Resource1.RecordHistory16;
|
|
buttonTool9.SharedPropsInternal.AppearancesSmall.Appearance = appearance4;
|
|
buttonTool9.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory";
|
|
buttonTool10.SharedPropsInternal.Caption = "LT:UI.Command.Save";
|
|
buttonTool10.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
appearance5.Image = global::AyaNova.Resource1.SaveNew32;
|
|
buttonTool11.SharedPropsInternal.AppearancesLarge.Appearance = appearance5;
|
|
appearance6.Image = global::AyaNova.Resource1.SaveNew16;
|
|
buttonTool11.SharedPropsInternal.AppearancesSmall.Appearance = appearance6;
|
|
buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.SaveNew";
|
|
buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.Close";
|
|
buttonTool12.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
appearance7.Image = global::AyaNova.Resource1.Delete32;
|
|
buttonTool13.SharedPropsInternal.AppearancesLarge.Appearance = appearance7;
|
|
appearance8.Image = global::AyaNova.Resource1.Delete16;
|
|
buttonTool13.SharedPropsInternal.AppearancesSmall.Appearance = appearance8;
|
|
buttonTool13.SharedPropsInternal.Caption = "LT:UI.Command.Delete";
|
|
buttonTool14.SharedPropsInternal.Caption = "LT:UI.Command.Ordered";
|
|
buttonTool14.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
controlContainerTool1.SharedPropsInternal.Caption = "LT:UI.Command.Closed";
|
|
appearance9.Image = global::AyaNova.Resource1.Duplicate32;
|
|
buttonTool15.SharedPropsInternal.AppearancesLarge.Appearance = appearance9;
|
|
appearance10.Image = global::AyaNova.Resource1.Duplicate16;
|
|
buttonTool15.SharedPropsInternal.AppearancesSmall.Appearance = appearance10;
|
|
buttonTool15.SharedPropsInternal.Caption = "LT:UI.Command.Duplicate";
|
|
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
buttonTool8,
|
|
buttonTool9,
|
|
buttonTool10,
|
|
buttonTool11,
|
|
buttonTool12,
|
|
buttonTool13,
|
|
buttonTool14,
|
|
controlContainerTool1,
|
|
buttonTool15});
|
|
this.tbManager.UseLargeImagesOnToolbar = true;
|
|
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
|
|
//
|
|
// ScheduleMarkerForm_Fill_Panel
|
|
//
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.ckCompleted);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.btnOpenFollowObject);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.ckIsDirty);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.dtStopDate);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.dtStartDate);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.cbScheduleMarkerSourceID);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblScheduleMarkerSourceID);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblContractExpireDate);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblContractStartDate);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblNotes);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.edNotes);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.edName);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblName);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.lblColor);
|
|
this.ScheduleMarkerForm_Fill_Panel.Controls.Add(this.cpColor);
|
|
this.ScheduleMarkerForm_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
|
|
this.ScheduleMarkerForm_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.ScheduleMarkerForm_Fill_Panel.Location = new System.Drawing.Point(0, 43);
|
|
this.ScheduleMarkerForm_Fill_Panel.Name = "ScheduleMarkerForm_Fill_Panel";
|
|
this.ScheduleMarkerForm_Fill_Panel.Size = new System.Drawing.Size(480, 523);
|
|
this.ScheduleMarkerForm_Fill_Panel.TabIndex = 0;
|
|
//
|
|
// ckCompleted
|
|
//
|
|
this.ckCompleted.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.ckCompleted.Location = new System.Drawing.Point(3, 196);
|
|
this.ckCompleted.Name = "ckCompleted";
|
|
this.ckCompleted.Size = new System.Drawing.Size(279, 24);
|
|
this.ckCompleted.TabIndex = 84;
|
|
this.ckCompleted.Text = "LT:ScheduleMarker.Label.Completed";
|
|
//
|
|
// btnOpenFollowObject
|
|
//
|
|
this.btnOpenFollowObject.Location = new System.Drawing.Point(3, 240);
|
|
this.btnOpenFollowObject.Name = "btnOpenFollowObject";
|
|
this.btnOpenFollowObject.Size = new System.Drawing.Size(350, 27);
|
|
this.btnOpenFollowObject.TabIndex = 83;
|
|
this.btnOpenFollowObject.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
this.btnOpenFollowObject.UseVisualStyleBackColor = true;
|
|
this.btnOpenFollowObject.Visible = false;
|
|
this.btnOpenFollowObject.Click += new System.EventHandler(this.btnOpenFollowObject_Click);
|
|
//
|
|
// ckIsDirty
|
|
//
|
|
this.ckIsDirty.Location = new System.Drawing.Point(-346, 111);
|
|
this.ckIsDirty.Name = "ckIsDirty";
|
|
this.ckIsDirty.Size = new System.Drawing.Size(141, 27);
|
|
this.ckIsDirty.TabIndex = 82;
|
|
//
|
|
// dtStopDate
|
|
//
|
|
this.dtStopDate.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
|
this.dtStopDate.GZEnabled = true;
|
|
this.dtStopDate.GZReadOnly = false;
|
|
this.dtStopDate.Location = new System.Drawing.Point(298, 120);
|
|
this.dtStopDate.Name = "dtStopDate";
|
|
this.dtStopDate.Size = new System.Drawing.Size(163, 24);
|
|
this.dtStopDate.TabIndex = 3;
|
|
//
|
|
// dtStartDate
|
|
//
|
|
this.dtStartDate.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
|
this.dtStartDate.GZEnabled = true;
|
|
this.dtStartDate.GZReadOnly = false;
|
|
this.dtStartDate.Location = new System.Drawing.Point(298, 83);
|
|
this.dtStartDate.Name = "dtStartDate";
|
|
this.dtStartDate.Size = new System.Drawing.Size(163, 24);
|
|
this.dtStartDate.TabIndex = 2;
|
|
this.dtStartDate.ValueChanged += new System.EventHandler(this.dtStartDate_ValueChanged);
|
|
//
|
|
// cbScheduleMarkerSourceID
|
|
//
|
|
this.cbScheduleMarkerSourceID.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
|
this.cbScheduleMarkerSourceID.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
this.cbScheduleMarkerSourceID.LimitToList = true;
|
|
this.cbScheduleMarkerSourceID.Location = new System.Drawing.Point(298, 9);
|
|
this.cbScheduleMarkerSourceID.Name = "cbScheduleMarkerSourceID";
|
|
this.cbScheduleMarkerSourceID.Size = new System.Drawing.Size(163, 24);
|
|
this.cbScheduleMarkerSourceID.TabIndex = 0;
|
|
this.cbScheduleMarkerSourceID.ValueChanged += new System.EventHandler(this.cbScheduleMarkerSourceID_ValueChanged);
|
|
//
|
|
// lblScheduleMarkerSourceID
|
|
//
|
|
this.lblScheduleMarkerSourceID.BorderStyleOuter = Infragistics.Win.UIElementBorderStyle.None;
|
|
this.lblScheduleMarkerSourceID.Location = new System.Drawing.Point(3, 9);
|
|
this.lblScheduleMarkerSourceID.Name = "lblScheduleMarkerSourceID";
|
|
this.lblScheduleMarkerSourceID.Size = new System.Drawing.Size(160, 19);
|
|
this.lblScheduleMarkerSourceID.TabIndex = 77;
|
|
this.lblScheduleMarkerSourceID.Tag = "";
|
|
this.lblScheduleMarkerSourceID.Text = "LT:ScheduleMarker.Label.SourceID";
|
|
//
|
|
// edName
|
|
//
|
|
this.edName.Anchor = System.Windows.Forms.AnchorStyles.Top;
|
|
this.edName.Location = new System.Drawing.Point(298, 46);
|
|
this.edName.Name = "edName";
|
|
this.edName.Size = new System.Drawing.Size(163, 24);
|
|
this.edName.TabIndex = 1;
|
|
//
|
|
// _ScheduleMarkerForm_Toolbars_Dock_Area_Left
|
|
//
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.Name = "_ScheduleMarkerForm_Toolbars_Dock_Area_Left";
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 523);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _ScheduleMarkerForm_Toolbars_Dock_Area_Right
|
|
//
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(480, 43);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.Name = "_ScheduleMarkerForm_Toolbars_Dock_Area_Right";
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 523);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _ScheduleMarkerForm_Toolbars_Dock_Area_Top
|
|
//
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.Name = "_ScheduleMarkerForm_Toolbars_Dock_Area_Top";
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(480, 43);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _ScheduleMarkerForm_Toolbars_Dock_Area_Bottom
|
|
//
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 566);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.Name = "_ScheduleMarkerForm_Toolbars_Dock_Area_Bottom";
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(480, 0);
|
|
this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
|
|
//
|
|
// epSchedMarker
|
|
//
|
|
this.epSchedMarker.ContainerControl = this;
|
|
//
|
|
// ScheduleMarkerForm
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
|
this.ClientSize = new System.Drawing.Size(480, 566);
|
|
this.Controls.Add(this.ScheduleMarkerForm_Fill_Panel);
|
|
this.Controls.Add(this._ScheduleMarkerForm_Toolbars_Dock_Area_Left);
|
|
this.Controls.Add(this._ScheduleMarkerForm_Toolbars_Dock_Area_Right);
|
|
this.Controls.Add(this._ScheduleMarkerForm_Toolbars_Dock_Area_Bottom);
|
|
this.Controls.Add(this._ScheduleMarkerForm_Toolbars_Dock_Area_Top);
|
|
this.MinimumSize = new System.Drawing.Size(408, 415);
|
|
this.Name = "ScheduleMarkerForm";
|
|
this.ShowInTaskbar = false;
|
|
this.Tag = "";
|
|
this.Text = "LT:O.ScheduleMarker";
|
|
this.Closing += new System.ComponentModel.CancelEventHandler(this.ScheduleMarkerForm_Closing);
|
|
this.Load += new System.EventHandler(this.ScheduleMarkerForm_Load);
|
|
this.SizeChanged += new System.EventHandler(this.ScheduleMarkerForm_SizeChanged);
|
|
((System.ComponentModel.ISupportInitialize)(this.cpColor)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edNotes)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
|
|
this.ScheduleMarkerForm_Fill_Panel.ResumeLayout(false);
|
|
this.ScheduleMarkerForm_Fill_Panel.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckCompleted)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.dtStopDate)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.dtStartDate)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.cbScheduleMarkerSourceID)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.epSchedMarker)).EndInit();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
|
|
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
|
|
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
|
|
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
|
|
//
|
|
|
|
|
|
#region Form Load / Close
|
|
//variable to hold user form settings
|
|
//UIUserFormSetting mFormSetting;
|
|
|
|
public bool bHideFollowObjectButton = false;
|
|
|
|
/// <summary>
|
|
/// Prepare the form
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void ScheduleMarkerForm_Load(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ScheduleMarkerForm_Load");
|
|
|
|
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
this.Visible=false;
|
|
this.Icon = Resource1.ScheduleMarker16icon;
|
|
|
|
//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 Region edit screen from elsewhere in the program)
|
|
if(AyaBizUtils.Right("Object.ScheduleMarker")< (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.ScheduleMarker")));
|
|
|
|
this.Close();
|
|
return;
|
|
}
|
|
|
|
|
|
//Set locale input format for dates
|
|
//dtStartDate.MaskInput=Util.LocaleDateTimeMask();
|
|
//dtStopDate.MaskInput=Util.LocaleDateTimeMask();
|
|
|
|
|
|
|
|
InitializeComboBoxes();
|
|
DataBind();
|
|
Util.LoadFormCustomization("ScheduleMarkerInfo", this, tbManager, false);
|
|
|
|
Util.PluginInsertMenu(tbManager, new Util.PluginMenuOptionData(true, RootObjectTypes.ScheduleMarker, mScheduleMarker, null));//case 941
|
|
Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810
|
|
Util.Localize(this);
|
|
Cursor.Current = Cursors.Default;
|
|
|
|
//Case 152
|
|
(new TabOrderManager(this)).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
|
|
|
|
//restrict UI based on security settings
|
|
RestrictUI();
|
|
|
|
if (mScheduleMarker.FollowID != Guid.Empty)
|
|
this.Text = Util.LocaleText.GetLocalizedText("ScheduleMarker.Label.FollowUp");
|
|
|
|
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 ScheduleMarkerForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ScheduleMarkerForm_Closing");
|
|
|
|
|
|
if(!bClosingHandled && (AyaBizUtils.Right("Object.ScheduleMarker")> (int)SecurityLevelTypes.ReadOnly))
|
|
{
|
|
//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("ScheduleMarkerInfo", this, tbManager, false);
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region Form sizing
|
|
private void ScheduleMarkerForm_SizeChanged(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("ScheduleMarkerForm_SizeChanged");
|
|
|
|
//Size of controls
|
|
//One third
|
|
int nLeftWidth=(this.DisplayRectangle.Width/3);
|
|
//two thirds
|
|
int nRightWidth=this.DisplayRectangle.Width-nLeftWidth;
|
|
//make room for error icons
|
|
nRightWidth-=16;
|
|
|
|
//case 3179 overlapping
|
|
int nGap = 16;
|
|
|
|
this.lblScheduleMarkerSourceID.Width = nLeftWidth - nGap;
|
|
this.cbScheduleMarkerSourceID.Left=nLeftWidth;
|
|
this.cbScheduleMarkerSourceID.Width=nRightWidth;
|
|
|
|
this.lblName.Width = nLeftWidth - nGap;
|
|
this.edName.Left=nLeftWidth;
|
|
this.edName.Width=nRightWidth;
|
|
|
|
this.lblContractStartDate.Width = nLeftWidth - nGap;
|
|
this.dtStartDate.Left=nLeftWidth;
|
|
this.dtStartDate.Width=nRightWidth;
|
|
|
|
this.lblContractExpireDate.Width = nLeftWidth - nGap;
|
|
this.dtStopDate.Left=nLeftWidth;
|
|
this.dtStopDate.Width=nRightWidth;
|
|
|
|
this.lblColor.Width = nLeftWidth - nGap;
|
|
this.cpColor.Left=nLeftWidth;
|
|
this.cpColor.Width=nRightWidth;
|
|
|
|
}
|
|
|
|
|
|
#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)
|
|
{
|
|
//case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("ToolClick: "+e.Tool.Key);
|
|
|
|
|
|
switch (e.Tool.Key)
|
|
{
|
|
case "LT:UI.Command.SaveClose": // ButtonTool
|
|
RecordUpdate(RecordActionType.SaveAndExit);
|
|
break;
|
|
|
|
case "LT:UI.Command.RecordHistory": // ButtonTool
|
|
RecordHistoryForm RH=new RecordHistoryForm(mScheduleMarker.Creator,mScheduleMarker.Modifier,mScheduleMarker.Created,mScheduleMarker.Modified);
|
|
RH.ShowDialog(); RH.Dispose();
|
|
break;
|
|
|
|
case "LT:UI.Command.Save": // ButtonTool
|
|
RecordUpdate(RecordActionType.SaveOnly);
|
|
break;
|
|
|
|
case "LT:UI.Command.SaveNew": // ButtonTool
|
|
RecordUpdate(RecordActionType.SaveAndNew);
|
|
break;
|
|
|
|
case "LT:UI.Command.Close": // ButtonTool
|
|
this.Close();
|
|
break;
|
|
|
|
|
|
case "LT:UI.Command.Delete": // ButtonTool
|
|
RecordUpdate(RecordActionType.DeleteAndExit);
|
|
break;
|
|
|
|
case "LT:UI.Command.Duplicate": // ButtonTool
|
|
ScheduleMarker smOld=this.mScheduleMarker;
|
|
try
|
|
{
|
|
mScheduleMarker=GZTW.AyaNova.BLL.ScheduleMarker.NewItem();
|
|
//mScheduleMarker.BeginEdit();
|
|
mScheduleMarker.ARGB=smOld.ARGB;
|
|
mScheduleMarker.StartDate=smOld.StartDate;
|
|
mScheduleMarker.StopDate=smOld.StopDate;
|
|
mScheduleMarker.SourceID=smOld.SourceID;
|
|
mScheduleMarker.ScheduleMarkerSourceType=smOld.ScheduleMarkerSourceType;
|
|
mScheduleMarker.Name=smOld.Name;
|
|
mScheduleMarker.Notes=smOld.Notes;
|
|
DataBind();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message+"\r\n"+ex.Source);
|
|
}
|
|
|
|
|
|
|
|
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()
|
|
{
|
|
|
|
tbManager.Tools["LT:UI.Command.Duplicate"].SharedProps.Enabled=!mScheduleMarker.IsDirty;
|
|
|
|
|
|
|
|
}
|
|
/// <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()
|
|
{
|
|
SecurityLevelTypes right=(SecurityLevelTypes)AyaBizUtils.Right("Object.ScheduleMarker");
|
|
|
|
bool bReadOnly = right < SecurityLevelTypes.ReadWrite;
|
|
//case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("RestrictUI: " + right.ToString());
|
|
|
|
tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=(right== SecurityLevelTypes.ReadWriteDelete);
|
|
|
|
|
|
tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!bReadOnly;
|
|
tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Visible = !bReadOnly && mScheduleMarker.FollowID == Guid.Empty;
|
|
tbManager.Tools["LT:UI.Command.Duplicate"].SharedProps.Visible = !bReadOnly && mScheduleMarker.FollowID == Guid.Empty;
|
|
tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible = !bReadOnly;
|
|
|
|
tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible=true;
|
|
|
|
edName.Enabled = !bReadOnly;
|
|
edNotes.Enabled = !bReadOnly;
|
|
cbScheduleMarkerSourceID.Enabled = !bReadOnly;
|
|
cpColor.Enabled = !bReadOnly;
|
|
dtStartDate.Enabled = !bReadOnly;
|
|
dtStopDate.Enabled = !bReadOnly;
|
|
|
|
ckCompleted.Enabled = !bReadOnly;
|
|
|
|
bool bshow = !bHideFollowObjectButton;
|
|
bshow = bshow && mScheduleMarker.FollowID != Guid.Empty;
|
|
|
|
btnOpenFollowObject.Visible=bshow;
|
|
if(bshow)
|
|
btnOpenFollowObject.Text=NameFetcher.GetItem(new TypeAndID(mScheduleMarker.FollowType,mScheduleMarker.FollowID)).RecordName;
|
|
|
|
//case 1208
|
|
if (AyaBizUtils.Lite)
|
|
cbScheduleMarkerSourceID.Enabled = false;
|
|
}
|
|
#endregion
|
|
|
|
#region Form DataBinding and BrokenRules handling
|
|
|
|
|
|
/// <summary>
|
|
/// Bind controls to business objects
|
|
/// </summary>
|
|
private void DataBind()
|
|
{
|
|
//case 1039 //log.Debug("DataBind");
|
|
|
|
//Subscribe to broken rules changed event OnBrokenRulesChanged
|
|
mScheduleMarker.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged);
|
|
|
|
|
|
//=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
//Text editors
|
|
Util.BindField(edName,"Text",mScheduleMarker,"Name");
|
|
Util.BindField(edNotes,"Text",mScheduleMarker,"Notes");
|
|
|
|
|
|
//Date and time
|
|
Util.BindField(dtStartDate,"Value", mScheduleMarker,"StartDate");
|
|
Util.BindField(dtStopDate,"Value", mScheduleMarker,"StopDate");
|
|
|
|
//Check boxes
|
|
Util.BindField(ckCompleted, "Checked", mScheduleMarker, "Completed");
|
|
|
|
|
|
//Color which can't be bound but can be set here and in
|
|
//the save function
|
|
cpColor.Color=Color.FromArgb(mScheduleMarker.ARGB);
|
|
|
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
|
|
//Bind IsDirty property to hidden checkbox to
|
|
//ensure isdirtychanged event is available
|
|
//to data binding infrastructure
|
|
Util.BindField(ckIsDirty,"Checked",mScheduleMarker,"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,mScheduleMarker,epSchedMarker);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Business object editing / adding / deletion related code
|
|
|
|
|
|
private GZTW.AyaNova.BLL.ScheduleMarker mScheduleMarker;
|
|
/// <summary>
|
|
/// ScheduleMarker record to display
|
|
/// set by caller
|
|
/// </summary>
|
|
public GZTW.AyaNova.BLL.ScheduleMarker ScheduleMarkerToEdit
|
|
{
|
|
get
|
|
{
|
|
return mScheduleMarker;
|
|
}
|
|
set
|
|
{
|
|
mScheduleMarker=value;
|
|
//mScheduleMarker.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
|
|
lblScheduleMarkerSourceID.Focus();
|
|
|
|
//Bind data from unbindable controls
|
|
cbScheduleMarkerSourceID_ValueChanged(null,null);
|
|
mScheduleMarker.ARGB=cpColor.Color.ToArgb();
|
|
|
|
switch(SaveType)
|
|
{
|
|
case RecordActionType.DeleteAndExit:
|
|
|
|
|
|
if(Util.PromptForDelete()==DialogResult.Yes)
|
|
{
|
|
//Delete, then exit
|
|
try{
|
|
ScheduleMarker.DeleteItem(mScheduleMarker.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(mScheduleMarker.IsSavable)
|
|
{
|
|
mScheduleMarker.ApplyEdit();
|
|
mScheduleMarker.Save();
|
|
bClosingHandled=true;
|
|
mbChangesMade=true;
|
|
this.Close();
|
|
return true;
|
|
}
|
|
if(mScheduleMarker.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(mScheduleMarker.IsSavable)
|
|
{
|
|
mScheduleMarker.ApplyEdit();
|
|
mScheduleMarker.Save();
|
|
AddNewScheduleMarker();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
if(mScheduleMarker.IsDirty)//dirty and unsaveable due to broken rules
|
|
{
|
|
//User says that's ok, continue on?
|
|
if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes)
|
|
{
|
|
//Ok, add new Region and don't save old record
|
|
AddNewScheduleMarker();
|
|
return true;
|
|
}
|
|
else return false;
|
|
|
|
}
|
|
|
|
//Current record isn't dirty so just add a new one
|
|
AddNewScheduleMarker();
|
|
return true;
|
|
|
|
case RecordActionType.SaveOnly:
|
|
if(mScheduleMarker.IsSavable)
|
|
{
|
|
mScheduleMarker.ApplyEdit();
|
|
mScheduleMarker=(GZTW.AyaNova.BLL.ScheduleMarker)mScheduleMarker.Save();
|
|
DataBind();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
return true;
|
|
|
|
case RecordActionType.PromptToSave:
|
|
//Prompt to save and save if
|
|
//required
|
|
if(mScheduleMarker.IsDirty)
|
|
{
|
|
DialogResult dr=Util.PromptForSave();
|
|
if(dr==DialogResult.Cancel)
|
|
{
|
|
//Cancel
|
|
return false;
|
|
}
|
|
if(dr==DialogResult.Yes)
|
|
{
|
|
//Save before exit
|
|
|
|
if(mScheduleMarker.IsSavable)
|
|
{
|
|
mScheduleMarker.ApplyEdit();
|
|
mScheduleMarker.Save();
|
|
mbChangesMade=true;
|
|
return true;
|
|
}
|
|
if(mScheduleMarker.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 ScheduleMarker record and opens it for editing
|
|
/// </summary>
|
|
private void AddNewScheduleMarker()
|
|
{
|
|
//case 1039 //log.Debug("AddNewScheduleMarker");
|
|
|
|
try
|
|
{
|
|
mScheduleMarker=GZTW.AyaNova.BLL.ScheduleMarker.NewItem();
|
|
|
|
//mScheduleMarker.BeginEdit();
|
|
DataBind();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
//log.Error("AddNewScheduleMarker",ex);
|
|
|
|
MessageBox.Show(ex.Message+"\r\n"+ex.Source);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Form ComboBoxes (Setup / Events)
|
|
|
|
|
|
//This combo can't be bound because it's got more than just the ID in it's value column
|
|
private void cbScheduleMarkerSourceID_ValueChanged(object sender, System.EventArgs e)
|
|
{
|
|
if (cbScheduleMarkerSourceID.SelectedItem == null) return;
|
|
TypeAndID ti=(TypeAndID)cbScheduleMarkerSourceID.SelectedItem.DataValue;
|
|
if (mScheduleMarker.SourceID != ti.ID)
|
|
{
|
|
mScheduleMarker.SourceID = ti.ID;
|
|
switch (ti.RootObjectType)
|
|
{
|
|
case RootObjectTypes.Global:
|
|
mScheduleMarker.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.Global;
|
|
break;
|
|
case RootObjectTypes.Region:
|
|
mScheduleMarker.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.Regional;
|
|
break;
|
|
case RootObjectTypes.User:
|
|
mScheduleMarker.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.User;
|
|
break;
|
|
case RootObjectTypes.DispatchZone:
|
|
mScheduleMarker.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.DispatchZone;
|
|
break;
|
|
case RootObjectTypes.ScheduleableUserGroup:
|
|
mScheduleMarker.ScheduleMarkerSourceType = ScheduleMarkerSourceTypes.ScheduleableUserGroup;
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void InitializeComboBoxes()
|
|
{
|
|
//case 1039 //log.Debug("InitializeComboBoxes");
|
|
|
|
if (mScheduleMarker.FollowID == Guid.Empty)
|
|
{
|
|
//Load combo boxes with initial values
|
|
//Global object
|
|
cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.Global, ScheduleMarker.ScheduleMarkerGlobalSourceID), Util.LocaleText.GetLocalizedText("O.Global"));
|
|
|
|
//Regions...
|
|
//NVCHANGED
|
|
GenericNVList l = GenericNVList.GetList("aRegion", "aID", "aName", true, false,true);
|
|
|
|
|
|
//Loop through the items in the list and put them
|
|
//into the valuelist
|
|
for (int x = 0; x < l.Count; x++)
|
|
{
|
|
|
|
cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.Region,
|
|
new Guid(((DictionaryEntry)l.BindableList[x]).Key.ToString())),
|
|
Util.LocaleText.GetLocalizedText("O.Region") + " - " + ((DictionaryEntry)l.BindableList[x]).Value.ToString());
|
|
|
|
}
|
|
}
|
|
//***************************************************************
|
|
//Scheduleable users....
|
|
|
|
UserListScheduleable mUserList = UserListScheduleable.GetList();
|
|
foreach(UserListScheduleable.UserListScheduleableInfo ui in mUserList)
|
|
{
|
|
if(ui.Active==true)
|
|
{
|
|
cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.User,
|
|
ui.ID),
|
|
Util.LocaleText.GetLocalizedText("O.User")+" - " + ui.Name(Util.GlobalSettings.DefaultScheduleableUserNameDisplayFormat) );
|
|
|
|
}
|
|
}
|
|
|
|
//INACTIVE USER? (Only a user can be inactive)
|
|
|
|
//Is it a user?
|
|
if(mScheduleMarker.ScheduleMarkerSourceType==ScheduleMarkerSourceTypes.User)
|
|
{
|
|
//Get that user record from the list we already have
|
|
foreach(UserListScheduleable.UserListScheduleableInfo ui in mUserList)
|
|
{
|
|
if(ui.ID==mScheduleMarker.SourceID)
|
|
{
|
|
if(ui.Active==true)
|
|
break; //if active then it's already in the list
|
|
else
|
|
{
|
|
//found but not active so add to list as In-Active item
|
|
ValueListItem vi=cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.User,
|
|
ui.ID),
|
|
Util.LocaleText.GetLocalizedText("O.User")+" - " + ui.Name(Util.GlobalSettings.DefaultScheduleableUserNameDisplayFormat) );
|
|
vi.Appearance.ForeColor=System.Drawing.SystemColors.GrayText;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//*****************************************************************************
|
|
|
|
|
|
if (mScheduleMarker.FollowID == Guid.Empty)
|
|
{
|
|
|
|
|
|
//***************************************************************
|
|
//Dispatch zones
|
|
|
|
DispatchZonePickList DispatchZoneList = DispatchZonePickList.GetList(true);
|
|
foreach (DispatchZonePickList.DispatchZonePickListInfo di in DispatchZoneList)
|
|
{
|
|
if (di.Active == true)
|
|
{
|
|
cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.DispatchZone,
|
|
di.ID),
|
|
Util.LocaleText.GetLocalizedText("O.DispatchZone") + " - " + di.Name);
|
|
|
|
}
|
|
}
|
|
|
|
//INACTIVE ZONE?
|
|
|
|
//Is it a Zone?
|
|
if (mScheduleMarker.ScheduleMarkerSourceType == ScheduleMarkerSourceTypes.DispatchZone)
|
|
{
|
|
//Get that zone record from the list we already have
|
|
foreach (DispatchZonePickList.DispatchZonePickListInfo di in DispatchZoneList)
|
|
{
|
|
if (di.ID == mScheduleMarker.SourceID)
|
|
{
|
|
if (di.Active == true)
|
|
break; //if active then it's already in the list
|
|
else
|
|
{
|
|
//found but not active so add to list as In-Active item
|
|
ValueListItem vi = cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.DispatchZone,
|
|
di.ID),
|
|
Util.LocaleText.GetLocalizedText("O.DispatchZone") + " - " + di.Name);
|
|
vi.Appearance.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//*****************************************************************************
|
|
|
|
|
|
|
|
//***************************************************************
|
|
//Scheduleable user GROUPS....
|
|
|
|
ScheduleableUserGroupPickList GroupList = ScheduleableUserGroupPickList.GetList();
|
|
foreach (ScheduleableUserGroupPickList.ScheduleableUserGroupPickListInfo gi in GroupList)
|
|
{
|
|
if (gi.Active == true)
|
|
{
|
|
cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.ScheduleableUserGroup,
|
|
gi.ID),
|
|
Util.LocaleText.GetLocalizedText("O.ScheduleableUserGroup") + " - " + gi.Name);
|
|
|
|
}
|
|
}
|
|
|
|
//INACTIVE ScheduleableUserGroup?
|
|
|
|
//Is it a user?
|
|
if (mScheduleMarker.ScheduleMarkerSourceType == ScheduleMarkerSourceTypes.ScheduleableUserGroup)
|
|
{
|
|
//Get that ScheduleableUserGroup record from the list we already have
|
|
foreach (ScheduleableUserGroupPickList.ScheduleableUserGroupPickListInfo gi in GroupList)
|
|
{
|
|
if (gi.ID == mScheduleMarker.SourceID)
|
|
{
|
|
if (gi.Active == true)
|
|
break; //if active then it's already in the list
|
|
else
|
|
{
|
|
//found but not active so add to list as In-Active item
|
|
ValueListItem vi = cbScheduleMarkerSourceID.Items.Add(new TypeAndID(RootObjectTypes.ScheduleableUserGroup,
|
|
gi.ID),
|
|
Util.LocaleText.GetLocalizedText("O.ScheduleableUserGroup") + " - " + gi.Name);
|
|
vi.Appearance.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//*****************************************************************************
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
*
|
|
* */
|
|
|
|
//Select initial value because combo box can't be bound as normal
|
|
foreach(ValueListItem vi in cbScheduleMarkerSourceID.Items)
|
|
{
|
|
if(((TypeAndID)vi.DataValue).ID==mScheduleMarker.SourceID)
|
|
{
|
|
cbScheduleMarkerSourceID.SelectedItem=vi;
|
|
break;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void dtStartDate_ValueChanged(object sender, System.EventArgs e)
|
|
{
|
|
////case 1039 //log.Debug("dtStartDate_ValueChanged");
|
|
|
|
//if(dtStopDate.Value!=null)
|
|
//{
|
|
// DateTime dtStop=(DateTime)dtStopDate.Value;
|
|
// DateTime dtStart=(DateTime)dtStartDate.Value;
|
|
// DateTime dtNew=new DateTime(dtStart.Year,dtStart.Month,dtStart.Day,dtStop.Hour,dtStop.Minute,dtStop.Second);
|
|
// dtStopDate.Value=dtNew;
|
|
//}
|
|
}
|
|
|
|
|
|
|
|
#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
|
|
|
|
private void btnOpenFollowObject_Click(object sender, EventArgs e)
|
|
{
|
|
Util.EditRecord(mScheduleMarker.FollowType, mScheduleMarker.FollowID);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|