639 lines
27 KiB
C#
639 lines
27 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.UltraWinEditors;
|
|
using log4net;
|
|
|
|
namespace AyaNova
|
|
{
|
|
/// <summary>
|
|
/// Summary description for RatesForm.
|
|
/// </summary>
|
|
public class RatesForm : 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.UltraWinGrid.UltraGrid Grid;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _RatesForm_Toolbars_Dock_Area_Left;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _RatesForm_Toolbars_Dock_Area_Right;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _RatesForm_Toolbars_Dock_Area_Top;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _RatesForm_Toolbars_Dock_Area_Bottom;
|
|
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager;
|
|
private System.Windows.Forms.HelpProvider helpProvider1;
|
|
private System.ComponentModel.IContainer components;
|
|
|
|
public RatesForm()
|
|
{
|
|
//
|
|
// 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("RateMenuBar");
|
|
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool1 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool1 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:RateUnitChargeDescription.Label.List");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool2 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:ClientGroup.Label.List");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:RateUnitChargeDescription.Label.List");
|
|
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:ClientGroup.Label.List");
|
|
Infragistics.Win.UltraWinToolbars.ListTool listTool1 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST");
|
|
Infragistics.Win.UltraWinToolbars.PopupMenuTool popupMenuTool2 = new Infragistics.Win.UltraWinToolbars.PopupMenuTool("LT:UI.Toolbar.Print");
|
|
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
|
|
Infragistics.Win.UltraWinToolbars.ListTool listTool2 = new Infragistics.Win.UltraWinToolbars.ListTool("REPORTLIST");
|
|
this.Grid = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
|
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
|
|
this._RatesForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._RatesForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._RatesForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
|
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
|
|
((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
|
|
this.SuspendLayout();
|
|
//
|
|
// Grid
|
|
//
|
|
this.Grid.Cursor = System.Windows.Forms.Cursors.Hand;
|
|
this.Grid.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.Grid.Location = new System.Drawing.Point(0, 26);
|
|
this.Grid.Name = "Grid";
|
|
this.Grid.Size = new System.Drawing.Size(520, 339);
|
|
this.Grid.TabIndex = 0;
|
|
this.Grid.InitializeRow += new Infragistics.Win.UltraWinGrid.InitializeRowEventHandler(this.Grid_InitializeRow);
|
|
this.Grid.ClickCellButton += new Infragistics.Win.UltraWinGrid.CellEventHandler(this.Grid_ClickCellButton);
|
|
this.Grid.MouseEnterElement += new Infragistics.Win.UIElementEventHandler(this.Grid_MouseEnterElement);
|
|
//
|
|
// 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[] {
|
|
popupMenuTool1,
|
|
buttonTool1,
|
|
buttonTool2});
|
|
ultraToolbar1.Settings.AllowCustomize = Infragistics.Win.DefaultableBoolean.False;
|
|
ultraToolbar1.Settings.AllowFloating = Infragistics.Win.DefaultableBoolean.False;
|
|
ultraToolbar1.Settings.AllowHiding = Infragistics.Win.DefaultableBoolean.False;
|
|
ultraToolbar1.Text = "RateMenuBar";
|
|
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;
|
|
buttonTool3.SharedPropsInternal.Caption = "LT:RateUnitChargeDescription.Label.List";
|
|
buttonTool3.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
|
buttonTool4.SharedPropsInternal.Caption = "LT:ClientGroup.Label.List";
|
|
buttonTool4.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageAndText;
|
|
listTool1.DisplayCheckmark = false;
|
|
appearance1.Image = global::AyaNova.Resource1.Print32;
|
|
popupMenuTool2.SharedPropsInternal.AppearancesLarge.Appearance = appearance1;
|
|
appearance2.Image = global::AyaNova.Resource1.Print16;
|
|
popupMenuTool2.SharedPropsInternal.AppearancesSmall.Appearance = appearance2;
|
|
popupMenuTool2.SharedPropsInternal.Caption = "LT:UI.Toolbar.Print";
|
|
popupMenuTool2.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.ImageOnlyOnToolbars;
|
|
popupMenuTool2.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
listTool2});
|
|
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
|
buttonTool3,
|
|
buttonTool4,
|
|
listTool1,
|
|
popupMenuTool2});
|
|
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
|
|
//
|
|
// _RatesForm_Toolbars_Dock_Area_Left
|
|
//
|
|
this._RatesForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._RatesForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
|
|
this._RatesForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
|
|
this._RatesForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._RatesForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 26);
|
|
this._RatesForm_Toolbars_Dock_Area_Left.Name = "_RatesForm_Toolbars_Dock_Area_Left";
|
|
this._RatesForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 339);
|
|
this._RatesForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _RatesForm_Toolbars_Dock_Area_Right
|
|
//
|
|
this._RatesForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._RatesForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
|
|
this._RatesForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
|
|
this._RatesForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._RatesForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(520, 26);
|
|
this._RatesForm_Toolbars_Dock_Area_Right.Name = "_RatesForm_Toolbars_Dock_Area_Right";
|
|
this._RatesForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 339);
|
|
this._RatesForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _RatesForm_Toolbars_Dock_Area_Top
|
|
//
|
|
this._RatesForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._RatesForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
|
|
this._RatesForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
|
|
this._RatesForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._RatesForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
|
|
this._RatesForm_Toolbars_Dock_Area_Top.Name = "_RatesForm_Toolbars_Dock_Area_Top";
|
|
this._RatesForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(520, 26);
|
|
this._RatesForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
|
|
//
|
|
// _RatesForm_Toolbars_Dock_Area_Bottom
|
|
//
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 365);
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.Name = "_RatesForm_Toolbars_Dock_Area_Bottom";
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(520, 0);
|
|
this._RatesForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
|
|
//
|
|
// RatesForm
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
|
this.ClientSize = new System.Drawing.Size(520, 365);
|
|
this.Controls.Add(this.Grid);
|
|
this.Controls.Add(this._RatesForm_Toolbars_Dock_Area_Left);
|
|
this.Controls.Add(this._RatesForm_Toolbars_Dock_Area_Right);
|
|
this.Controls.Add(this._RatesForm_Toolbars_Dock_Area_Bottom);
|
|
this.Controls.Add(this._RatesForm_Toolbars_Dock_Area_Top);
|
|
this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
|
|
this.Name = "RatesForm";
|
|
this.helpProvider1.SetShowHelp(this, true);
|
|
this.ShowInTaskbar = false;
|
|
this.Text = "RatesForm";
|
|
this.Closing += new System.ComponentModel.CancelEventHandler(this.RatesForm_Closing);
|
|
this.Load += new System.EventHandler(this.RatesForm_Load);
|
|
((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
|
|
this.ResumeLayout(false);
|
|
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
|
|
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
|
|
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
|
|
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
|
|
//
|
|
|
|
#region Load / Close
|
|
|
|
Rates r=null;
|
|
|
|
private void RatesForm_Load(object sender, System.EventArgs e)
|
|
{
|
|
//
|
|
// helpProvider1
|
|
//
|
|
this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "Rates.htm";
|
|
|
|
//case 1039 //log.Debug("RatesForm_Load");
|
|
this.Icon = Resource1.Rates16icon;
|
|
//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 User edit screen from elsewhere in the program)
|
|
if(AyaBizUtils.Right("Object.Rate")< (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.Rate")));
|
|
|
|
this.Close();
|
|
return;
|
|
}
|
|
|
|
|
|
Grid.Text="";
|
|
|
|
this.Text=Util.LocaleText.GetLocalizedText("Rate.Label.List");
|
|
|
|
r=Rates.GetItems(true);
|
|
Grid.DataSource=r;
|
|
|
|
//Move to selected record if one
|
|
if (mSelectedRecordID != Guid.Empty)
|
|
{
|
|
if (Grid.DisplayLayout.Bands[0].Columns.Exists("ID"))
|
|
{
|
|
foreach (UltraGridRow rw in Grid.Rows)
|
|
{
|
|
if ((Guid)rw.Cells["ID"].Value == mSelectedRecordID)
|
|
{
|
|
rw.Selected = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
InitializeGrid();
|
|
Grid.UpdateMode=UpdateMode.OnCellChangeOrLostFocus;
|
|
Util.LoadFormCustomization("Rates", this, tbManager, false);
|
|
|
|
|
|
//Localize the toolbar
|
|
Util.Localize(tbManager);
|
|
if (AyaBizUtils.Right("Object.Report") < (int)SecurityLevelTypes.ReadOnly)
|
|
{
|
|
tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
tbManager.Tools["LT:UI.Toolbar.Print"].SharedProps.Visible = true;
|
|
Util.ReportFillList(this.tbManager.Tools["REPORTLIST"], Rates.ReportKey, "");
|
|
}
|
|
|
|
//Set rights
|
|
Util.SetAccess((AyaBizUtils.Right("Object.Rate")< (int)SecurityLevelTypes.ReadWrite),this,(AyaBizUtils.Right("Object.Rate")< (int)SecurityLevelTypes.ReadWriteDelete) );
|
|
|
|
//case 1172
|
|
if(AyaBizUtils.Lite)
|
|
tbManager.Tools["LT:ClientGroup.Label.List"].SharedProps.Visible = false;
|
|
|
|
if ((SecurityLevelTypes)AyaBizUtils.Right(RootObjectTypes.Rate) > SecurityLevelTypes.ReadWrite)
|
|
Util.GridAddDeleteButton(Grid);
|
|
else
|
|
Util.GridRemoveDeleteButton(Grid);
|
|
|
|
}
|
|
|
|
private void RatesForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
|
{
|
|
//case 1039 //log.Debug("RatesForm_Closing");
|
|
|
|
Grid.UpdateData();
|
|
if(r.IsDirty)
|
|
{
|
|
if(!r.IsValid)
|
|
{
|
|
if(Util.PromptForBrokenRulesCancelSave()!=DialogResult.Yes)
|
|
{
|
|
e.Cancel=true;
|
|
return;
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
mbChangesMade=true;
|
|
|
|
try
|
|
{
|
|
r.Save();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Util.ReportSQLError(ex);
|
|
|
|
}
|
|
}
|
|
}
|
|
//Is it dirty?
|
|
//if so, it wasn't saved previously
|
|
//so we have broken rules here
|
|
|
|
Util.SaveGridLayout("Rates","","",Grid);
|
|
Util.SaveFormCustomization("Rates", this, tbManager, false);
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region Grid Initialization
|
|
|
|
|
|
/// <summary>
|
|
/// Get grid ready
|
|
/// </summary>
|
|
private void InitializeGrid()
|
|
{
|
|
//case 1039 //log.Debug("InitializeGrid");
|
|
|
|
Grid.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle;
|
|
Grid.DisplayLayout.Override.AllowAddNew=AllowAddNew.TemplateOnBottom;
|
|
//Grid.DisplayLayout.AutoFitColumns=false;
|
|
|
|
Util.GridPreLocalize("Rate",Grid.DisplayLayout.Bands[0]);
|
|
Util.GridHideEditableBizObjectInternalFields(Grid);
|
|
Util.FetchGridLayout("Rates","",Grid);
|
|
PopulateGridValueLists();
|
|
|
|
Util.LocalizeGrid(Grid);
|
|
|
|
//Format cells for currency format
|
|
Grid.DisplayLayout.Bands[0].Columns["Cost"].Format="c";
|
|
Grid.DisplayLayout.Bands[0].Columns["Cost"].CellAppearance.TextHAlign=HAlign.Right;
|
|
|
|
Grid.DisplayLayout.Bands[0].Columns["Charge"].Format="c";
|
|
Grid.DisplayLayout.Bands[0].Columns["Charge"].CellAppearance.TextHAlign=HAlign.Right;
|
|
|
|
|
|
|
|
//
|
|
// Grid.DisplayLayout.Bands[0].Columns["LT_PurchaseOrder_Label_AdditionalCharges"].Format="c";
|
|
// Grid.DisplayLayout.Bands[0].Columns["LT_PurchaseOrder_Label_AdditionalCharges"].CellAppearance.TextHAlign=HAlign.Right;
|
|
//
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Populate the drop down lists inside the grid
|
|
/// so they display and can select the correct underlying
|
|
/// value
|
|
/// </summary>
|
|
private void PopulateGridValueLists()
|
|
{
|
|
//case 1039 //log.Debug("PopulateGridValueLists");
|
|
|
|
Grid.DisplayLayout.ValueLists.Clear();
|
|
|
|
//Populate Rateunitchargedescription lists
|
|
ValueList vl=Grid.DisplayLayout.ValueLists.Add("RateUnitCharges");
|
|
//NVCHANGED
|
|
GenericNVList l=GenericNVList.GetList("aRateUnitChargeDescription","aID","aName",true,false,false);
|
|
|
|
//Add initial empty guid value
|
|
//so that records with no value yet entered in the
|
|
//field will be shown as an empty string
|
|
vl.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318
|
|
|
|
//Loop through the items in the list and put them
|
|
//into the valuelist
|
|
for(int x=0;x<l.Count;x++)
|
|
{
|
|
vl.ValueListItems.Add(new Guid(((DictionaryEntry)l.BindableList[x]).Key.ToString()),
|
|
((DictionaryEntry)l.BindableList[x]).Value.ToString());
|
|
}
|
|
|
|
|
|
//Bind value lists to correct columns in grid
|
|
Grid.DisplayLayout.Bands[0].Columns["RateUnitChargeDescriptionID"].ValueList=Grid.DisplayLayout.ValueLists["RateUnitCharges"];
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
Grid.DisplayLayout.Bands[0].Columns["RateUnitChargeDescriptionID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
Grid.DisplayLayout.Bands[0].Columns["RateUnitChargeDescriptionID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
|
|
|
|
//Populate Client groups value list
|
|
vl=Grid.DisplayLayout.ValueLists.Add("ClientGroups");
|
|
//NVCHANGED
|
|
l=GenericNVList.GetList("aClientGroup","aID","aName",true,false,false);
|
|
|
|
//Add initial empty guid value
|
|
//so that records with no value yet entered in the
|
|
//field will be shown as an empty string
|
|
vl.ValueListItems.Add(Guid.Empty, Util.NoSelectionString);//Case 318
|
|
|
|
//Loop through the items in the list and put them
|
|
//into the valuelist
|
|
for(int x=0;x<l.Count;x++)
|
|
{
|
|
vl.ValueListItems.Add(new Guid(((DictionaryEntry)l.BindableList[x]).Key.ToString()),
|
|
((DictionaryEntry)l.BindableList[x]).Value.ToString());
|
|
}
|
|
|
|
|
|
//Bind value lists to correct columns in grid
|
|
Grid.DisplayLayout.Bands[0].Columns["ClientGroupID"].ValueList=Grid.DisplayLayout.ValueLists["ClientGroups"];
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
Grid.DisplayLayout.Bands[0].Columns["ClientGroupID"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
Grid.DisplayLayout.Bands[0].Columns["ClientGroupID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
|
|
//Populate RateTypes value list
|
|
vl=Grid.DisplayLayout.ValueLists.Add("RateTypes");
|
|
|
|
|
|
//Add initial empty guid value
|
|
//so that records with no value yet entered in the
|
|
//field will be shown as an empty string
|
|
vl.ValueListItems.Add(0,Util.NoSelectionString);//Case 318
|
|
vl.ValueListItems.Add(RateTypes.Service,Util.LocaleText.GetLocalizedText("Rate.Label.RateType.Service"));
|
|
vl.ValueListItems.Add(RateTypes.Travel,Util.LocaleText.GetLocalizedText("Rate.Label.RateType.Travel"));
|
|
|
|
|
|
//Bind value lists to correct columns in grid
|
|
Grid.DisplayLayout.Bands[0].Columns["RateType"].ValueList=Grid.DisplayLayout.ValueLists["RateTypes"];
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
Grid.DisplayLayout.Bands[0].Columns["RateType"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
Grid.DisplayLayout.Bands[0].Columns["RateType"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
|
|
|
|
//Regions
|
|
vl = Grid.DisplayLayout.ValueLists.Add("Regions");
|
|
|
|
|
|
l = GenericNVList.GetList("aRegion", "aID", "aName", true, true, true);
|
|
|
|
//Loop through the items in the list and put them
|
|
//into the valuelist
|
|
for (int x = 0; x < l.Count; x++)
|
|
{
|
|
vl.ValueListItems.Add(new Guid(((DictionaryEntry)l.BindableList[x]).Key.ToString()),
|
|
((DictionaryEntry)l.BindableList[x]).Value.ToString());
|
|
}
|
|
vl.SortStyle = ValueListSortStyle.Ascending;
|
|
|
|
//Bind value lists to correct columns in grid
|
|
Grid.DisplayLayout.Bands[0].Columns["RegionID"].ValueList = Grid.DisplayLayout.ValueLists["Regions"];
|
|
|
|
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
|
//but must select from the list only
|
|
Grid.DisplayLayout.Bands[0].Columns["RegionID"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
|
Grid.DisplayLayout.Bands[0].Columns["RegionID"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
|
Grid.DisplayLayout.Bands[0].Columns["RegionID"].Hidden = false;
|
|
|
|
|
|
if (AyaBizUtils.Lite)
|
|
{
|
|
Grid.DisplayLayout.Bands[0].Columns["RegionID"].Hidden = true;
|
|
Grid.DisplayLayout.Bands[0].Columns["ClientGroupID"].Hidden = true;
|
|
Grid.DisplayLayout.Bands[0].Columns["RateType"].Hidden = true;
|
|
Grid.DisplayLayout.Bands[0].Columns["RateType"].Hidden = true;
|
|
Grid.DisplayLayout.Bands[0].Columns["ContractRate"].Hidden = true;
|
|
|
|
}
|
|
|
|
}
|
|
#endregion
|
|
|
|
#region Events
|
|
|
|
|
|
|
|
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:RateUnitChargeDescription.Label.List": // ButtonTool
|
|
{
|
|
GenericListForm g = new GenericListForm();
|
|
RateUnitChargeDescriptions o = RateUnitChargeDescriptions.GetItems();
|
|
g.GridDataSource=o;
|
|
g.ShowDialog();
|
|
if(g.ChangesMade)
|
|
{
|
|
PopulateGridValueLists();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case "LT:ClientGroup.Label.List": // ButtonTool
|
|
{
|
|
GenericListForm g = new GenericListForm();
|
|
ClientGroups o = ClientGroups.GetItems();
|
|
g.GridDataSource=o;
|
|
g.ShowDialog();
|
|
if(g.ChangesMade)
|
|
{
|
|
PopulateGridValueLists();
|
|
}
|
|
}
|
|
break;
|
|
|
|
case "REPORTLIST":
|
|
{
|
|
|
|
Util.ReportHandleToolClick(e.Tool,Rates.ReportKey,Grid.DataSource);
|
|
Util.ReportFillList(this.tbManager.Tools["REPORTLIST"],Rates.ReportKey,"");
|
|
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
#region properties
|
|
//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;
|
|
}
|
|
}
|
|
|
|
|
|
//Added 2-Oct-2006 to support search form by
|
|
//pre-selecting selected rate
|
|
private Guid mSelectedRecordID = Guid.Empty;
|
|
public object SelectedRecordID
|
|
{
|
|
set
|
|
{
|
|
if (value != null)
|
|
mSelectedRecordID = (Guid)value;
|
|
}
|
|
get
|
|
{
|
|
return mSelectedRecordID;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
#region GridBrokenRuleFeedBack
|
|
|
|
/// <summary>
|
|
/// Show error icons if rules broken
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Grid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
|
|
{
|
|
Util.GridShowBrokenRulesErrorIcons(e);
|
|
|
|
}
|
|
|
|
|
|
//Tool tip to use for displaying broken rules
|
|
private System.Windows.Forms.ToolTip tipError = new System.Windows.Forms.ToolTip();
|
|
|
|
/// <summary>
|
|
/// Display broken rules in tool tip if hovering over
|
|
/// error icon
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void Grid_MouseEnterElement(object sender, Infragistics.Win.UIElementEventArgs e)
|
|
{
|
|
Util.GridShowBrokenRulesToolTip(e,tipError);
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void Grid_ClickCellButton(object sender, CellEventArgs e)
|
|
{//case 1105
|
|
if (e.Cell.Column.Key == "REMOVE")
|
|
{
|
|
Cursor.Current = Cursors.WaitCursor;
|
|
Grid.DisplayLayout.ActiveRow.Delete();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|