1318 lines
52 KiB
C#
1318 lines
52 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 Infragistics.Win.UltraWinToolbars;
|
|
using System.Data;
|
|
using log4net;
|
|
|
|
namespace AyaNova
|
|
{
|
|
/// <summary>
|
|
/// Summary description for TaskGroupsForm.
|
|
/// </summary>
|
|
public class TaskGroupsForm : 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 TaskGroupsForm_Fill_Panel;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _TaskGroupsForm_Toolbars_Dock_Area_Left;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _TaskGroupsForm_Toolbars_Dock_Area_Right;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _TaskGroupsForm_Toolbars_Dock_Area_Top;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _TaskGroupsForm_Toolbars_Dock_Area_Bottom;
|
|
private Infragistics.Win.UltraWinGrid.UltraGrid gridSelect;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edDescription;
|
|
private Infragistics.Win.UltraWinEditors.UltraTextEditor edName;
|
|
private Infragistics.Win.Misc.UltraLabel lblName;
|
|
private Infragistics.Win.Misc.UltraLabel lblDescription;
|
|
private Infragistics.Win.UltraWinEditors.UltraCheckEditor ckActive;
|
|
private System.Windows.Forms.ErrorProvider errorProvider1;
|
|
private System.Windows.Forms.Panel pnlRight;
|
|
private System.ComponentModel.IContainer components;
|
|
private System.Windows.Forms.Panel pnlLeft;
|
|
private Infragistics.Win.UltraWinGrid.UltraGrid gridTaskGroupTasks;
|
|
private Infragistics.Win.UltraWinEditors.UltraPictureBox ultraPictureBox1;
|
|
private System.Windows.Forms.CheckBox ckIsDirty;
|
|
|
|
|
|
public TaskGroupsForm()
|
|
{
|
|
//
|
|
// 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("TaskGroupEntryMenuBar");
|
|
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool1 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("LT:TaskGroup.Label.List");
|
|
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:Task.Label.List");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose");
|
|
Infragistics.Win.Appearance 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:Task.Label.List");
|
|
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool2 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("LT:TaskGroup.Label.List");
|
|
Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList(0);
|
|
this.ckIsDirty = new System.Windows.Forms.CheckBox();
|
|
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
|
|
this.TaskGroupsForm_Fill_Panel = new System.Windows.Forms.Panel();
|
|
this.pnlRight = new System.Windows.Forms.Panel();
|
|
this.gridTaskGroupTasks = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
|
this.lblDescription = new Infragistics.Win.Misc.UltraLabel();
|
|
this.edDescription = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this.ckActive = new Infragistics.Win.UltraWinEditors.UltraCheckEditor();
|
|
this.edName = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
|
|
this.lblName = new Infragistics.Win.Misc.UltraLabel();
|
|
this.pnlLeft = new System.Windows.Forms.Panel();
|
|
this.gridSelect = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
|
this.ultraPictureBox1 = new Infragistics.Win.UltraWinEditors.UltraPictureBox();
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this.errorProvider1 = new System.Windows.Forms.ErrorProvider(this.components);
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
|
|
this.TaskGroupsForm_Fill_Panel.SuspendLayout();
|
|
this.pnlRight.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.gridTaskGroupTasks)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edDescription)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckActive)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit();
|
|
this.pnlLeft.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.gridSelect)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// ckIsDirty
|
|
//
|
|
this.ckIsDirty.Location = new System.Drawing.Point(-280, 24);
|
|
this.ckIsDirty.Name = "ckIsDirty";
|
|
this.ckIsDirty.Size = new System.Drawing.Size(146, 24);
|
|
this.ckIsDirty.TabIndex = 5;
|
|
//
|
|
// tbManager
|
|
//
|
|
this.tbManager.DesignerFlags = 1;
|
|
this.tbManager.DockWithinContainer = this;
|
|
this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form);
|
|
this.tbManager.ShowFullMenusDelay = 500;
|
|
ultraToolbar1.DockedColumn = 0;
|
|
ultraToolbar1.DockedRow = 0;
|
|
ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
comboBoxTool1,
|
|
buttonTool1,
|
|
buttonTool2,
|
|
buttonTool3,
|
|
buttonTool4,
|
|
buttonTool5,
|
|
buttonTool6,
|
|
buttonTool7});
|
|
ultraToolbar1.Text = "TaskGroupEntryMenuBar";
|
|
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";
|
|
appearance9.Image = global::AyaNova.Resource1.Task32;
|
|
buttonTool14.SharedPropsInternal.AppearancesLarge.Appearance = appearance9;
|
|
appearance10.Image = global::AyaNova.Resource1.Task16;
|
|
buttonTool14.SharedPropsInternal.AppearancesSmall.Appearance = appearance10;
|
|
buttonTool14.SharedPropsInternal.Caption = "LT:Task.Label.List";
|
|
comboBoxTool2.SharedPropsInternal.Caption = "LT:TaskGroup.Label.List";
|
|
comboBoxTool2.ValueList = valueList1;
|
|
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
buttonTool8,
|
|
buttonTool9,
|
|
buttonTool10,
|
|
buttonTool11,
|
|
buttonTool12,
|
|
buttonTool13,
|
|
buttonTool14,
|
|
comboBoxTool2});
|
|
this.tbManager.UseLargeImagesOnToolbar = true;
|
|
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
|
|
this.tbManager.ToolValueChanged += new Infragistics.Win.UltraWinToolbars.ToolEventHandler(this.tbManager_ToolValueChanged);
|
|
//
|
|
// TaskGroupsForm_Fill_Panel
|
|
//
|
|
this.TaskGroupsForm_Fill_Panel.Controls.Add(this.pnlRight);
|
|
this.TaskGroupsForm_Fill_Panel.Controls.Add(this.pnlLeft);
|
|
this.TaskGroupsForm_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
|
|
this.TaskGroupsForm_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.TaskGroupsForm_Fill_Panel.Location = new System.Drawing.Point(0, 43);
|
|
this.TaskGroupsForm_Fill_Panel.Name = "TaskGroupsForm_Fill_Panel";
|
|
this.TaskGroupsForm_Fill_Panel.Size = new System.Drawing.Size(712, 572);
|
|
this.TaskGroupsForm_Fill_Panel.TabIndex = 0;
|
|
//
|
|
// pnlRight
|
|
//
|
|
this.pnlRight.Controls.Add(this.gridTaskGroupTasks);
|
|
this.pnlRight.Controls.Add(this.lblDescription);
|
|
this.pnlRight.Controls.Add(this.edDescription);
|
|
this.pnlRight.Controls.Add(this.ckActive);
|
|
this.pnlRight.Controls.Add(this.edName);
|
|
this.pnlRight.Controls.Add(this.lblName);
|
|
this.pnlRight.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.pnlRight.Location = new System.Drawing.Point(480, 0);
|
|
this.pnlRight.Name = "pnlRight";
|
|
this.pnlRight.Size = new System.Drawing.Size(232, 572);
|
|
this.pnlRight.TabIndex = 4;
|
|
//
|
|
// gridTaskGroupTasks
|
|
//
|
|
this.gridTaskGroupTasks.Cursor = System.Windows.Forms.Cursors.Default;
|
|
this.gridTaskGroupTasks.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
this.gridTaskGroupTasks.Location = new System.Drawing.Point(0, 184);
|
|
this.gridTaskGroupTasks.Name = "gridTaskGroupTasks";
|
|
this.gridTaskGroupTasks.Size = new System.Drawing.Size(232, 388);
|
|
this.gridTaskGroupTasks.TabIndex = 0;
|
|
this.gridTaskGroupTasks.Text = "LT:Task.Label.List";
|
|
this.gridTaskGroupTasks.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.gridTaskGroupTasks_InitializeRow);
|
|
this.gridTaskGroupTasks.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridTaskGroupTasks_ClickCellButton);
|
|
this.gridTaskGroupTasks.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridTaskGroupTasks_MouseDown);
|
|
//
|
|
// lblDescription
|
|
//
|
|
this.lblDescription.Location = new System.Drawing.Point(10, 111);
|
|
this.lblDescription.Name = "lblDescription";
|
|
this.lblDescription.Size = new System.Drawing.Size(268, 18);
|
|
this.lblDescription.TabIndex = 128;
|
|
this.lblDescription.Tag = "";
|
|
this.lblDescription.Text = "LT:TaskGroup.Label.Description";
|
|
//
|
|
// edDescription
|
|
//
|
|
this.edDescription.AcceptsReturn = true;
|
|
this.edDescription.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.edDescription.Location = new System.Drawing.Point(10, 129);
|
|
this.edDescription.Multiline = true;
|
|
this.edDescription.Name = "edDescription";
|
|
this.edDescription.Size = new System.Drawing.Size(207, 46);
|
|
this.edDescription.TabIndex = 125;
|
|
//
|
|
// 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, 74);
|
|
this.ckActive.Name = "ckActive";
|
|
this.ckActive.Size = new System.Drawing.Size(111, 28);
|
|
this.ckActive.TabIndex = 124;
|
|
this.ckActive.Tag = "";
|
|
this.ckActive.Text = "LT:Common.Label.Active";
|
|
//
|
|
// 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, 37);
|
|
this.edName.Name = "edName";
|
|
this.edName.Size = new System.Drawing.Size(207, 24);
|
|
this.edName.TabIndex = 126;
|
|
//
|
|
// lblName
|
|
//
|
|
this.lblName.Location = new System.Drawing.Point(10, 18);
|
|
this.lblName.Name = "lblName";
|
|
this.lblName.Size = new System.Drawing.Size(268, 19);
|
|
this.lblName.TabIndex = 127;
|
|
this.lblName.Tag = "";
|
|
this.lblName.Text = "LT:TaskGroup.Label.Name";
|
|
//
|
|
// pnlLeft
|
|
//
|
|
this.pnlLeft.Controls.Add(this.gridSelect);
|
|
this.pnlLeft.Controls.Add(this.ultraPictureBox1);
|
|
this.pnlLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
|
this.pnlLeft.Location = new System.Drawing.Point(0, 0);
|
|
this.pnlLeft.Name = "pnlLeft";
|
|
this.pnlLeft.Size = new System.Drawing.Size(480, 572);
|
|
this.pnlLeft.TabIndex = 2;
|
|
//
|
|
// gridSelect
|
|
//
|
|
this.gridSelect.Cursor = System.Windows.Forms.Cursors.Default;
|
|
this.gridSelect.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortSingle;
|
|
this.gridSelect.Dock = System.Windows.Forms.DockStyle.Bottom;
|
|
this.gridSelect.Location = new System.Drawing.Point(0, 184);
|
|
this.gridSelect.Name = "gridSelect";
|
|
this.gridSelect.Size = new System.Drawing.Size(480, 388);
|
|
this.gridSelect.TabIndex = 0;
|
|
this.gridSelect.Text = "LT:Task.Label.List";
|
|
this.gridSelect.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.gridSelect_InitializeRow);
|
|
this.gridSelect.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridSelect_ClickCellButton);
|
|
this.gridSelect.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridSelect_MouseDown);
|
|
//
|
|
// ultraPictureBox1
|
|
//
|
|
this.ultraPictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.ultraPictureBox1.BorderShadowColor = System.Drawing.Color.Empty;
|
|
this.ultraPictureBox1.Location = new System.Drawing.Point(0, 129);
|
|
this.ultraPictureBox1.Name = "ultraPictureBox1";
|
|
this.ultraPictureBox1.Size = new System.Drawing.Size(480, 58);
|
|
this.ultraPictureBox1.TabIndex = 131;
|
|
//
|
|
// _TaskGroupsForm_Toolbars_Dock_Area_Left
|
|
//
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.Name = "_TaskGroupsForm_Toolbars_Dock_Area_Left";
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 572);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _TaskGroupsForm_Toolbars_Dock_Area_Right
|
|
//
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(712, 43);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.Name = "_TaskGroupsForm_Toolbars_Dock_Area_Right";
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 572);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _TaskGroupsForm_Toolbars_Dock_Area_Top
|
|
//
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.Name = "_TaskGroupsForm_Toolbars_Dock_Area_Top";
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(712, 43);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _TaskGroupsForm_Toolbars_Dock_Area_Bottom
|
|
//
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 615);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.Name = "_TaskGroupsForm_Toolbars_Dock_Area_Bottom";
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(712, 0);
|
|
this._TaskGroupsForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
|
|
//
|
|
// errorProvider1
|
|
//
|
|
this.errorProvider1.ContainerControl = this;
|
|
//
|
|
// TaskGroupsForm
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
|
this.ClientSize = new System.Drawing.Size(712, 615);
|
|
this.Controls.Add(this.TaskGroupsForm_Fill_Panel);
|
|
this.Controls.Add(this._TaskGroupsForm_Toolbars_Dock_Area_Left);
|
|
this.Controls.Add(this._TaskGroupsForm_Toolbars_Dock_Area_Right);
|
|
this.Controls.Add(this._TaskGroupsForm_Toolbars_Dock_Area_Bottom);
|
|
this.Controls.Add(this._TaskGroupsForm_Toolbars_Dock_Area_Top);
|
|
this.MaximumSize = new System.Drawing.Size(1152, 652);
|
|
this.MinimumSize = new System.Drawing.Size(624, 652);
|
|
this.Name = "TaskGroupsForm";
|
|
this.ShowInTaskbar = false;
|
|
this.Text = "TaskGroupsForm";
|
|
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form_Closing);
|
|
this.Load += new System.EventHandler(this.Form_Load);
|
|
this.SizeChanged += new System.EventHandler(this.Form_SizeChanged);
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
|
|
this.TaskGroupsForm_Fill_Panel.ResumeLayout(false);
|
|
this.pnlRight.ResumeLayout(false);
|
|
this.pnlRight.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.gridTaskGroupTasks)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edDescription)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.ckActive)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit();
|
|
this.pnlLeft.ResumeLayout(false);
|
|
((System.ComponentModel.ISupportInitialize)(this.gridSelect)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
|
|
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
|
|
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
|
|
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
|
|
//
|
|
|
|
#region Global vars
|
|
|
|
|
|
//variable to hold user form settings
|
|
//UIUserFormSetting mFormSetting;
|
|
private System.Data.DataSet dsTasks;
|
|
|
|
//Used to indicate that a check change has happened
|
|
private bool bCheckChanged=false;
|
|
#endregion
|
|
|
|
#region Form Load / Close
|
|
/// <summary>
|
|
/// Prepare the form
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Form_Load(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("Form_Load");
|
|
|
|
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
this.Visible=false;
|
|
|
|
this.Icon = Resource1.Task16icon;
|
|
this.ultraPictureBox1.Image = Resource1.GreenRightArrow16;
|
|
//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.TaskGroup")< (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.TaskGroup")));
|
|
|
|
this.Close();
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
//prepare the selection data set
|
|
dsTasks=new DataSet();
|
|
dsTasks.Tables.Add();
|
|
|
|
dsTasks.Tables[0].Columns.Add("Task",typeof(string));
|
|
dsTasks.Tables[0].Columns.Add("ID",typeof(Guid));
|
|
//Case 319
|
|
dsTasks.Tables[0].Columns.Add("Active", typeof(bool));
|
|
|
|
FillSelectionList();
|
|
|
|
|
|
gridSelect.DataSource=dsTasks;
|
|
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ID"].Hidden=true;
|
|
|
|
//Case 319
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Active"].Hidden = true;
|
|
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Task"].CellActivation=Activation.NoEdit;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Task"].Header.Caption="";
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Task"].Header.Appearance.Image = Resource1.Task16;// Util.Image("WorkorderTask16.png");
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Task"].Header.Appearance.ImageHAlign=HAlign.Center;
|
|
|
|
|
|
|
|
|
|
gridSelect.DisplayLayout.Bands[0].Columns.Add("ADD",Util.LocaleText.GetLocalizedText("UI.Command.Add"));
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].Header.Caption="";
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].CellButtonAppearance.Image = Resource1.GreenRightArrow16;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].CellButtonAppearance.ImageHAlign=HAlign.Center;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].CellButtonAppearance.ImageVAlign=VAlign.Middle;
|
|
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].Header.Appearance.Image = Resource1.GreenRightArrow16;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].Header.Appearance.ImageHAlign=HAlign.Center;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].Width=24;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].MinWidth=24;
|
|
gridSelect.DisplayLayout.Bands[0].Columns["ADD"].MaxWidth=24;
|
|
|
|
|
|
gridSelect.DisplayLayout.Bands[0].Override.RowSelectors=DefaultableBoolean.False;
|
|
gridSelect.DisplayLayout.Bands[0].Override.CellPadding=0;
|
|
gridSelect.DisplayLayout.Bands[0].Override.DefaultRowHeight=22;
|
|
|
|
Util.LoadFormCustomization("TaskGroups", this, tbManager, false);
|
|
|
|
FillTaskGroupList();
|
|
DataBind();
|
|
PrepareGrid();
|
|
|
|
//restrict UI based on security settings
|
|
RestrictUI();
|
|
Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810
|
|
Util.Localize(this);
|
|
Cursor.Current = Cursors.Default;
|
|
|
|
|
|
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 Form_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("Form_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("TaskGroups", 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 Form_SizeChanged(object sender, System.EventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("Form_SizeChanged");
|
|
|
|
int nWidth=0;
|
|
|
|
nWidth=this.DisplayRectangle.Width/2;
|
|
|
|
this.pnlLeft.Width=nWidth;
|
|
this.pnlRight.Width=nWidth;
|
|
|
|
//Added: 17-Nov-2006 to avoid key not found exception
|
|
//because key may not exist at this point yet
|
|
if(gridSelect.DisplayLayout.Bands[0].Columns.Exists("Task"))
|
|
gridSelect.DisplayLayout.Bands[0].Columns["Task"].Width=nWidth-50;
|
|
|
|
//Added: 17-Nov-2006 to avoid key not found exception
|
|
//because key may not exist at this point yet
|
|
if (gridTaskGroupTasks.DisplayLayout.Bands[0].Columns.Exists("TaskID"))
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].Width=nWidth-50;
|
|
|
|
|
|
|
|
}
|
|
|
|
#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(mTaskGroup.Creator,mTaskGroup.Modifier,mTaskGroup.Created,mTaskGroup.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:Task.Label.List": // ButtonTool
|
|
GenericListForm g = new GenericListForm();
|
|
Tasks p = Tasks.GetItems();
|
|
g.GridDataSource=p;
|
|
g.ShowDialog();
|
|
if(g.ChangesMade)
|
|
{
|
|
FillGridValueList();
|
|
FillSelectionList();
|
|
}
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
private void tbManager_ToolValueChanged(object sender, Infragistics.Win.UltraWinToolbars.ToolEventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("tbManager_ToolValueChanged");
|
|
|
|
Guid g=(Guid)((ComboBoxTool)e.Tool).Value;
|
|
if(g==Guid.Empty) return;
|
|
|
|
if(RecordUpdate(RecordActionType.SaveOnly))
|
|
{
|
|
this.mTaskGroup=TaskGroup.GetItem(g);
|
|
//mTaskGroup.BeginEdit();
|
|
DataBind();
|
|
FillSelectionList();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#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.Save"].SharedProps.Enabled=mTaskGroup.IsSavable;
|
|
|
|
//display name in title bar
|
|
this.Text=mTaskGroup.Name;
|
|
|
|
if(bCheckChanged)
|
|
{
|
|
bCheckChanged=false;
|
|
|
|
}
|
|
}
|
|
/// <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.TaskGroup")).ToString());
|
|
|
|
|
|
bool bDelete=AyaBizUtils.Right("Object.TaskGroup")== (int)SecurityLevelTypes.ReadWriteDelete;
|
|
bool bReadOnly=AyaBizUtils.Right("Object.TaskGroup") < (int)SecurityLevelTypes.ReadWrite;
|
|
|
|
tbManager.Tools["LT:UI.Command.Delete"].SharedProps.Visible=bDelete;
|
|
|
|
tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible=!bReadOnly;
|
|
tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Visible=!bReadOnly;
|
|
tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible=!bReadOnly;
|
|
|
|
//Case 181
|
|
tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible=false;
|
|
|
|
//DISABLE EDITABLE CONTROLS
|
|
edName.Enabled=!bReadOnly;
|
|
edDescription.Enabled=!bReadOnly;
|
|
ckActive.Enabled=!bReadOnly;
|
|
|
|
//Added: 2-Oct-2006
|
|
//user can have rights to overall group but not to individual tasks
|
|
//this ensures that they don't attempt to edit tasks and get a security exception
|
|
bool bTaskGroupTaskReadOnly = AyaBizUtils.Right("Object.TaskGroupTask") < (int)SecurityLevelTypes.ReadWrite;
|
|
|
|
if (bTaskGroupTaskReadOnly)
|
|
{
|
|
gridTaskGroupTasks.Enabled = false;
|
|
gridSelect.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
|
|
mTaskGroup.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged);
|
|
|
|
|
|
//=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-=
|
|
|
|
//Text editors
|
|
Util.BindField(edName,"Text",mTaskGroup,"Name");
|
|
Util.BindField(edDescription,"Text",mTaskGroup,"Description");
|
|
|
|
|
|
//Grid
|
|
Util.BindField(gridTaskGroupTasks,"DataSource",mTaskGroup,"Tasks");
|
|
|
|
//checkbox
|
|
Util.BindField(ckActive,"Checked",mTaskGroup,"Active");
|
|
|
|
|
|
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
|
|
|
//Bind IsDirty property to hidden checkbox to
|
|
//ensure isdirtychanged event is available
|
|
//to data binding infrastructure
|
|
Util.BindField(ckIsDirty,"Checked",mTaskGroup,"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,mTaskGroup,errorProvider1);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region Business object editing / adding / deletion related code
|
|
|
|
|
|
private TaskGroup mTaskGroup;
|
|
/// <summary>
|
|
/// Region record to display
|
|
/// set by caller
|
|
/// </summary>
|
|
public GZTW.AyaNova.BLL.TaskGroup TaskGroupToEdit
|
|
{
|
|
get
|
|
{
|
|
return mTaskGroup;
|
|
}
|
|
set
|
|
{
|
|
mTaskGroup=value;
|
|
//mTaskGroup.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;
|
|
}
|
|
}
|
|
|
|
//case 2010
|
|
private bool mbSelectionDeleted = false;
|
|
public bool SelectedItemDeleted
|
|
{
|
|
get
|
|
{
|
|
return mbSelectionDeleted;
|
|
}
|
|
}
|
|
|
|
|
|
/// <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
|
|
lblName.Focus();
|
|
switch(SaveType)
|
|
{
|
|
case RecordActionType.DeleteAndExit:
|
|
|
|
|
|
if(Util.PromptForDelete()==DialogResult.Yes)
|
|
{
|
|
//Delete, then exit
|
|
try
|
|
{
|
|
TaskGroup.DeleteItem(mTaskGroup.ID);
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
Util.ReportSQLError(ex);
|
|
return false;
|
|
}
|
|
bClosingHandled=true;
|
|
this.Close();
|
|
mbChangesMade=true;
|
|
mbSelectionDeleted = true;//case 1999
|
|
return true;
|
|
}
|
|
else return false;
|
|
|
|
case RecordActionType.SaveAndExit:
|
|
//Save if necessary and exit
|
|
if(mTaskGroup.IsSavable)
|
|
{
|
|
mTaskGroup.ApplyEdit();
|
|
mTaskGroup.Save();
|
|
bClosingHandled=true;
|
|
mbChangesMade=true;
|
|
this.Close();
|
|
return true;
|
|
}
|
|
if(mTaskGroup.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(mTaskGroup.IsSavable)
|
|
{
|
|
mTaskGroup.ApplyEdit();
|
|
mTaskGroup.Save();
|
|
AddNewTaskGroup();
|
|
FillTaskGroupList();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
if(mTaskGroup.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
|
|
AddNewTaskGroup();
|
|
return true;
|
|
}
|
|
else return false;
|
|
|
|
}
|
|
|
|
//Current record isn't dirty so just add a new one
|
|
AddNewTaskGroup();
|
|
return true;
|
|
|
|
case RecordActionType.SaveOnly:
|
|
if(mTaskGroup.IsSavable)
|
|
{
|
|
mTaskGroup.ApplyEdit();
|
|
mTaskGroup=(GZTW.AyaNova.BLL.TaskGroup)mTaskGroup.Save();
|
|
DataBind();
|
|
FillTaskGroupList();
|
|
mbChangesMade=true;
|
|
return true;
|
|
|
|
}
|
|
return true;
|
|
|
|
case RecordActionType.PromptToSave:
|
|
//Prompt to save and save if
|
|
//required
|
|
if(mTaskGroup.IsDirty)
|
|
{
|
|
DialogResult dr=Util.PromptForSave();
|
|
if(dr==DialogResult.Cancel)
|
|
{
|
|
//Cancel
|
|
return false;
|
|
}
|
|
if(dr==DialogResult.Yes)
|
|
{
|
|
//Save before exit
|
|
|
|
if(mTaskGroup.IsSavable)
|
|
{
|
|
mTaskGroup.ApplyEdit();
|
|
mTaskGroup.Save();
|
|
mbChangesMade=true;
|
|
return true;
|
|
}
|
|
if(mTaskGroup.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 Region record and opens it for editing
|
|
/// </summary>
|
|
private void AddNewTaskGroup()
|
|
{
|
|
//case 1039 //log.Debug("AddNewTaskGroup");
|
|
|
|
try
|
|
{
|
|
mTaskGroup=GZTW.AyaNova.BLL.TaskGroup.NewItem();
|
|
//mTaskGroup.BeginEdit();
|
|
DataBind();
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
//log.Error("AddNewTaskGroup",ex);
|
|
MessageBox.Show(ex.Message+"\r\n"+ex.Source);
|
|
}
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region Grid preparation
|
|
|
|
private void PrepareGrid()
|
|
{
|
|
//case 1039 //log.Debug("PrepareGrid");
|
|
|
|
gridTaskGroupTasks.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle;
|
|
gridTaskGroupTasks.DisplayLayout.Override.AllowAddNew=AllowAddNew.No;
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskGroupID"].Hidden=true;
|
|
|
|
//Case 319
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["Active"].Hidden = true;
|
|
|
|
Util.GridPreLocalize("Task",gridTaskGroupTasks.DisplayLayout.Bands[0]);
|
|
Util.GridHideEditableBizObjectInternalFields(gridTaskGroupTasks);
|
|
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns.Add("REMOVE","");
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Caption="";
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.Image = Resource1.Delete16;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.ImageHAlign=HAlign.Center;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.ImageVAlign=VAlign.Middle;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Appearance.Image = Resource1.Delete16;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Appearance.ImageHAlign=HAlign.Center;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].Width=24;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].MinWidth=24;
|
|
//gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["REMOVE"].MaxWidth=24;
|
|
|
|
if ( AyaBizUtils.Right("Object.TaskGroupTask") > (int)SecurityLevelTypes.ReadWrite)//case 1431
|
|
Util.GridAddDeleteButton(gridTaskGroupTasks);
|
|
else
|
|
Util.GridRemoveDeleteButton(gridTaskGroupTasks);
|
|
|
|
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Override.RowSelectors=DefaultableBoolean.False;
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Override.CellPadding=0;
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Override.DefaultRowHeight=22;
|
|
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].CellActivation=Activation.NoEdit;
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].Header.Caption="";
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].Header.Appearance.Image = Resource1.Task16;// Util.Image("WorkorderTask16.png");
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].Header.Appearance.ImageHAlign=HAlign.Center;
|
|
|
|
Util.LocalizeGrid(gridTaskGroupTasks);
|
|
|
|
FillGridValueList();
|
|
}
|
|
|
|
private void FillGridValueList()
|
|
{
|
|
//case 1039 //log.Debug("FillGridValueList");
|
|
|
|
//Add all potential active items
|
|
ValueList vlTasks=new ValueList();
|
|
|
|
|
|
TaskPickList mTaskList=TaskPickList.GetList();
|
|
foreach(TaskPickList.TaskPickListInfo ui in mTaskList)
|
|
{
|
|
vlTasks.ValueListItems.Add(ui.ID,ui.Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
//Show sorted alphabetically
|
|
vlTasks.SortStyle=ValueListSortStyle.Ascending;
|
|
|
|
|
|
|
|
|
|
//Bind value lists to correct columns in grid
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].ValueList=vlTasks;
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
gridTaskGroupTasks.DisplayLayout.Bands[0].Columns["TaskID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region GRIDS events
|
|
|
|
//Add selected row user id to scheduled users grid
|
|
private void gridSelect_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
|
|
{
|
|
Guid SelectedTask=(Guid)e.Cell.Row.Cells["ID"].Value;
|
|
//See if it's in the list already
|
|
//TaskGroupUser u= this.mTaskGroup.ScheduleableUsers[
|
|
foreach(TaskGroupTask t in mTaskGroup.Tasks)
|
|
{
|
|
if(t.TaskID==SelectedTask)
|
|
return;
|
|
}
|
|
|
|
//not there so put it in
|
|
TaskGroupTask t2=mTaskGroup.Tasks.Add(mTaskGroup);
|
|
t2.TaskID=SelectedTask;
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// Add all rows?
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void gridSelect_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
|
{
|
|
string s=Util.HeaderClicked(gridSelect,e);
|
|
if(s==null || s!="ADD") return;
|
|
|
|
|
|
|
|
foreach(UltraGridRow r in gridSelect.Rows)
|
|
{
|
|
Guid SelectedTask=(Guid)r.Cells["ID"].Value;
|
|
bool bPresent=false;
|
|
//See if it's in the list already
|
|
foreach(TaskGroupTask t in mTaskGroup.Tasks)
|
|
{
|
|
if(t.TaskID==SelectedTask)
|
|
{
|
|
bPresent=true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
//not there so put it in
|
|
if(!bPresent)
|
|
{
|
|
TaskGroupTask t2=mTaskGroup.Tasks.Add(mTaskGroup);
|
|
t2.TaskID=SelectedTask;
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
///Delete all rows?
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void gridTaskGroupTasks_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
|
|
{
|
|
|
|
//TODO: Not sure if this should be implemented so ignoring it for now
|
|
|
|
|
|
}
|
|
|
|
|
|
private void gridTaskGroupTasks_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
|
|
{
|
|
Cursor.Current=Cursors.WaitCursor;
|
|
Guid SelectedTask=(Guid)e.Cell.Row.Cells["ID"].Value;
|
|
try
|
|
{
|
|
mTaskGroup.Tasks.Remove(SelectedTask);
|
|
}
|
|
catch
|
|
{
|
|
//do nothing it will throw an error that is ok to ignore
|
|
}
|
|
|
|
}
|
|
|
|
|
|
//Case 319
|
|
private void gridSelect_InitializeRow(object sender, InitializeRowEventArgs e)
|
|
{
|
|
//gray out inactive tasks
|
|
if ((bool)e.Row.Cells["Active"].Value == false)
|
|
{
|
|
|
|
e.Row.Appearance.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
}
|
|
|
|
}
|
|
|
|
//Case 319
|
|
private void gridTaskGroupTasks_InitializeRow(object sender, InitializeRowEventArgs e)
|
|
{
|
|
//gray out inactive tasks
|
|
if ((bool)e.Row.Cells["Active"].Value == false)
|
|
{
|
|
|
|
e.Row.Appearance.ForeColor = System.Drawing.SystemColors.GrayText;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region selection list
|
|
|
|
private void FillSelectionList()
|
|
{
|
|
//case 1039 //log.Debug("FillSelectionList");
|
|
|
|
DataRow dr;
|
|
dsTasks.Tables[0].Rows.Clear();
|
|
|
|
TaskPickList mTaskList=TaskPickList.GetList();
|
|
foreach(TaskPickList.TaskPickListInfo ui in mTaskList)
|
|
{
|
|
dr=dsTasks.Tables[0].NewRow();
|
|
dr["Task"]=ui.Name;
|
|
dr["ID"]=ui.ID;
|
|
dr["Active"] = ui.Active;
|
|
dsTasks.Tables[0].Rows.Add(dr);
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Fill TaskGroup list combo
|
|
|
|
private void FillTaskGroupList()
|
|
{
|
|
//case 1039 //log.Debug("FillTaskGroupList");
|
|
|
|
ComboBoxTool cbt = (ComboBoxTool)tbManager.Tools["LT:TaskGroup.Label.List"];
|
|
cbt.AutoComplete=true;
|
|
cbt.ValueList.ValueListItems.Clear();
|
|
|
|
//NVCHANGED
|
|
GenericNVList l=GenericNVList.GetList("aTaskGroup","aID","aName",true,false,false);
|
|
|
|
//Loop through the items in the list and put them
|
|
//into the combo box
|
|
for(int x=0;x<l.Count;x++)
|
|
{
|
|
cbt.ValueList.ValueListItems.Add(new Guid(((DictionaryEntry)l.BindableList[x]).Key.ToString()),
|
|
((DictionaryEntry)l.BindableList[x]).Value.ToString());
|
|
|
|
}
|
|
|
|
ValueListItem viNothing=cbt.ValueList.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318
|
|
|
|
if(!mTaskGroup.IsNew)
|
|
{
|
|
foreach(ValueListItem vi in cbt.ValueList.ValueListItems)
|
|
{
|
|
if((Guid)vi.DataValue==mTaskGroup.ID)
|
|
{
|
|
cbt.SelectedItem=vi;
|
|
viNothing=null;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(viNothing!=null) cbt.SelectedItem=viNothing;
|
|
cbt.ValueList.SortStyle = ValueListSortStyle.Ascending;
|
|
}
|
|
#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
|
|
|
|
|
|
|
|
//**********************************************************************
|
|
|
|
|
|
}
|
|
}
|