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

261 lines
8.5 KiB
C#

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using GZTW.AyaNova.BLL;
using Infragistics.Win.UltraWinGrid;
using Infragistics.Win;
using System.Data;
using log4net;
namespace AyaNova
{
/// <summary>
/// Summary description for PurchaseOrderReceiptSelectVendorsPurchaseOrders.
/// </summary>
public class PurchaseOrderReceiptSelectVendorsPurchaseOrders : 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;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
private Infragistics.Win.Misc.UltraButton btnCancel;
private Infragistics.Win.Misc.UltraButton btnOK;
private Guid mSelectedVendorID;
public PurchaseOrderReceiptSelectVendorsPurchaseOrders(Guid SelectedVendor)
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
mSelectedVendorID=SelectedVendor;
}
/// <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.Grid = new Infragistics.Win.UltraWinGrid.UltraGrid();
this.btnCancel = new Infragistics.Win.Misc.UltraButton();
this.btnOK = new Infragistics.Win.Misc.UltraButton();
((System.ComponentModel.ISupportInitialize)(this.Grid)).BeginInit();
this.SuspendLayout();
//
// Grid
//
this.Grid.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.Grid.Cursor = System.Windows.Forms.Cursors.Default;
this.Grid.Location = new System.Drawing.Point(0, 0);
this.Grid.Name = "Grid";
this.Grid.Size = new System.Drawing.Size(456, 207);
this.Grid.TabIndex = 0;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(10, 235);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(124, 28);
this.btnCancel.TabIndex = 52;
this.btnCancel.Tag = "";
this.btnCancel.Text = "LT:UI.Command.Cancel";
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(322, 235);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(125, 28);
this.btnOK.TabIndex = 51;
this.btnOK.Tag = "";
this.btnOK.Text = "LT:UI.Command.OK";
//
// PurchaseOrderReceiptSelectVendorsPurchaseOrders
//
this.AcceptButton = this.btnOK;
this.AutoScaleBaseSize = new System.Drawing.Size(6, 15);
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(456, 273);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.Grid);
this.Name = "PurchaseOrderReceiptSelectVendorsPurchaseOrders";
this.ShowInTaskbar = false;
this.Text = "LT:UI.Label.SelectPurchaseOrdersToReceive";
this.Closing += new System.ComponentModel.CancelEventHandler(this.PurchaseOrderReceiptSelectVendorsPurchaseOrders_Closing);
this.Load += new System.EventHandler(this.PurchaseOrderReceiptSelectVendorsPurchaseOrders_Load);
((System.ComponentModel.ISupportInitialize)(this.Grid)).EndInit();
this.ResumeLayout(false);
}
#endregion
// __ _ _ ___ ____ __ __ __ __ __ ___ ___
// / _)( )( )/ __)(_ _)/ \( \/ ) / _)/ \( \( _)
// ( (_ )()( \__ \ )( ( () )) ( ( (_( () )) ) )) _)
// \__) \__/ (___/ (__) \__/(_/\/\_) \__)\__/(___/(___)
//Load list
//Add checkboxes
//etc
#region Form load / close
//variable to hold user form settings
//UIUserFormSetting mFormSetting;
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PurchaseOrderReceiptSelectVendorsPurchaseOrders_Load(object sender, System.EventArgs e)
{
//case 1039 //log.Debug("PurchaseOrderReceiptSelectVendorsPurchaseOrders_Load");
this.Icon = Resource1.PurchaseOrderReceipt16icon;
Grid.DisplayLayout.Override.HeaderClickAction=HeaderClickAction.SortSingle;
PurchaseOrderListReceivableForVendor pvlist = PurchaseOrderListReceivableForVendor.GetList(mSelectedVendorID);
Grid.DataSource=pvlist;
Util.FetchGridLayout("PurchaseOrderReceiptSelectVendorsPurchaseOrders","",Grid);
Grid.DisplayLayout.Bands[0].Columns["ID"].Hidden=true;
Util.Localize(this);
foreach(UltraGridColumn c in Grid.DisplayLayout.Bands[0].Columns)
{
c.CellActivation=Activation.ActivateOnly;
}
if(Grid.DisplayLayout.Bands[0].Columns.Exists("SELECTED"))
{
Grid.DisplayLayout.Bands[0].Columns["SELECTED"].Header.Caption=Util.LocaleText.GetLocalizedText("UI.Label.SelectItem");
}
else
{
Grid.DisplayLayout.Bands[0].Columns.Add("SELECTED",Util.LocaleText.GetLocalizedText("UI.Label.SelectItem"));
}
//Must be set even if loaded as there seems to be a bug that
//causes the data type to not be saved with the grid settings
//for unbound columns
Grid.DisplayLayout.Bands[0].Columns["SELECTED"].DataType=typeof(bool);
//ensure selected can be .... selected
Grid.DisplayLayout.Bands[0].Columns["SELECTED"].CellActivation=Activation.AllowEdit;
Util.LoadFormCustomization("PurchaseOrderReceiptSelectVendorsPurchaseOrders", this, null, false);
}
private System.Data.DataSet dsSelectedPurchaseOrders;
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void PurchaseOrderReceiptSelectVendorsPurchaseOrders_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
//case 1039 //log.Debug("PurchaseOrderReceiptSelectVendorsPurchaseOrders_Closing");
if(this.DialogResult==DialogResult.OK)
{
DataRow dr;
dsSelectedPurchaseOrders=new DataSet();
dsSelectedPurchaseOrders.Tables.Add();
dsSelectedPurchaseOrders.Tables[0].Columns.Add("PO",typeof(Guid));
foreach(UltraGridRow r in Grid.Rows)
{
if((bool)r.Cells["SELECTED"].Value==true)
{
dr=dsSelectedPurchaseOrders.Tables[0].NewRow();
dr["PO"]=(Guid)r.Cells["ID"].Value;
Guid g=(Guid)r.Cells["ID"].Value;
dsSelectedPurchaseOrders.Tables[0].Rows.Add(dr);
}
}
//If nothing selected, then act as if the user clicked
//on cancel
if(dsSelectedPurchaseOrders.Tables[0].Rows.Count<1)
this.DialogResult=DialogResult.Cancel;
}
Util.SaveGridLayout("PurchaseOrderReceiptSelectVendorsPurchaseOrders","","",Grid);
Util.SaveFormCustomization("PurchaseOrderReceiptSelectVendorsPurchaseOrders", this, null, false);
}
#endregion
#region Properties
public System.Data.DataSet SelectedPurchaseOrders
{
get
{
return dsSelectedPurchaseOrders;
}
}
#endregion
}
}