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

272 lines
10 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using GZTW.AyaNova.BLL;
using System.Windows.Forms.Design;
using log4net;
namespace AyaNova
{
/// <summary>
/// Summary description for WorkorderSummaryTemplate.
/// </summary>
public class WorkorderSummaryTemplate : 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);
public IWindowsFormsEditorService _wfes;
private Infragistics.Win.Misc.UltraLabel lblWorkorderSummaryTemplate;
private Infragistics.Win.Misc.UltraLabel lblWorkorderItem;
private Infragistics.Win.UltraWinEditors.UltraTextEditor edTemplate;
private Infragistics.Win.UltraWinEditors.UltraComboEditor cbItem;
private Infragistics.Win.Misc.UltraButton btnOK;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public WorkorderSummaryTemplate()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
TopLevel = false;
//
//
//
}
/// <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()
{
Infragistics.Win.UltraWinEditors.EditorButton editorButton1 = new Infragistics.Win.UltraWinEditors.EditorButton();
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
this.lblWorkorderSummaryTemplate = new Infragistics.Win.Misc.UltraLabel();
this.lblWorkorderItem = new Infragistics.Win.Misc.UltraLabel();
this.edTemplate = new Infragistics.Win.UltraWinEditors.UltraTextEditor();
this.cbItem = new Infragistics.Win.UltraWinEditors.UltraComboEditor();
this.btnOK = new Infragistics.Win.Misc.UltraButton();
((System.ComponentModel.ISupportInitialize)(this.edTemplate)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.cbItem)).BeginInit();
this.SuspendLayout();
//
// lblWorkorderSummaryTemplate
//
this.lblWorkorderSummaryTemplate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWorkorderSummaryTemplate.Location = new System.Drawing.Point(0, 55);
this.lblWorkorderSummaryTemplate.Name = "lblWorkorderSummaryTemplate";
this.lblWorkorderSummaryTemplate.Size = new System.Drawing.Size(392, 19);
this.lblWorkorderSummaryTemplate.TabIndex = 127;
this.lblWorkorderSummaryTemplate.Tag = "";
this.lblWorkorderSummaryTemplate.Text = "LT:WorkorderSummary.Label.Template";
//
// lblWorkorderItem
//
this.lblWorkorderItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lblWorkorderItem.Location = new System.Drawing.Point(0, 0);
this.lblWorkorderItem.Name = "lblWorkorderItem";
this.lblWorkorderItem.Size = new System.Drawing.Size(392, 18);
this.lblWorkorderItem.TabIndex = 126;
this.lblWorkorderItem.Tag = "";
this.lblWorkorderItem.Text = "LT:WorkorderSummary.Label.WorkorderItem";
//
// edTemplate
//
this.edTemplate.AcceptsReturn = true;
this.edTemplate.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.edTemplate.Location = new System.Drawing.Point(0, 83);
this.edTemplate.Multiline = true;
this.edTemplate.Name = "edTemplate";
this.edTemplate.Size = new System.Drawing.Size(392, 217);
this.edTemplate.TabIndex = 124;
//
// cbItem
//
this.cbItem.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.cbItem.AutoCompleteMode = Infragistics.Win.AutoCompleteMode.SuggestAppend;
appearance1.Image = global::AyaNova.Resource1.New16;
editorButton1.Appearance = appearance1;
this.cbItem.ButtonsLeft.Add(editorButton1);
this.cbItem.Location = new System.Drawing.Point(0, 18);
this.cbItem.Name = "cbItem";
this.cbItem.Size = new System.Drawing.Size(392, 24);
this.cbItem.SortStyle = Infragistics.Win.ValueListSortStyle.AscendingByValue;
this.cbItem.TabIndex = 125;
this.cbItem.EditorButtonClick += new Infragistics.Win.UltraWinEditors.EditorButtonEventHandler(this.cbItem_EditorButtonClick);
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.Location = new System.Drawing.Point(459, 18);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(125, 28);
this.btnOK.TabIndex = 128;
this.btnOK.Tag = "";
this.btnOK.Text = "LT:UI.Command.Save";
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// WorkorderSummaryTemplate
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.ClientSize = new System.Drawing.Size(584, 333);
this.ControlBox = false;
this.Controls.Add(this.btnOK);
this.Controls.Add(this.lblWorkorderSummaryTemplate);
this.Controls.Add(this.lblWorkorderItem);
this.Controls.Add(this.edTemplate);
this.Controls.Add(this.cbItem);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "WorkorderSummaryTemplate";
this.ShowInTaskbar = false;
this.Closed += new System.EventHandler(this.WorkorderSummaryTemplate_Closed);
this.Load += new System.EventHandler(this.WorkorderSummaryTemplate_Load);
((System.ComponentModel.ISupportInitialize)(this.edTemplate)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.cbItem)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
// *****************************************************************
#region ComboItems
private void cbItem_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
{
//case 1039 //log.Debug("cbItem_EditorButtonClick");
if(cbItem.SelectedItem!=null)
edTemplate.AppendText(" "+cbItem.SelectedItem.DataValue.ToString()+" ");
}
#endregion
#region Load / close / setup related
private string mWorkorderSummaryTemplateToEdit;
private void WorkorderSummaryTemplate_Load(object sender, System.EventArgs e)
{
//case 1039 //log.Debug("WorkorderSummaryTemplate_Load");
Util.Localize(this);
edTemplate.Text=mWorkorderSummaryTemplateToEdit;
Add("O.Client");
Add("Workorder.Label.CustomerContactName");
Add("Workorder.Label.CustomerReferenceNumber");
Add("Workorder.Label.InternalReferenceNumber");
if (!AyaBizUtils.Lite) Add("O.Project");
Add("Workorder.Label.Summary");
Add("O.WorkorderCategory");
Add("WorkorderService.Label.InvoiceNumber");
Add("WorkorderService.Label.ServiceNumber");
Add("WorkorderItem.Label.RequestDate");
Add("WorkorderItem.Label.Summary");
Add("WorkorderItem.Label.TechNotes");
Add("O.WorkorderItemScheduledUser");
Add("WorkorderItemScheduledUser.Label.StartDate");
Add("WorkorderItemScheduledUser.Label.StopDate");
if (!AyaBizUtils.Lite) Add("O.Unit");
if (!AyaBizUtils.Lite) Add("O.UnitModel");
if (!AyaBizUtils.Lite) Add("O.UnitModelCategory");
if (!AyaBizUtils.Lite) Add("O.Vendor");
Add("O.WorkorderStatus");
if(!AyaBizUtils.Lite) Add("O.DispatchZone");
//case 987
Add("Workorder.Label.Onsite");
}
private void Add(string sLocaleKey)
{
//case 1039 //if(log.IsDebugEnabled) //case 1039 //log.Debug("Add("+sLocaleKey+")");
this.cbItem.Items.Add("["+sLocaleKey+"]","["+sLocaleKey+"]" + " - " + Util.LocaleText.GetLocalizedText(sLocaleKey));
}
public string WorkorderSummaryTemplateToEdit
{
set
{
mWorkorderSummaryTemplateToEdit=value;
}
get
{
return mWorkorderSummaryTemplateToEdit;
}
}
#endregion
private void btnOK_Click(object sender, System.EventArgs e)
{
//case 1039 //log.Debug("btnOK_Click");
mWorkorderSummaryTemplateToEdit=edTemplate.Text;
this.Close();
}
private void WorkorderSummaryTemplate_Closed(object sender, System.EventArgs e)
{
//case 1039 //log.Debug("WorkorderSummaryTemplate_Closed");
_wfes.CloseDropDown();
}
//*******************************************************************
}
}