using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using GZTW.AyaNova.BLL; using Infragistics.Win; using log4net; using System.Data; namespace AyaNova { /// /// Summary description for NotifyEventSelector. /// public class NotifyEventSelector : 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.UltraWinToolbars.UltraToolbarsManager tbManager; private System.Windows.Forms.Panel NotifyEventSelector_Fill_Panel; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _NotifyEventSelector_Toolbars_Dock_Area_Left; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _NotifyEventSelector_Toolbars_Dock_Area_Right; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _NotifyEventSelector_Toolbars_Dock_Area_Top; private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _NotifyEventSelector_Toolbars_Dock_Area_Bottom; private Infragistics.Win.Misc.UltraButton btnClientID; private GZTW.WinForm.Controls.GZUltraComboEditor cbNotificationEvents; private System.Windows.Forms.Panel panelWorkorderStatus; private GZTW.WinForm.Controls.GZUltraComboEditor cbWorkorderStatus; private Infragistics.Win.Misc.UltraLabel ultraLabel2; private System.ComponentModel.IContainer components; public NotifyEventSelector() { // // Required for Windows Form Designer support // InitializeComponent(); // // // } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("UltraToolbar1"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.OK"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Cancel"); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Cancel"); Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance(); Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.OK"); Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance(); Infragistics.Win.ValueListItem valueListItem2 = new Infragistics.Win.ValueListItem(); Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); Infragistics.Win.ValueListItem valueListItem1 = new Infragistics.Win.ValueListItem(); Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance(); Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance(); this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components); this.NotifyEventSelector_Fill_Panel = new System.Windows.Forms.Panel(); this.panelWorkorderStatus = new System.Windows.Forms.Panel(); this.cbWorkorderStatus = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.ultraLabel2 = new Infragistics.Win.Misc.UltraLabel(); this.cbNotificationEvents = new GZTW.WinForm.Controls.GZUltraComboEditor(); this.btnClientID = new Infragistics.Win.Misc.UltraButton(); this._NotifyEventSelector_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._NotifyEventSelector_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._NotifyEventSelector_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); this._NotifyEventSelector_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea(); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit(); this.NotifyEventSelector_Fill_Panel.SuspendLayout(); this.panelWorkorderStatus.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbWorkorderStatus)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.cbNotificationEvents)).BeginInit(); this.SuspendLayout(); // // 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}); ultraToolbar1.Text = "NotifyEventSelectorToolbar"; 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; appearance4.Image = global::AyaNova.Resource1.Cancel32; buttonTool3.SharedPropsInternal.AppearancesLarge.Appearance = appearance4; appearance5.Image = global::AyaNova.Resource1.Cancel16; buttonTool3.SharedPropsInternal.AppearancesSmall.Appearance = appearance5; buttonTool3.SharedPropsInternal.Caption = "LT:UI.Command.Cancel"; appearance6.Image = global::AyaNova.Resource1.OK32; buttonTool4.SharedPropsInternal.AppearancesLarge.Appearance = appearance6; appearance7.Image = global::AyaNova.Resource1.OK16; buttonTool4.SharedPropsInternal.AppearancesSmall.Appearance = appearance7; buttonTool4.SharedPropsInternal.Caption = "LT:UI.Command.OK"; this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] { buttonTool3, buttonTool4}); this.tbManager.UseLargeImagesOnToolbar = true; this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick); // // NotifyEventSelector_Fill_Panel // this.NotifyEventSelector_Fill_Panel.Controls.Add(this.panelWorkorderStatus); this.NotifyEventSelector_Fill_Panel.Controls.Add(this.cbNotificationEvents); this.NotifyEventSelector_Fill_Panel.Controls.Add(this.btnClientID); this.NotifyEventSelector_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default; this.NotifyEventSelector_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill; this.NotifyEventSelector_Fill_Panel.Location = new System.Drawing.Point(0, 43); this.NotifyEventSelector_Fill_Panel.Name = "NotifyEventSelector_Fill_Panel"; this.NotifyEventSelector_Fill_Panel.Size = new System.Drawing.Size(528, 109); this.NotifyEventSelector_Fill_Panel.TabIndex = 0; // // panelWorkorderStatus // this.panelWorkorderStatus.Controls.Add(this.cbWorkorderStatus); this.panelWorkorderStatus.Controls.Add(this.ultraLabel2); this.panelWorkorderStatus.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelWorkorderStatus.Location = new System.Drawing.Point(0, 63); this.panelWorkorderStatus.Name = "panelWorkorderStatus"; this.panelWorkorderStatus.Size = new System.Drawing.Size(528, 46); this.panelWorkorderStatus.TabIndex = 156; // // cbWorkorderStatus // this.cbWorkorderStatus.AllowEmptySelection = false; this.cbWorkorderStatus.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend; appearance1.BackColor = System.Drawing.SystemColors.GrayText; valueListItem2.Appearance = appearance1; valueListItem2.DataValue = new System.Guid("00000000-0000-0000-0000-000000000000"); valueListItem2.DisplayText = ""; appearance2.BackColor = System.Drawing.SystemColors.GrayText; valueListItem1.Appearance = appearance2; valueListItem1.DataValue = new System.Guid("00000000-0000-0000-0000-000000000000"); valueListItem1.DisplayText = ""; this.cbWorkorderStatus.Items.AddRange(new Infragistics.Win.ValueListItem[] { valueListItem2, valueListItem1}); this.cbWorkorderStatus.LimitToList = true; this.cbWorkorderStatus.Location = new System.Drawing.Point(2, 18); this.cbWorkorderStatus.MaxDropDownItems = 25; this.cbWorkorderStatus.Name = "cbWorkorderStatus"; this.cbWorkorderStatus.Size = new System.Drawing.Size(630, 24); this.cbWorkorderStatus.SortStyle = Infragistics.Win.ValueListSortStyle.Ascending; this.cbWorkorderStatus.TabIndex = 152; this.cbWorkorderStatus.ValueChanged += new System.EventHandler(this.cbWorkorderStatus_ValueChanged); // // ultraLabel2 // this.ultraLabel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ultraLabel2.Location = new System.Drawing.Point(10, 0); this.ultraLabel2.Name = "ultraLabel2"; this.ultraLabel2.Size = new System.Drawing.Size(508, 18); this.ultraLabel2.TabIndex = 151; this.ultraLabel2.Tag = ""; this.ultraLabel2.Text = "LT:O.WorkorderStatus"; this.ultraLabel2.WrapText = false; // // cbNotificationEvents // this.cbNotificationEvents.AllowEmptySelection = false; this.cbNotificationEvents.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.cbNotificationEvents.Location = new System.Drawing.Point(0, 28); this.cbNotificationEvents.Name = "cbNotificationEvents"; this.cbNotificationEvents.Size = new System.Drawing.Size(528, 24); this.cbNotificationEvents.TabIndex = 149; this.cbNotificationEvents.ValueChanged += new System.EventHandler(this.cbNotificationEvents_ValueChanged); // // btnClientID // this.btnClientID.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); appearance3.TextHAlignAsString = "Left"; this.btnClientID.Appearance = appearance3; this.btnClientID.ButtonStyle = Infragistics.Win.UIElementButtonStyle.PopupBorderless; this.btnClientID.Location = new System.Drawing.Point(0, 0); this.btnClientID.Name = "btnClientID"; this.btnClientID.Size = new System.Drawing.Size(528, 28); this.btnClientID.TabIndex = 148; this.btnClientID.Tag = ""; this.btnClientID.Text = "LT:O.Notification"; this.btnClientID.UseHotTracking = Infragistics.Win.DefaultableBoolean.True; // // _NotifyEventSelector_Toolbars_Dock_Area_Left // this._NotifyEventSelector_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._NotifyEventSelector_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control; this._NotifyEventSelector_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left; this._NotifyEventSelector_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText; this._NotifyEventSelector_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43); this._NotifyEventSelector_Toolbars_Dock_Area_Left.Name = "_NotifyEventSelector_Toolbars_Dock_Area_Left"; this._NotifyEventSelector_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 109); this._NotifyEventSelector_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager; // // _NotifyEventSelector_Toolbars_Dock_Area_Right // this._NotifyEventSelector_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._NotifyEventSelector_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control; this._NotifyEventSelector_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right; this._NotifyEventSelector_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText; this._NotifyEventSelector_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(528, 43); this._NotifyEventSelector_Toolbars_Dock_Area_Right.Name = "_NotifyEventSelector_Toolbars_Dock_Area_Right"; this._NotifyEventSelector_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 109); this._NotifyEventSelector_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager; // // _NotifyEventSelector_Toolbars_Dock_Area_Top // this._NotifyEventSelector_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._NotifyEventSelector_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control; this._NotifyEventSelector_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top; this._NotifyEventSelector_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText; this._NotifyEventSelector_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0); this._NotifyEventSelector_Toolbars_Dock_Area_Top.Name = "_NotifyEventSelector_Toolbars_Dock_Area_Top"; this._NotifyEventSelector_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(528, 43); this._NotifyEventSelector_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager; // // _NotifyEventSelector_Toolbars_Dock_Area_Bottom // this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping; this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control; this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom; this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText; this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 152); this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.Name = "_NotifyEventSelector_Toolbars_Dock_Area_Bottom"; this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(528, 0); this._NotifyEventSelector_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager; // // NotifyEventSelector // this.AutoScaleBaseSize = new System.Drawing.Size(6, 15); this.ClientSize = new System.Drawing.Size(528, 152); this.Controls.Add(this.NotifyEventSelector_Fill_Panel); this.Controls.Add(this._NotifyEventSelector_Toolbars_Dock_Area_Left); this.Controls.Add(this._NotifyEventSelector_Toolbars_Dock_Area_Right); this.Controls.Add(this._NotifyEventSelector_Toolbars_Dock_Area_Bottom); this.Controls.Add(this._NotifyEventSelector_Toolbars_Dock_Area_Top); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "NotifyEventSelector"; this.ShowInTaskbar = false; this.Closing += new System.ComponentModel.CancelEventHandler(this.NotifyEventSelector_Closing); this.Load += new System.EventHandler(this.NotifyEventSelector_Load); ((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit(); this.NotifyEventSelector_Fill_Panel.ResumeLayout(false); this.NotifyEventSelector_Fill_Panel.PerformLayout(); this.panelWorkorderStatus.ResumeLayout(false); this.panelWorkorderStatus.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.cbWorkorderStatus)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.cbNotificationEvents)).EndInit(); this.ResumeLayout(false); } #endregion // __ _ _ ___ ____ __ __ __ __ __ ___ ___ // / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _) // ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _) // \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___) // #region Global vars / Properties //Get a datable containing all events and their selection status DataTable mEventsTable; private NotifySubscriber _Subscriber=null; private RootObjectTypes mSelectedRootObjectType; public RootObjectTypes SelectedRootObjectType { get{ return mSelectedRootObjectType;} } private int mSelectedEventType=-1;//case 1561 public int SelectedEventType { get{ return mSelectedEventType;} } private Guid mSelectedWorkorderStatus; public Guid SelectedWorkorderStatus { get{ return mSelectedWorkorderStatus;} } #endregion #region Load / close events private void NotifyEventSelector_Load(object sender, System.EventArgs e) { //case 1039 //log.Debug("NotifyEventSelector_Load"); this.Icon = Resource1.NotificationDeliveryMethod16icon; _Subscriber=NotifySubscriber.GetItem(User.CurrentThreadUserID); mEventsTable=NotifyEventUIHelper.GetEventsTable(_Subscriber); Util.Localize(this); LoadCombo(); this.panelWorkorderStatus.Visible=false; Util.LoadFormCustomization("NotifyEventSelector", this, tbManager, true); Application.Idle+= new EventHandler(Application_Idle); } private void NotifyEventSelector_Closing(object sender, System.ComponentModel.CancelEventArgs e) { //case 1039 //log.Debug("NotifyEventSelector_Closing"); Application.Idle-= new EventHandler(Application_Idle); Util.SaveFormCustomization("NotifyEventSelector", this, tbManager, true); } #endregion #region Idle processing private void Application_Idle(object sender, EventArgs e) { //If it's a workorder status, make sure they have selected a valid status if(this.SelectedRootObjectType==RootObjectTypes.Workorder && this.SelectedEventType==(int)WorkorderEvent.Status && this.mSelectedWorkorderStatus==Guid.Empty) tbManager.Tools["LT:UI.Command.OK"].SharedProps.Enabled=false; else tbManager.Tools["LT:UI.Command.OK"].SharedProps.Enabled=true; } #endregion #region UI Commands 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.Cancel": // ButtonTool //mSelectedClientID=Guid.Empty; this.DialogResult=DialogResult.Cancel; this.Close(); break; case "LT:UI.Command.OK": // ButtonTool this.DialogResult=DialogResult.OK; this.Close(); break; } } #endregion #region Combo box intialization / events private void LoadCombo() { //case 1039 //log.Debug("LoadCombo"); //foreach event that is not selected already, put it in the combo box for selection foreach(DataRow dr in mEventsTable.Rows) { if(!(bool)(dr["Selected"])) { cbNotificationEvents.Items.Add((Guid)dr["ID"],Util.LocaleText.GetLocalizedText((string)dr["LTKEY"])); } } //Fill workorder status with a list of not previously selected workorder statuses //so user can't create a duplicate event of WorkorderEvent.Status and the same status NotifyEventWorkorderStatusPickList l = NotifyEventWorkorderStatusPickList.GetList(_Subscriber); cbWorkorderStatus.Items.Clear(); foreach(NotifyEventWorkorderStatusPickList.NotifyEventWorkorderStatusPickListInfo i in l) { cbWorkorderStatus.Items.Add(i.ID,i.Name); } } private void cbNotificationEvents_ValueChanged(object sender, System.EventArgs e) { this.panelWorkorderStatus.Visible=false; Guid SelectionID=(Guid)cbNotificationEvents.SelectedItem.DataValue; if(SelectionID!=Guid.Empty) { foreach(DataRow dr in mEventsTable.Rows) { if(((Guid)dr["ID"])==SelectionID ) { this.mSelectedEventType=(int)dr["EventType"]; this.mSelectedRootObjectType=(RootObjectTypes)dr["RootObjectType"]; if(this.mSelectedRootObjectType==RootObjectTypes.Workorder && this.mSelectedEventType==(int)WorkorderEvent.Status) this.panelWorkorderStatus.Visible=true; } } } //mSelectedClientID=(Guid)cbNotificationEvents.SelectedItem.DataValue; } private void cbWorkorderStatus_ValueChanged(object sender, System.EventArgs e) { this.mSelectedWorkorderStatus=(Guid)this.cbWorkorderStatus.SelectedItem.DataValue; } #endregion //-------------------------------------------------------- } }