This commit is contained in:
571
source/WinFormApp/CustomizableObjectInfoForm.cs
Normal file
571
source/WinFormApp/CustomizableObjectInfoForm.cs
Normal file
@@ -0,0 +1,571 @@
|
||||
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 log4net;
|
||||
|
||||
namespace AyaNova
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for CustomizableObjectInfoForm.
|
||||
/// </summary>
|
||||
public class CustomizableObjectInfoForm : 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 gridSetup;
|
||||
private Infragistics.Win.UltraWinToolbars.UltraToolbarsManager tbManager;
|
||||
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ClientInfoForm_Toolbars_Dock_Area_Top;
|
||||
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ClientInfoForm_Toolbars_Dock_Area_Bottom;
|
||||
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ClientInfoForm_Toolbars_Dock_Area_Left;
|
||||
private Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea _ClientInfoForm_Toolbars_Dock_Area_Right;
|
||||
private System.Windows.Forms.Panel panelLeft;
|
||||
private System.Windows.Forms.Panel panelRight;
|
||||
private Infragistics.Win.UltraWinGrid.UltraGrid gridLocale;
|
||||
private System.Windows.Forms.HelpProvider helpProvider1;
|
||||
private System.ComponentModel.IContainer components;
|
||||
|
||||
public CustomizableObjectInfoForm()
|
||||
{
|
||||
//
|
||||
// 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.Appearance appearance1 = new Infragistics.Win.Appearance();
|
||||
Infragistics.Win.UltraWinToolbars.UltraToolbar ultraToolbar1 = new Infragistics.Win.UltraWinToolbars.UltraToolbar("ClientEntryMenuBar");
|
||||
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.Save");
|
||||
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool3 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
||||
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool4 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.SaveClose");
|
||||
Infragistics.Win.Appearance appearance3 = new Infragistics.Win.Appearance();
|
||||
Infragistics.Win.Appearance appearance4 = new Infragistics.Win.Appearance();
|
||||
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool5 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Save");
|
||||
Infragistics.Win.UltraWinToolbars.ButtonTool buttonTool6 = new Infragistics.Win.UltraWinToolbars.ButtonTool("LT:UI.Command.Close");
|
||||
Infragistics.Win.Appearance appearance2 = new Infragistics.Win.Appearance();
|
||||
this.gridSetup = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
||||
this.tbManager = new Infragistics.Win.UltraWinToolbars.UltraToolbarsManager(this.components);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right = new Infragistics.Win.UltraWinToolbars.UltraToolbarsDockArea();
|
||||
this.panelLeft = new System.Windows.Forms.Panel();
|
||||
this.panelRight = new System.Windows.Forms.Panel();
|
||||
this.gridLocale = new Infragistics.Win.UltraWinGrid.UltraGrid();
|
||||
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridSetup)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tbManager)).BeginInit();
|
||||
this.panelLeft.SuspendLayout();
|
||||
this.panelRight.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridLocale)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// gridSetup
|
||||
//
|
||||
this.gridSetup.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.gridSetup.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn;
|
||||
this.gridSetup.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
|
||||
this.gridSetup.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
|
||||
this.gridSetup.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.True;
|
||||
appearance1.BackColor = System.Drawing.Color.Cornsilk;
|
||||
this.gridSetup.DisplayLayout.Override.RowAlternateAppearance = appearance1;
|
||||
this.gridSetup.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridSetup.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridSetup.Name = "gridSetup";
|
||||
this.gridSetup.Size = new System.Drawing.Size(374, 520);
|
||||
this.gridSetup.TabIndex = 1;
|
||||
//
|
||||
// tbManager
|
||||
//
|
||||
this.tbManager.DesignerFlags = 1;
|
||||
this.tbManager.DockWithinContainer = this;
|
||||
this.tbManager.DockWithinContainerBaseType = typeof(System.Windows.Forms.Form);
|
||||
this.tbManager.ShowFullMenusDelay = 500;
|
||||
ultraToolbar1.DockedColumn = 0;
|
||||
ultraToolbar1.DockedRow = 0;
|
||||
ultraToolbar1.NonInheritedTools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
||||
buttonTool1,
|
||||
buttonTool2,
|
||||
buttonTool3});
|
||||
ultraToolbar1.Text = "ClientEntryMenuBar";
|
||||
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;
|
||||
buttonTool4.SharedPropsInternal.AccessibleDescription = "recorddd";
|
||||
appearance3.Image = global::AyaNova.Resource1.SaveExit32;
|
||||
buttonTool4.SharedPropsInternal.AppearancesLarge.Appearance = appearance3;
|
||||
appearance4.Image = global::AyaNova.Resource1.SaveExit16;
|
||||
buttonTool4.SharedPropsInternal.AppearancesSmall.Appearance = appearance4;
|
||||
buttonTool4.SharedPropsInternal.Caption = "LT:UI.Command.SaveClose";
|
||||
buttonTool5.SharedPropsInternal.Caption = "LT:UI.Command.Save";
|
||||
buttonTool5.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
||||
buttonTool6.SharedPropsInternal.Caption = "LT:UI.Command.Close";
|
||||
buttonTool6.SharedPropsInternal.DisplayStyle = Infragistics.Win.UltraWinToolbars.ToolDisplayStyle.TextOnlyAlways;
|
||||
this.tbManager.Tools.AddRange(new Infragistics.Win.UltraWinToolbars.ToolBase[] {
|
||||
buttonTool4,
|
||||
buttonTool5,
|
||||
buttonTool6});
|
||||
this.tbManager.UseLargeImagesOnToolbar = true;
|
||||
this.tbManager.ToolClick += new Infragistics.Win.UltraWinToolbars.ToolClickEventHandler(this.tbManager_ToolClick);
|
||||
//
|
||||
// _ClientInfoForm_Toolbars_Dock_Area_Top
|
||||
//
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Top;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.Location = new System.Drawing.Point(0, 0);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.Name = "_ClientInfoForm_Toolbars_Dock_Area_Top";
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.Size = new System.Drawing.Size(746, 43);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Top.ToolbarsManager = this.tbManager;
|
||||
//
|
||||
// _ClientInfoForm_Toolbars_Dock_Area_Bottom
|
||||
//
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Bottom;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.Location = new System.Drawing.Point(0, 563);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.Name = "_ClientInfoForm_Toolbars_Dock_Area_Bottom";
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.Size = new System.Drawing.Size(746, 0);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Bottom.ToolbarsManager = this.tbManager;
|
||||
//
|
||||
// _ClientInfoForm_Toolbars_Dock_Area_Left
|
||||
//
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Left;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.Location = new System.Drawing.Point(0, 43);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.Name = "_ClientInfoForm_Toolbars_Dock_Area_Left";
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.Size = new System.Drawing.Size(0, 520);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Left.ToolbarsManager = this.tbManager;
|
||||
//
|
||||
// _ClientInfoForm_Toolbars_Dock_Area_Right
|
||||
//
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.AccessibleRole = System.Windows.Forms.AccessibleRole.Grouping;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.BackColor = System.Drawing.SystemColors.Control;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.DockedPosition = Infragistics.Win.UltraWinToolbars.DockedPosition.Right;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.Location = new System.Drawing.Point(746, 43);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.Name = "_ClientInfoForm_Toolbars_Dock_Area_Right";
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.Size = new System.Drawing.Size(0, 520);
|
||||
this._ClientInfoForm_Toolbars_Dock_Area_Right.ToolbarsManager = this.tbManager;
|
||||
//
|
||||
// panelLeft
|
||||
//
|
||||
this.panelLeft.Controls.Add(this.gridSetup);
|
||||
this.panelLeft.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.panelLeft.Location = new System.Drawing.Point(0, 43);
|
||||
this.panelLeft.Name = "panelLeft";
|
||||
this.panelLeft.Size = new System.Drawing.Size(374, 520);
|
||||
this.panelLeft.TabIndex = 6;
|
||||
//
|
||||
// panelRight
|
||||
//
|
||||
this.panelRight.Controls.Add(this.gridLocale);
|
||||
this.panelRight.Dock = System.Windows.Forms.DockStyle.Right;
|
||||
this.panelRight.Location = new System.Drawing.Point(371, 43);
|
||||
this.panelRight.Name = "panelRight";
|
||||
this.panelRight.Size = new System.Drawing.Size(375, 520);
|
||||
this.panelRight.TabIndex = 7;
|
||||
//
|
||||
// gridLocale
|
||||
//
|
||||
this.gridLocale.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.gridLocale.DisplayLayout.AutoFitStyle = Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn;
|
||||
this.gridLocale.DisplayLayout.Override.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.No;
|
||||
this.gridLocale.DisplayLayout.Override.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
|
||||
appearance2.BackColor = System.Drawing.Color.Cornsilk;
|
||||
this.gridLocale.DisplayLayout.Override.RowAlternateAppearance = appearance2;
|
||||
this.gridLocale.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gridLocale.Location = new System.Drawing.Point(0, 0);
|
||||
this.gridLocale.Name = "gridLocale";
|
||||
this.gridLocale.Size = new System.Drawing.Size(375, 520);
|
||||
this.gridLocale.TabIndex = 0;
|
||||
//
|
||||
// CustomizableObjectInfoForm
|
||||
//
|
||||
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.ClientSize = new System.Drawing.Size(746, 563);
|
||||
this.Controls.Add(this.panelRight);
|
||||
this.Controls.Add(this.panelLeft);
|
||||
this.Controls.Add(this._ClientInfoForm_Toolbars_Dock_Area_Right);
|
||||
this.Controls.Add(this._ClientInfoForm_Toolbars_Dock_Area_Left);
|
||||
this.Controls.Add(this._ClientInfoForm_Toolbars_Dock_Area_Bottom);
|
||||
this.Controls.Add(this._ClientInfoForm_Toolbars_Dock_Area_Top);
|
||||
this.helpProvider1.SetHelpKeyword(this, "");
|
||||
this.helpProvider1.SetHelpNavigator(this, System.Windows.Forms.HelpNavigator.Topic);
|
||||
this.MinimumSize = new System.Drawing.Size(758, 600);
|
||||
this.Name = "CustomizableObjectInfoForm";
|
||||
this.helpProvider1.SetShowHelp(this, true);
|
||||
this.ShowInTaskbar = false;
|
||||
this.Text = "CustomizableObjectInfoForm";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.Closing += new System.ComponentModel.CancelEventHandler(this.CustomizableObjectInfoForm_Closing);
|
||||
this.Load += new System.EventHandler(this.CustomizableObjectInfoForm_Load);
|
||||
this.SizeChanged += new System.EventHandler(this.Form_SizeChanged);
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridSetup)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.tbManager)).EndInit();
|
||||
this.panelLeft.ResumeLayout(false);
|
||||
this.panelRight.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.gridLocale)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
|
||||
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
|
||||
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
|
||||
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
|
||||
//
|
||||
|
||||
#region Form loading / closing / 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)
|
||||
{
|
||||
this.panelLeft.Width=(this.DisplayRectangle.Width/2);
|
||||
this.panelRight.Width=(this.DisplayRectangle.Width/2);
|
||||
|
||||
}
|
||||
|
||||
|
||||
bool bClosingHandled=false;
|
||||
private void CustomizableObjectInfoForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
//case 1039 //log.Debug("CustomizableObjectInfoForm_Closing");
|
||||
|
||||
if(!bClosingHandled && lt!=null)
|
||||
{
|
||||
//Save record if necessary
|
||||
//User may opt to not cancel exit
|
||||
if(!RecordUpdate(RecordActionType.PromptToSave) )
|
||||
{
|
||||
e.Cancel=true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void CustomizableObjectInfoForm_Load(object sender, System.EventArgs e)
|
||||
{
|
||||
//
|
||||
// helpProvider1
|
||||
//
|
||||
this.helpProvider1.HelpNamespace = Util.BaseHelpUrl + "custom_field_designer.htm";
|
||||
|
||||
//case 1039 //log.Debug("CustomizableObjectInfoForm_Load");
|
||||
this.Icon = Resource1.CustomFields16icon;
|
||||
Util.GridHideEditableBizObjectInternalFields(gridSetup);
|
||||
gridSetup.DisplayLayout.Bands[0].Columns["ObjectName"].Hidden =true;
|
||||
gridSetup.DisplayLayout.Bands[0].Columns["FieldName"].CellActivation=Activation.Disabled;
|
||||
Util.GridPreLocalize("ObjectCustomField",gridSetup.DisplayLayout.Bands[0]);
|
||||
Util.LocalizeGrid(gridSetup);
|
||||
|
||||
Util.Localize(tbManager);
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["Locale"].CellActivation=Activation.Disabled;
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["DisplayText"].Hidden =true;
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["Key"].CellActivation=Activation.Disabled;
|
||||
|
||||
PopulateGridValueLists();
|
||||
|
||||
Util.GridPreLocalize("LocalizedText",gridLocale.DisplayLayout.Bands[0]);
|
||||
Util.GridHideEditableBizObjectInternalFields(gridLocale);
|
||||
Util.LocalizeGrid(gridLocale);
|
||||
gridLocale.Rows[0].Height=gridSetup.Rows[0].Height;
|
||||
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["Locale"].Header.VisiblePosition=3;
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["Key"].Header.VisiblePosition=2;
|
||||
gridLocale.DisplayLayout.Bands[0].Columns["DisplayText"].Header.VisiblePosition=0;
|
||||
Util.SetTextColumnsNullable(gridLocale);
|
||||
|
||||
//Security restrictions
|
||||
tbManager.Tools["LT:UI.Command.SaveClose"].SharedProps.Visible= AyaBizUtils.Right("Object.LocalizedText")> (int)SecurityLevelTypes.ReadOnly ;
|
||||
tbManager.Tools["LT:UI.Command.Save"].SharedProps.Visible= AyaBizUtils.Right("Object.LocalizedText")> (int)SecurityLevelTypes.ReadOnly ;
|
||||
tbManager.Tools["LT:UI.Command.Close"].SharedProps.Visible= !(AyaBizUtils.Right("Object.LocalizedText")> (int)SecurityLevelTypes.ReadOnly) ;
|
||||
|
||||
bool bReadOnly=AyaBizUtils.Right("Object.LocalizedText")< (int)SecurityLevelTypes.ReadWrite ;
|
||||
gridLocale.DisplayLayout.Override.AllowUpdate=bReadOnly?DefaultableBoolean.False:DefaultableBoolean.True;
|
||||
gridSetup.DisplayLayout.Override.AllowUpdate=bReadOnly?DefaultableBoolean.False:DefaultableBoolean.True;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Toolbar
|
||||
|
||||
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.Save": // ButtonTool
|
||||
RecordUpdate(RecordActionType.SaveOnly);
|
||||
break;
|
||||
|
||||
case "LT:UI.Command.Close": // ButtonTool
|
||||
this.Close();
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region record updating
|
||||
|
||||
/// <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()+")");
|
||||
|
||||
//enforce update of any currently edited field before attempting to save
|
||||
gridSetup.UpdateData();
|
||||
gridLocale.UpdateData();
|
||||
|
||||
switch(SaveType)
|
||||
{
|
||||
|
||||
case RecordActionType.SaveAndExit:
|
||||
//Save if necessary and exit
|
||||
if(ocf.IsSavable || lt.IsSavable)
|
||||
{
|
||||
lt.ApplyEdit();
|
||||
ocf.ApplyEdit();
|
||||
ocf.Save();
|
||||
lt.Save();
|
||||
bClosingHandled=true;
|
||||
this.Close();
|
||||
return true;
|
||||
}
|
||||
if(ocf.IsDirty || lt.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.SaveOnly:
|
||||
if(ocf.IsSavable || lt.IsSavable)
|
||||
{
|
||||
lt.ApplyEdit();
|
||||
ocf.ApplyEdit();
|
||||
ocf.Save();
|
||||
lt.Save();
|
||||
return true;
|
||||
|
||||
}
|
||||
return true;
|
||||
|
||||
case RecordActionType.PromptToSave:
|
||||
//Prompt to save and save if
|
||||
//required
|
||||
if(ocf.IsDirty || lt.IsDirty)
|
||||
{
|
||||
DialogResult dr=Util.PromptForSave();
|
||||
if(dr==DialogResult.Cancel)
|
||||
{
|
||||
//Cancel
|
||||
return false;
|
||||
}
|
||||
if(dr==DialogResult.Yes)
|
||||
{
|
||||
//Save before exit
|
||||
|
||||
if(ocf.IsSavable || lt.IsSavable)
|
||||
{
|
||||
lt.ApplyEdit();
|
||||
ocf.ApplyEdit();
|
||||
ocf.Save();
|
||||
lt.Save();
|
||||
return true;
|
||||
}
|
||||
if(ocf.IsDirty || lt.IsDirty)//dirty and unsaveable due to broken rules
|
||||
{
|
||||
if(Util.PromptForBrokenRulesCancelSave()==DialogResult.Yes)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region populate DataTypes value list
|
||||
|
||||
/// <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");
|
||||
|
||||
//Populate value lists
|
||||
ValueList vl=gridSetup.DisplayLayout.ValueLists.Add("EditorTypes");
|
||||
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.Currency,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.Currency"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.DateOnly,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.DateOnly"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.DateTime,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.DateTime"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.Number,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.Number"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.Text,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.Text"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.TimeOnly,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.TimeOnly"));
|
||||
vl.ValueListItems.Add(FormFieldDataTypes.TrueFalse,Util.LocaleText.GetLocalizedText("FormFieldDataTypes.Label.TrueFalse"));
|
||||
|
||||
|
||||
|
||||
//Bind value lists to correct columns in grid
|
||||
gridSetup.DisplayLayout.Bands[0].Columns["FieldType"].ValueList=
|
||||
gridSetup.DisplayLayout.ValueLists["EditorTypes"];
|
||||
|
||||
//Set column to dropdownlist style so that user can not type an invalid value in a cell
|
||||
//but must select from the list only
|
||||
gridSetup.DisplayLayout.Bands[0].Columns["FieldType"].Style=Infragistics.Win.UltraWinGrid.ColumnStyle.DropDownValidate;//Case 96 for autocomplete (was DropDownList)
|
||||
gridSetup.DisplayLayout.Bands[0].Columns["FieldType"].AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Props and global vars
|
||||
string mObjectName="";
|
||||
ObjectCustomFields ocf=null;
|
||||
LocalizedTexts lt=null;
|
||||
|
||||
|
||||
public ObjectCustomFields ObjectCustomFieldsToEdit
|
||||
{
|
||||
set
|
||||
{
|
||||
ocf=value;
|
||||
//bind to grid
|
||||
gridSetup.DataSource=ocf;
|
||||
}
|
||||
}
|
||||
|
||||
public string ObjectName
|
||||
{
|
||||
set
|
||||
{
|
||||
mObjectName=value;
|
||||
gridSetup.Text=mObjectName;
|
||||
|
||||
//Setup localized text grid
|
||||
lt=LocalizedTexts.GetCustomItemsForSingleObject(mObjectName);
|
||||
gridLocale.DataSource=lt;
|
||||
gridLocale.Text=mObjectName;
|
||||
}
|
||||
}
|
||||
#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
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user