Files
ayanova7/source/WinFormApp/ScheduleableUserGroupsForm.cs
2018-06-29 19:47:36 +00:00

1702 lines
69 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 ScheduleableUserGroupsForm.
/// </summary>
public class ScheduleableUserGroupsForm : 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 ScheduleableUserGroupsForm_Fill_Panel;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top;
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom;
private Infragistics.Win.UltraWinGrid.UltraGrid gridSelect;
private Infragistics.Win.UltraWinGrid.UltraGrid gridScheduleableUsers;
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.Windows.Forms.Panel pnlMiddle;
private Infragistics.Win.Misc.UltraButton btnCertifications;
private Infragistics.Win.Misc.UltraButton btnSkills;
private Infragistics.Win.Misc.UltraButton btnZone;
private GZTW.WinForm.Controls.GZUltraComboEditor cbZone;
private GZTW.WinForm.Controls.GZUltraComboEditor cbRegion;
private System.Windows.Forms.Panel pnlLeft;
private System.ComponentModel.IContainer components;
private Infragistics.Win.Misc.UltraLabel lblRegion;
private Infragistics.Win.UltraWinEditors.UltraPictureBox ultraPictureBox1;
private Infragistics.Win.UltraWinEditors.UltraPictureBox ultraPictureBox2;
private Infragistics.Win.Misc.UltraLabel ultraLabel1;
private Infragistics.Win.Misc.UltraLabel ultraLabel2;
private Infragistics.Win.Misc.UltraLabel ultraLabel3;
private ListBox lbCertifications;
private ListBox lbSkills;
private System.Windows.Forms.CheckBox ckIsDirty;
public ScheduleableUserGroupsForm()
{
//
// 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("ScheduleableUserGroupEntryMenuBar");
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool1 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("LT:ScheduleableUserGroup.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:UI.Command.Delete");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool7 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose");
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance5 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool8 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.RecordHistory");
Infragistics.Win.Appearance appearance6 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance7 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool9 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool10 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveNew");
Infragistics.Win.Appearance appearance8 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance9 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool11 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool12 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Delete");
Infragistics.Win.Appearance appearance10 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance11 = new Infragistics.Win.Appearance();
Infragistics.Win.UltraWinToolbars.ComboBoxTool comboBoxTool2 = new Infragistics.Win.UltraWinToolbars.ComboBoxTool("LT:ScheduleableUserGroup.Label.List");
Infragistics.Win.ValueList valueList1 = new Infragistics.Win.ValueList(0);
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
this.ckIsDirty = new System.Windows.Forms.CheckBox();
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
this.ScheduleableUserGroupsForm_Fill_Panel = new System.Windows.Forms.Panel();
this.pnlRight = new System.Windows.Forms.Panel();
this.gridScheduleableUsers = 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.pnlMiddle = new System.Windows.Forms.Panel();
this.ultraPictureBox2 = new Infragistics.Win.UltraWinEditors.UltraPictureBox();
this.gridSelect = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.pnlLeft = new System.Windows.Forms.Panel();
this.lbSkills = new System.Windows.Forms.ListBox();
this.lbCertifications = new System.Windows.Forms.ListBox();
this.ultraLabel3 = new Infragistics.Win.Misc.UltraLabel();
this.ultraLabel2 = new Infragistics.Win.Misc.UltraLabel();
this.ultraLabel1 = new Infragistics.Win.Misc.UltraLabel();
this.ultraPictureBox1 = new Infragistics.Win.UltraWinEditors.UltraPictureBox();
this.lblRegion = new Infragistics.Win.Misc.UltraLabel();
this.btnCertifications = new Infragistics.Win.Misc.UltraButton();
this.btnSkills = new Infragistics.Win.Misc.UltraButton();
this.btnZone = new Infragistics.Win.Misc.UltraButton();
this.cbZone = new GZTW.WinForm.Controls.GZUltraComboEditor();
this.cbRegion = new GZTW.WinForm.Controls.GZUltraComboEditor();
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
this._ScheduleableUserGroupsForm_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.ScheduleableUserGroupsForm_Fill_Panel.SuspendLayout();
this.pnlRight.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridScheduleableUsers)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.edDescription)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ckActive)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.edName)).BeginInit();
this.pnlMiddle.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridSelect)).BeginInit();
this.pnlLeft.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.cbZone)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbRegion)).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});
ultraToolbar1.Text = "ScheduleableUserGroupEntryMenuBar";
this.tbManager.Toolbars.AddRange(new Infragistics.Win.UltraWinToolbars.UltraToolbar[] {
ultraToolbar1});
this.tbManager.ToolbarSettings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False;
this.tbManager.ToolbarSettings.AllowFloating = Infragistics.Win.DefaultableBoolean.False;
this.tbManager.ToolbarSettings.AllowHiding = Infragistics.Win.DefaultableBoolean.False;
buttonTool7.SharedPropsInternal.AccessibleDescription = "recorddd";
appearance4.Image = global::AyaNova.Resource1.SaveExit32;
buttonTool7.SharedPropsInternal.AppearancesLarge.Appearance = appearance4;
appearance5.Image = global::AyaNova.Resource1.SaveExit16;
buttonTool7.SharedPropsInternal.AppearancesSmall.Appearance = appearance5;
buttonTool7.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose";
appearance6.Image = global::AyaNova.Resource1.RecordHistory32;
buttonTool8.SharedPropsInternal.AppearancesLarge.Appearance = appearance6;
appearance7.Image = global::AyaNova.Resource1.RecordHistory16;
buttonTool8.SharedPropsInternal.AppearancesSmall.Appearance = appearance7;
buttonTool8.SharedPropsInternal.Caption = "LT:UI.Command.RecordHistory";
buttonTool9.SharedPropsInternal.Caption = "LT:UI.Command.Save";
buttonTool9.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
appearance8.Image = global::AyaNova.Resource1.SaveNew32;
buttonTool10.SharedPropsInternal.AppearancesLarge.Appearance = appearance8;
appearance9.Image = global::AyaNova.Resource1.SaveNew16;
buttonTool10.SharedPropsInternal.AppearancesSmall.Appearance = appearance9;
buttonTool10.SharedPropsInternal.Caption = "LT:UI.Command.SaveNew";
buttonTool11.SharedPropsInternal.Caption = "LT:UI.Command.Close";
buttonTool11.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
appearance10.Image = global::AyaNova.Resource1.Delete32;
buttonTool12.SharedPropsInternal.AppearancesLarge.Appearance = appearance10;
appearance11.Image = global::AyaNova.Resource1.Delete16;
buttonTool12.SharedPropsInternal.AppearancesSmall.Appearance = appearance11;
buttonTool12.SharedPropsInternal.Caption = "LT:UI.Command.Delete";
comboBoxTool2.SharedPropsInternal.Caption = "LT:ScheduleableUserGroup.Label.List";
comboBoxTool2.ValueList = valueList1;
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
buttonTool7,
buttonTool8,
buttonTool9,
buttonTool10,
buttonTool11,
buttonTool12,
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);
//
// ScheduleableUserGroupsForm_Fill_Panel
//
this.ScheduleableUserGroupsForm_Fill_Panel.Controls.Add(this.pnlRight);
this.ScheduleableUserGroupsForm_Fill_Panel.Controls.Add(this.pnlMiddle);
this.ScheduleableUserGroupsForm_Fill_Panel.Controls.Add(this.pnlLeft);
this.ScheduleableUserGroupsForm_Fill_Panel.Cursor = System.Windows.Forms.Cursors.Default;
this.ScheduleableUserGroupsForm_Fill_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
this.ScheduleableUserGroupsForm_Fill_Panel.Location = new System.Drawing.Point(0, 43);
this.ScheduleableUserGroupsForm_Fill_Panel.Name = "ScheduleableUserGroupsForm_Fill_Panel";
this.ScheduleableUserGroupsForm_Fill_Panel.Size = new System.Drawing.Size(880, 572);
this.ScheduleableUserGroupsForm_Fill_Panel.TabIndex = 0;
//
// pnlRight
//
this.pnlRight.Controls.Add(this.gridScheduleableUsers);
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.Right;
this.pnlRight.Location = new System.Drawing.Point(506, 0);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Size = new System.Drawing.Size(374, 572);
this.pnlRight.TabIndex = 4;
//
// gridScheduleableUsers
//
this.gridScheduleableUsers.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gridScheduleableUsers.Cursor = System.Windows.Forms.Cursors.Default;
this.gridScheduleableUsers.Location = new System.Drawing.Point(10, 185);
this.gridScheduleableUsers.Name = "gridScheduleableUsers";
this.gridScheduleableUsers.Size = new System.Drawing.Size(349, 378);
this.gridScheduleableUsers.TabIndex = 3;
this.gridScheduleableUsers.Text = "LT:O.ScheduleableUserGroup";
this.gridScheduleableUsers.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridScheduleableUsers_ClickCellButton);
this.gridScheduleableUsers.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridScheduleableUsers_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:ScheduleableUserGroup.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(349, 46);
this.edDescription.TabIndex = 2;
//
// 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(253, 28);
this.ckActive.TabIndex = 1;
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(349, 24);
this.edName.TabIndex = 0;
//
// 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:ScheduleableUserGroup.Label.Name";
//
// pnlMiddle
//
this.pnlMiddle.Controls.Add(this.ultraPictureBox2);
this.pnlMiddle.Controls.Add(this.gridSelect);
this.pnlMiddle.Dock = System.Windows.Forms.DockStyle.Left;
this.pnlMiddle.Location = new System.Drawing.Point(307, 0);
this.pnlMiddle.Name = "pnlMiddle";
this.pnlMiddle.Size = new System.Drawing.Size(355, 572);
this.pnlMiddle.TabIndex = 2;
//
// ultraPictureBox2
//
this.ultraPictureBox2.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.ultraPictureBox2.BorderShadowColor = System.Drawing.Color.Empty;
this.ultraPictureBox2.Location = new System.Drawing.Point(10, 148);
this.ultraPictureBox2.Name = "ultraPictureBox2";
this.ultraPictureBox2.Size = new System.Drawing.Size(336, 54);
this.ultraPictureBox2.TabIndex = 131;
//
// gridSelect
//
this.gridSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.gridSelect.Cursor = System.Windows.Forms.Cursors.Default;
this.gridSelect.Location = new System.Drawing.Point(10, 212);
this.gridSelect.Name = "gridSelect";
this.gridSelect.Size = new System.Drawing.Size(336, 351);
this.gridSelect.TabIndex = 0;
this.gridSelect.Text = "LT:ScheduleableUserGroup.Label.ScheduleableUsers";
this.gridSelect.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.gridSelect_ClickCellButton);
this.gridSelect.MouseDown += new System.Windows.Forms.MouseEventHandler(this.gridSelect_MouseDown);
//
// pnlLeft
//
this.pnlLeft.Controls.Add(this.lbSkills);
this.pnlLeft.Controls.Add(this.lbCertifications);
this.pnlLeft.Controls.Add(this.ultraLabel3);
this.pnlLeft.Controls.Add(this.ultraLabel2);
this.pnlLeft.Controls.Add(this.ultraLabel1);
this.pnlLeft.Controls.Add(this.ultraPictureBox1);
this.pnlLeft.Controls.Add(this.lblRegion);
this.pnlLeft.Controls.Add(this.btnCertifications);
this.pnlLeft.Controls.Add(this.btnSkills);
this.pnlLeft.Controls.Add(this.btnZone);
this.pnlLeft.Controls.Add(this.cbZone);
this.pnlLeft.Controls.Add(this.cbRegion);
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(307, 572);
this.pnlLeft.TabIndex = 0;
//
// lbSkills
//
this.lbSkills.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lbSkills.FormattingEnabled = true;
this.lbSkills.ItemHeight = 16;
this.lbSkills.Location = new System.Drawing.Point(10, 466);
this.lbSkills.Name = "lbSkills";
this.lbSkills.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.lbSkills.Size = new System.Drawing.Size(278, 84);
this.lbSkills.TabIndex = 135;
this.lbSkills.SelectedIndexChanged += new System.EventHandler(this.lbSkills_SelectedIndexChanged);
//
// lbCertifications
//
this.lbCertifications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lbCertifications.FormattingEnabled = true;
this.lbCertifications.ItemHeight = 16;
this.lbCertifications.Location = new System.Drawing.Point(10, 342);
this.lbCertifications.Name = "lbCertifications";
this.lbCertifications.SelectionMode = System.Windows.Forms.SelectionMode.MultiSimple;
this.lbCertifications.Size = new System.Drawing.Size(278, 68);
this.lbCertifications.TabIndex = 134;
this.lbCertifications.SelectedIndexChanged += new System.EventHandler(this.lbCertifications_SelectedIndexChanged);
//
// ultraLabel3
//
this.ultraLabel3.Location = new System.Drawing.Point(10, 448);
this.ultraLabel3.Name = "ultraLabel3";
this.ultraLabel3.Size = new System.Drawing.Size(268, 18);
this.ultraLabel3.TabIndex = 133;
this.ultraLabel3.Tag = "";
this.ultraLabel3.Text = "LT:UserSkill.Label.List";
//
// ultraLabel2
//
this.ultraLabel2.Location = new System.Drawing.Point(10, 324);
this.ultraLabel2.Name = "ultraLabel2";
this.ultraLabel2.Size = new System.Drawing.Size(268, 19);
this.ultraLabel2.TabIndex = 132;
this.ultraLabel2.Tag = "";
this.ultraLabel2.Text = "LT:UserCertification.Label.List";
//
// ultraLabel1
//
this.ultraLabel1.Location = new System.Drawing.Point(10, 270);
this.ultraLabel1.Name = "ultraLabel1";
this.ultraLabel1.Size = new System.Drawing.Size(268, 18);
this.ultraLabel1.TabIndex = 131;
this.ultraLabel1.Tag = "";
this.ultraLabel1.Text = "LT:O.DispatchZone";
//
// ultraPictureBox1
//
this.ultraPictureBox1.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.ultraPictureBox1.BorderShadowColor = System.Drawing.Color.Empty;
this.ultraPictureBox1.Location = new System.Drawing.Point(10, 148);
this.ultraPictureBox1.Name = "ultraPictureBox1";
this.ultraPictureBox1.Size = new System.Drawing.Size(288, 54);
this.ultraPictureBox1.TabIndex = 130;
//
// lblRegion
//
this.lblRegion.Location = new System.Drawing.Point(10, 212);
this.lblRegion.Name = "lblRegion";
this.lblRegion.Size = new System.Drawing.Size(268, 19);
this.lblRegion.TabIndex = 129;
this.lblRegion.Tag = "";
this.lblRegion.Text = "LT:O.Region";
//
// btnCertifications
//
this.btnCertifications.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
appearance1.TextHAlignAsString = "Left";
this.btnCertifications.Appearance = appearance1;
this.btnCertifications.Location = new System.Drawing.Point(10, 9);
this.btnCertifications.Name = "btnCertifications";
this.btnCertifications.Size = new System.Drawing.Size(268, 28);
this.btnCertifications.TabIndex = 3;
this.btnCertifications.Tag = "";
this.btnCertifications.Text = "LT:UserCertification.Label.List";
this.btnCertifications.UseHotTracking = Infragistics.Win.DefaultableBoolean.True;
this.btnCertifications.Visible = false;
this.btnCertifications.Click += new System.EventHandler(this.btnCertifications_Click);
//
// btnSkills
//
this.btnSkills.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
appearance2.TextHAlignAsString = "Left";
this.btnSkills.Appearance = appearance2;
this.btnSkills.Location = new System.Drawing.Point(10, 37);
this.btnSkills.Name = "btnSkills";
this.btnSkills.Size = new System.Drawing.Size(268, 28);
this.btnSkills.TabIndex = 5;
this.btnSkills.Tag = "";
this.btnSkills.Text = "LT:UserSkill.Label.List";
this.btnSkills.UseHotTracking = Infragistics.Win.DefaultableBoolean.True;
this.btnSkills.Visible = false;
this.btnSkills.Click += new System.EventHandler(this.btnSkills_Click);
//
// btnZone
//
this.btnZone.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
appearance3.TextHAlignAsString = "Left";
this.btnZone.Appearance = appearance3;
this.btnZone.Location = new System.Drawing.Point(10, 65);
this.btnZone.Name = "btnZone";
this.btnZone.Size = new System.Drawing.Size(268, 27);
this.btnZone.TabIndex = 1;
this.btnZone.Tag = "";
this.btnZone.Text = "LT:O.DispatchZone";
this.btnZone.UseHotTracking = Infragistics.Win.DefaultableBoolean.True;
this.btnZone.Visible = false;
this.btnZone.Click += new System.EventHandler(this.btnZone_Click);
//
// cbZone
//
this.cbZone.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbZone.Location = new System.Drawing.Point(10, 288);
this.cbZone.Name = "cbZone";
this.cbZone.Size = new System.Drawing.Size(278, 24);
this.cbZone.TabIndex = 2;
this.cbZone.SelectionChanged += new System.EventHandler(this.ComboBoxSelectionChanged);
//
// cbRegion
//
this.cbRegion.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbRegion.Location = new System.Drawing.Point(10, 231);
this.cbRegion.Name = "cbRegion";
this.cbRegion.Size = new System.Drawing.Size(278, 24);
this.cbRegion.TabIndex = 0;
this.cbRegion.SelectionChanged += new System.EventHandler(this.ComboBoxSelectionChanged);
//
// _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left
//
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.Name = "_ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left";
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 572);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
//
// _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right
//
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(880, 43);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.Name = "_ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right";
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 572);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
//
// _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top
//
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.Name = "_ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top";
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(880, 43);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
//
// _ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom
//
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 615);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.Name = "_ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom";
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(880, 0);
this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
//
// errorProvider1
//
this.errorProvider1.ContainerControl = this;
//
// ScheduleableUserGroupsForm
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.ClientSize = new System.Drawing.Size(880, 615);
this.Controls.Add(this.ScheduleableUserGroupsForm_Fill_Panel);
this.Controls.Add(this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Left);
this.Controls.Add(this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Right);
this.Controls.Add(this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Bottom);
this.Controls.Add(this._ScheduleableUserGroupsForm_Toolbars_Dock_Area_Top);
this.MaximumSize = new System.Drawing.Size(1152, 652);
this.MinimumSize = new System.Drawing.Size(624, 652);
this.Name = "ScheduleableUserGroupsForm";
this.ShowInTaskbar = false;
this.Text = "ScheduleableUserGroupsForm";
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.ScheduleableUserGroupsForm_Fill_Panel.ResumeLayout(false);
this.pnlRight.ResumeLayout(false);
this.pnlRight.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.gridScheduleableUsers)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.edDescription)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ckActive)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.edName)).EndInit();
this.pnlMiddle.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.gridSelect)).EndInit();
this.pnlLeft.ResumeLayout(false);
this.pnlLeft.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.cbZone)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbRegion)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.errorProvider1)).EndInit();
this.ResumeLayout(false);
}
#endregion
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
//
#region Global vars
private UserListScheduleable mUserList;
private UserListSkills mUserListSkills;
private UserListCertifications mUserListCertifications;
//variable to hold user form settings
//UIUserFormSetting mFormSetting;
private System.Data.DataSet dsUsers;
//Used to indicate that a check change has happened
private bool bCheckChanged=false;
//used to indicate form is loading
bool mLoading=true;
#endregion
#region ReadOnly Lists
private void FillReadOnlyLists()
{
//case 1039 //log.Debug("FillReadOnlyLists");
//Fill user selection list
mUserList = UserListScheduleable.GetList();
mUserListSkills=UserListSkills.GetList();
mUserListCertifications=UserListCertifications.GetList();
}
#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.EditScheduledUserGroups16icon;
this.ultraPictureBox1.Image = Resource1.GreenRightArrow16;
this.ultraPictureBox2.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.ScheduleableUserGroup")< (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.ScheduleableUserGroup")));
this.Close();
return;
}
//prepare the selection data set
dsUsers=new DataSet();
dsUsers.Tables.Add();
dsUsers.Tables[0].Columns.Add("User",typeof(string));
dsUsers.Tables[0].Columns.Add("ID",typeof(Guid));
gridSelect.DataSource=dsUsers;
gridSelect.DisplayLayout.Bands[0].Columns["ID"].Hidden=true;
gridSelect.DisplayLayout.Bands[0].Columns["User"].CellActivation=Activation.NoEdit;
gridSelect.DisplayLayout.Bands[0].Columns["User"].Header.Caption="";
gridSelect.DisplayLayout.Bands[0].Columns["User"].Header.Appearance.Image = Resource1.User16;
gridSelect.DisplayLayout.Bands[0].Columns["User"].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;
FillReadOnlyLists();
Util.LoadFormCustomization("ScheduleableUserGroups", this, tbManager, true);
Form_SizeChanged(null, null);
FillScheduleableUserGroupList();
InitializeComboBoxes();
DataBind();
PrepareGrid();
Util.LocalizeHelperInsertMenu(tbManager, this); //case 1810
Util.Localize(this);
//restrict UI based on security settings
RestrictUI();
Cursor.Current = Cursors.Default;
Application.Idle+= new EventHandler(Application_Idle);
this.Visible=true;
mLoading=false;
}
/// <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("ScheduleableUserGroups", 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/3;
this.pnlLeft.Width=nWidth;
this.pnlMiddle.Width=nWidth;
this.pnlRight.Width=nWidth;
//Added: 31-Oct-2006 check for existance of column before adjusting it as was
//causing a crash
if(gridSelect.DisplayLayout.Bands[0].Columns.Exists("User"))
gridSelect.DisplayLayout.Bands[0].Columns["User"].Width=nWidth-50;
//Added: 31-Oct-2006 check for existance of column before adjusting it as was
//causing a crash
if (gridSelect.DisplayLayout.Bands[0].Columns.Exists("ScheduleableUserID"))
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].Width=nWidth-50;
int nY=this.pnlLeft.DisplayRectangle.Height-24-((this.pnlLeft.DisplayRectangle.Height-154/*216*/)/2);
}
#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(mScheduleableUserGroup.Creator,mScheduleableUserGroup.Modifier,mScheduleableUserGroup.Created,mScheduleableUserGroup.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;
}
}
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.mScheduleableUserGroup=ScheduleableUserGroup.GetItem(g);
//mScheduleableUserGroup.BeginEdit();
DataBind();
//FillSelectionList();
}
}
#endregion Toolbar menu items
#region Hyperbuttons
private void btnZone_Click(object sender, System.EventArgs e)
{
// //case 1039 //log.Debug("btnZone_Click");
//
// GenericListForm g = new GenericListForm();
// DispatchZones o = DispatchZones.GetItems();
// g.SelectedRecordID=cbZone.Value;
// g.GridDataSource=o;
//
// g.ShowDialog();
}
private void btnCertifications_Click(object sender, System.EventArgs e)
{
// //case 1039 //log.Debug("btnCertifications_Click");
//
// GenericListForm g11 = new GenericListForm();
// UserCertifications uc = UserCertifications.GetItems();
// g11.GridDataSource=uc;
// g11.ShowDialog();
}
private void btnSkills_Click(object sender, System.EventArgs e)
{
// //case 1039 //log.Debug("btnSkills_Click");
//
// GenericListForm g10 = new GenericListForm();
// UserSkills us = UserSkills.GetItems();
// g10.GridDataSource=us;
// g10.ShowDialog();
}
#endregion Hyperbuttons
#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=mScheduleableUserGroup.IsSavable;
tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Enabled=mScheduleableUserGroup.IsSavable;
tbManager.Tools["LT:UI.Command.SaveNew"].SharedProps.Enabled=mScheduleableUserGroup.IsSavable;
//display name in title bar
this.Text=mScheduleableUserGroup.Name;
if(bCheckChanged)
{
bCheckChanged=false;
UpdateSelectionList();
}
}
/// <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.ScheduleableUserGroup")).ToString());
bool bDelete=AyaBizUtils.Right("Object.ScheduleableUserGroup")== (int)SecurityLevelTypes.ReadWriteDelete;
bool bReadOnly=AyaBizUtils.Right("Object.ScheduleableUserGroup") < (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
//Text editors
edName.Enabled=!bReadOnly;
}
#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
mScheduleableUserGroup.GetBrokenRulesCollection().ListChanged += new System.ComponentModel.ListChangedEventHandler(OnBrokenRulesChanged);
//=-=-=-=-=-=- Form Field bindings =-=-=-=-=-=-=-=-=-=-=-=
//Text editors
Util.BindField(edName,"Text",mScheduleableUserGroup,"Name");
Util.BindField(edDescription,"Text",mScheduleableUserGroup,"Description");
//Grid
Util.BindField(gridScheduleableUsers,"DataSource",mScheduleableUserGroup,"ScheduleableUsers");
//checkbox
Util.BindField(ckActive,"Checked",mScheduleableUserGroup,"Active");
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//Bind IsDirty property to hidden checkbox to
//ensure isdirtychanged event is available
//to data binding infrastructure
Util.BindField(ckIsDirty,"Checked",mScheduleableUserGroup,"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,mScheduleableUserGroup,errorProvider1);
}
#endregion
#region Business object editing / adding / deletion related code
private ScheduleableUserGroup mScheduleableUserGroup;
/// <summary>
/// Region record to display
/// set by caller
/// </summary>
public GZTW.AyaNova.BLL.ScheduleableUserGroup ScheduleableUserGroupToEdit
{
get
{
return mScheduleableUserGroup;
}
set
{
mScheduleableUserGroup=value;
//mScheduleableUserGroup.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
lblRegion.Focus();
switch(SaveType)
{
case RecordActionType.DeleteAndExit:
if(Util.PromptForDelete()==DialogResult.Yes)
{
//Delete, then exit
try
{
ScheduleableUserGroup.DeleteItem(mScheduleableUserGroup.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(mScheduleableUserGroup.IsSavable)
{
mScheduleableUserGroup.ApplyEdit();
mScheduleableUserGroup.Save();
bClosingHandled=true;
mbChangesMade=true;
this.Close();
return true;
}
if(mScheduleableUserGroup.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(mScheduleableUserGroup.IsSavable)
{
mScheduleableUserGroup.ApplyEdit();
mScheduleableUserGroup.Save();
AddNewScheduleableUserGroup();
FillScheduleableUserGroupList();
mbChangesMade=true;
return true;
}
if(mScheduleableUserGroup.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
AddNewScheduleableUserGroup();
FillScheduleableUserGroupList();
return true;
}
else return false;
}
//Current record isn't dirty so just add a new one
AddNewScheduleableUserGroup();
return true;
case RecordActionType.SaveOnly:
if(mScheduleableUserGroup.IsSavable)
{
mScheduleableUserGroup.ApplyEdit();
mScheduleableUserGroup=(GZTW.AyaNova.BLL.ScheduleableUserGroup)mScheduleableUserGroup.Save();
DataBind();
FillScheduleableUserGroupList();
mbChangesMade=true;
return true;
}
return true;
case RecordActionType.PromptToSave:
//Prompt to save and save if
//required
if(mScheduleableUserGroup.IsDirty)
{
DialogResult dr=Util.PromptForSave();
if(dr==DialogResult.Cancel)
{
//Cancel
return false;
}
if(dr==DialogResult.Yes)
{
//Save before exit
if(mScheduleableUserGroup.IsSavable)
{
mScheduleableUserGroup.ApplyEdit();
mScheduleableUserGroup.Save();
mbChangesMade=true;
return true;
}
if(mScheduleableUserGroup.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 AddNewScheduleableUserGroup()
{
//case 1039 //log.Debug("AddNewScheduleableUserGroup");
try
{
mScheduleableUserGroup=GZTW.AyaNova.BLL.ScheduleableUserGroup.NewItem();
//mScheduleableUserGroup.BeginEdit();
DataBind();
}
catch(Exception ex)
{
//log.Error("AddNewScheduleableUserGroup",ex);
MessageBox.Show(ex.Message+"\r\n"+ex.Source);
}
}
#endregion
#region Form ComboBoxes (Setup / Events)
#region Loading
private void InitializeComboBoxes()
{
//case 1039 //log.Debug("InitializeComboBoxes");
//Load combo boxes
Util.FillGZComboBoxWithNameIDList("DispatchZone",cbZone,false,Guid.Empty,true);
Util.FillGZComboBoxWithNameIDList("Region",cbRegion,false,Guid.Empty,false);//<--case 58 hmmm...?
//Fill Certs and skills
//NVCHANGED
//Changed: 2-Oct-2006
//changes to replace setting DataSource
//with manually loading items instead
//apparently microsoft removed DataSource support for
//checkedlistbox control with .net 2 so that's why it's gone wonky
//note that they did this instead of fixing a bug in it!
GenericNVList lCerts=GenericNVList.GetList("aUserCertification","aID","aName",true,true,false);
if(lCerts.Count>0)
{
lbCertifications.DisplayMember = "Value";
lbCertifications.ValueMember = "Key";
lbCertifications.DataSource = lCerts.BindableList;
}
lbCertifications.SelectedItems.Clear();
//NVCHANGED
GenericNVList lSkills=GenericNVList.GetList("aUserSkill","aID","aName",true,true,false);
if(lSkills.Count>0)
{
lbSkills.DisplayMember="Value";
lbSkills.ValueMember="Key";
lbSkills.DataSource=lSkills.BindableList;
}
lbSkills.SelectedItems.Clear();
}
#endregion
#region Events
private void ComboBoxSelectionChanged(object sender, System.EventArgs e)
{
UpdateSelectionList();
}
private void lbCertifications_SelectedIndexChanged(object sender, EventArgs e)
{
bCheckChanged = true;
}
private void lbSkills_SelectedIndexChanged(object sender, EventArgs e)
{
bCheckChanged = true;
}
#endregion
#endregion
#region Grid preparation
private void PrepareGrid()
{
//case 1039 //log.Debug("PrepareGrid");
gridScheduleableUsers.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle;
gridScheduleableUsers.DisplayLayout.Override.AllowAddNew=AllowAddNew.No;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserGroupID"].Hidden=true;
Util.GridPreLocalize("ScheduleableUserGroupUser",gridScheduleableUsers.DisplayLayout.Bands[0]);
Util.GridHideEditableBizObjectInternalFields(gridScheduleableUsers);
gridScheduleableUsers.DisplayLayout.Bands[0].Columns.Add("REMOVE","");
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Caption="";
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.Button;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.Image = Resource1.Delete16;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.ImageHAlign=HAlign.Center;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].CellButtonAppearance.ImageVAlign=VAlign.Middle;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Appearance.Image = Resource1.Delete16;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].Header.Appearance.ImageHAlign=HAlign.Center;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].Width=24;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].MinWidth=24;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["REMOVE"].MaxWidth=24;
gridScheduleableUsers.DisplayLayout.Bands[0].Override.RowSelectors=DefaultableBoolean.False;
gridScheduleableUsers.DisplayLayout.Bands[0].Override.CellPadding=0;
gridScheduleableUsers.DisplayLayout.Bands[0].Override.DefaultRowHeight=22;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].CellActivation=Activation.NoEdit;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].Header.Caption="";
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].Header.Appearance.Image = Resource1.User16;
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].Header.Appearance.ImageHAlign=HAlign.Center;
Util.LocalizeGrid(gridScheduleableUsers);
#region ======== Sheduleable users value list ========
//Add all potential active items
ValueList vlTechs=new ValueList();
foreach(UserListScheduleable.UserListScheduleableInfo ui in mUserList)
{
if(ui.Active==true)
vlTechs.ValueListItems.Add(ui.ID,ui.Name(Util.GlobalSettings.DefaultScheduleableUserNameDisplayFormat));
}
//Show sorted alphabetically
vlTechs.SortStyle=ValueListSortStyle.Ascending;
//Bind value lists to correct columns in grid
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].ValueList=vlTechs;
//Set column to dropdownlist style so that user can not type an invalid value in a cell
//but must select from the list only
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
gridScheduleableUsers.DisplayLayout.Bands[0].Columns["ScheduleableUserID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
#endregion
}
#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 SelectedUser=(Guid)e.Cell.Row.Cells["ID"].Value;
//See if it's in the list already
//ScheduleableUserGroupUser u= this.mScheduleableUserGroup.ScheduleableUsers[
foreach(ScheduleableUserGroupUser u in mScheduleableUserGroup.ScheduleableUsers)
{
if(u.ScheduleableUserID==SelectedUser)
return;
}
//not there so put it in
ScheduleableUserGroupUser u2=mScheduleableUserGroup.ScheduleableUsers.Add(mScheduleableUserGroup);
u2.ScheduleableUserID=SelectedUser;
}
/// <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 SelectedUser=(Guid)r.Cells["ID"].Value;
bool bPresent=false;
//See if it's in the list already
foreach(ScheduleableUserGroupUser u in mScheduleableUserGroup.ScheduleableUsers)
{
if(u.ScheduleableUserID==SelectedUser)
{
bPresent=true;
break;
}
}
//not there so put it in
if(!bPresent)
{
ScheduleableUserGroupUser u2=mScheduleableUserGroup.ScheduleableUsers.Add(mScheduleableUserGroup);
u2.ScheduleableUserID=SelectedUser;
}
}
}
/// <summary>
///Delete all rows?
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void gridScheduleableUsers_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
{
}
private void gridScheduleableUsers_ClickCellButton(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e)
{
Cursor.Current=Cursors.WaitCursor;
Guid SelectedUser=(Guid)e.Cell.Row.Cells["ID"].Value;
try
{
mScheduleableUserGroup.ScheduleableUsers.Remove(SelectedUser);
}
catch
{
//do nothing it will throw an error that is ok to ignore
}
}
#endregion
#region Apply criteria and update list of eligable scheduleable users
private void UpdateSelectionList()
{
//case 1039 //log.Debug("UpdateSelectionList");
//Step 1: use the region and dispatch zone criteria to build the initial list
if(mLoading || cbRegion.Value==null || cbZone.Value==null) return;
DataRow dr;
dsUsers.Tables[0].Rows.Clear();
Guid SelectedRegion=(Guid)cbRegion.Value;
Guid SelectedZone=(Guid)cbZone.Value;
//Get scheduleable user list for this region
foreach(UserListScheduleable.UserListScheduleableInfo ui in mUserList)
{
if(ui.Active)
{
//Skip if region selected and doesn't match
if(SelectedRegion!=Guid.Empty && ui.RegionID!=SelectedRegion)
continue;
//Skip if zone selected and doesn't match
if(SelectedZone!=Guid.Empty && ui.DispatchZoneID!=SelectedZone)
continue;
if(!UserMeetsSkillCriteria(ui.ID))
continue;
if(!UserMeetsCertificationCriteria(ui.ID))
continue;
dr=dsUsers.Tables[0].NewRow();
dr["User"]=ui.Name(Util.GlobalSettings.DefaultScheduleableUserNameDisplayFormat);
dr["ID"]=ui.ID;
dsUsers.Tables[0].Rows.Add(dr);
}
}
//Step 2: use the certifications and skills to remove from the list
}
/// <summary>
/// Skill matches?
/// </summary>
/// <param name="UserID"></param>
/// <returns></returns>
private bool UserMeetsSkillCriteria(Guid UserID)
{
//case 1039 //log.Debug("UserMeetsSkillCriteria");
//If nothing selected then definitely meets the criteria
if(lbSkills.SelectedItems.Count==0)
return true;
int nMatches=0;
//Foreach checked item see if this user matches that items ID in the read only list
for(int x=0;x<this.lbSkills.SelectedItems.Count;x++)
{
//Changed 17-April-2006 was still using Value instead of key from before nvlist change
Guid SelectedItem=new Guid(((DictionaryEntry)this.lbSkills.SelectedItems[x]).Key.ToString());
//Count how many items this user matches, if they are not matching all then it's not a match overall
foreach(UserListSkills.UserListSkillsInfo i in mUserListSkills)
{
if(i.SkillID==SelectedItem && i.UserID==UserID)
nMatches++;
}
}
if(nMatches==lbSkills.SelectedItems.Count)
return true;
return false;
}
/// <summary>
/// Certification
/// </summary>
/// <param name="UserID"></param>
/// <returns></returns>
private bool UserMeetsCertificationCriteria(Guid UserID)
{
//Changed: 2-Oct-2006 to use listbox instead of checklistbox
//case 1039 //log.Debug("UserMeetsCertificationCriteria");
if (lbCertifications.SelectedItems.Count == 0)
return true;
int nMatches=0;
//Count how many items this user matches, if they are not matching all then it's not a match overall
for(int x=0;x<this.lbCertifications.SelectedItems.Count;x++)
{
//Changed 17-April-2006 was still using Value instead of key from before nvlist change
Guid SelectedItem=new Guid(((DictionaryEntry)this.lbCertifications.SelectedItems[x]).Key.ToString());
//see if this user and certification are in the list
foreach(UserListCertifications.UserListCertificationsInfo i in mUserListCertifications)
{
if(i.CertificationID==SelectedItem && i.UserID==UserID)
nMatches++;
}
}
if(nMatches==lbCertifications.SelectedItems.Count)
return true;
return false;
}
#endregion
#region Fill ScheduleableUserGroup list combo
private void FillScheduleableUserGroupList()
{
//case 1039 //log.Debug("FillScheduleableUserGroupList");
ComboBoxTool cbt = (ComboBoxTool)tbManager.Tools["LT:ScheduleableUserGroup.Label.List"];
cbt.AutoComplete=true;
cbt.ValueList.ValueListItems.Clear();
//NVCHANGED
GenericNVList l=GenericNVList.GetList("aScheduleableUserGroup","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(!mScheduleableUserGroup.IsNew)
{
foreach(ValueListItem vi in cbt.ValueList.ValueListItems)
{
if((Guid)vi.DataValue==mScheduleableUserGroup.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
}
}