📄 orders.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Data.SqlServerCe;
using System.Reflection;
namespace Microsoft.Sql.SqlCe.Samples.Cs.IBuySpyDelivery.IBuySpyDevice
{
/// <summary>
/// Summary description for the Orders control. The Orders control displays order information. Users can change the order
/// information by adding additional products from inventory.
/// </summary>
public class Orders : System.Windows.Forms.Control
{
private System.Windows.Forms.ListBox lstProducts;
private System.Windows.Forms.Label lblCustomer;
private System.Windows.Forms.Button btnSignature;
private System.Windows.Forms.Label lblTotal;
private System.Windows.Forms.Label lblSubtotal;
private System.Windows.Forms.Label lblPriceValue;
private System.Windows.Forms.Label lblPrice;
private System.Windows.Forms.Label lblQuantityValue;
private System.Windows.Forms.Button btnAddMore;
private System.Windows.Forms.Label lblQuantity;
private System.Windows.Forms.Label lblProducts;
private System.Windows.Forms.Label lblOrderID;
private System.Windows.Forms.PictureBox pboIDegree;
private System.Windows.Forms.ComboBox cboOrderIDs;
private System.Windows.Forms.Label lblCustomerValue;
private System.Windows.Forms.Label lblSubTotalValue;
private System.Windows.Forms.Label lblTotalValue;
private System.Windows.Forms.Label lblOrderDateValue;
private FormIBuySpy formIBuySpy = null;
private IBuySpyData dataIBuySpy = null;
private DataView dvOrders = null;
private DataTable dtOrderDetails = null;
private int customerID = -1;
private string customerName = String.Empty;
private int orderID = -1;
private bool init = true;
internal event ViewInventoryEventHandler OnViewInventory;
internal event ViewSignatureEventHandler OnViewSignature;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Orders(FormIBuySpy formIBuySpy)
{
this.formIBuySpy = formIBuySpy;
this.dataIBuySpy = IBuySpyData.GetInstance();
/// This call is required by the Windows.Forms Form Designer.
///
InitializeComponent();
/// Load idegree image
///
this.pboIDegree.Image = new Bitmap(Assembly.GetExecutingAssembly().GetManifestResourceStream("IBuySpyDevice.idegree.gif"));
}
/// Properties
///
internal int CustomerID
{
get
{
return customerID;
}
set
{
customerID = value;
}
}
internal string CustomerName
{
get
{
return customerName;
}
set
{
customerName = value;
}
}
internal int OrderID
{
get
{
return orderID;
}
set
{
orderID = value;
}
}
/// <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 Component 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.lstProducts = new System.Windows.Forms.ListBox();
this.lblCustomer = new System.Windows.Forms.Label();
this.btnSignature = new System.Windows.Forms.Button();
this.lblTotal = new System.Windows.Forms.Label();
this.lblSubtotal = new System.Windows.Forms.Label();
this.lblPriceValue = new System.Windows.Forms.Label();
this.lblPrice = new System.Windows.Forms.Label();
this.lblQuantityValue = new System.Windows.Forms.Label();
this.btnAddMore = new System.Windows.Forms.Button();
this.lblQuantity = new System.Windows.Forms.Label();
this.cboOrderIDs = new System.Windows.Forms.ComboBox();
this.lblProducts = new System.Windows.Forms.Label();
this.lblOrderID = new System.Windows.Forms.Label();
this.pboIDegree = new System.Windows.Forms.PictureBox();
this.lblCustomerValue = new System.Windows.Forms.Label();
this.lblSubTotalValue = new System.Windows.Forms.Label();
this.lblTotalValue = new System.Windows.Forms.Label();
this.lblOrderDateValue = new System.Windows.Forms.Label();
///
/// lstProducts
///
this.lstProducts.Location = new System.Drawing.Point(68, 60);
this.lstProducts.Size = new System.Drawing.Size(160, 48);
this.lstProducts.SelectedIndexChanged += new System.EventHandler(this.lstProducts_SelectedIndexChanged);
///
/// lblCustomer
///
this.lblCustomer.Location = new System.Drawing.Point(4, 8);
this.lblCustomer.Size = new System.Drawing.Size(68, 16);
this.lblCustomer.Text = "Customer:";
///
/// btnSignature
///
this.btnSignature.Location = new System.Drawing.Point(132, 198);
this.btnSignature.Size = new System.Drawing.Size(100, 24);
this.btnSignature.Text = "Signature >>";
this.btnSignature.Click += new System.EventHandler(this.btnSignature_Click);
///
/// lblTotal
///
this.lblTotal.Location = new System.Drawing.Point(124, 136);
this.lblTotal.Size = new System.Drawing.Size(40, 16);
this.lblTotal.Text = "Total:";
///
/// lblSubtotal
///
this.lblSubtotal.Location = new System.Drawing.Point(4, 136);
this.lblSubtotal.Size = new System.Drawing.Size(60, 16);
this.lblSubtotal.Text = "Subtotal:";
///
/// lblPriceValue
///
this.lblPriceValue.Location = new System.Drawing.Point(160, 112);
this.lblPriceValue.Size = new System.Drawing.Size(72, 13);
this.lblPriceValue.Text = "";
///
/// lblPrice
///
this.lblPrice.Location = new System.Drawing.Point(124, 112);
this.lblPrice.Size = new System.Drawing.Size(40, 16);
this.lblPrice.Text = "Price:";
///
/// lblQuantityValue
///
this.lblQuantityValue.Location = new System.Drawing.Point(56, 112);
this.lblQuantityValue.Size = new System.Drawing.Size(56, 13);
this.lblQuantityValue.Text = "";
///
/// btnAddMore
///
this.btnAddMore.Location = new System.Drawing.Point(132, 168);
this.btnAddMore.Size = new System.Drawing.Size(100, 24);
this.btnAddMore.Text = "Add More";
this.btnAddMore.Click += new System.EventHandler(this.btnAddMore_Click);
///
/// lblQuantity
///
this.lblQuantity.Location = new System.Drawing.Point(4, 112);
this.lblQuantity.Size = new System.Drawing.Size(60, 16);
this.lblQuantity.Text = "Quantity:";
///
/// cboOrderIDs
///
this.cboOrderIDs.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboOrderIDs.Location = new System.Drawing.Point(68, 29);
this.cboOrderIDs.Size = new System.Drawing.Size(48, 21);
this.cboOrderIDs.SelectedIndexChanged += new System.EventHandler(this.cboOrderIDs_SelectedIndexChanged);
///
/// lblProducts
///
this.lblProducts.Location = new System.Drawing.Point(4, 60);
this.lblProducts.Size = new System.Drawing.Size(60, 16);
this.lblProducts.Text = "Products:";
///
/// lblOrderID
///
this.lblOrderID.Location = new System.Drawing.Point(4, 32);
this.lblOrderID.Size = new System.Drawing.Size(60, 16);
this.lblOrderID.Text = "Order ID:";
///
/// pboIDegree
///
this.pboIDegree.Location = new System.Drawing.Point(8, 168);
this.pboIDegree.Size = new System.Drawing.Size(120, 55);
///
/// lblCustomerValue
///
this.lblCustomerValue.Location = new System.Drawing.Point(68, 8);
this.lblCustomerValue.Size = new System.Drawing.Size(160, 13);
this.lblCustomerValue.Text = "";
///
/// lblSubTotalValue
///
this.lblSubTotalValue.Location = new System.Drawing.Point(56, 136);
this.lblSubTotalValue.Size = new System.Drawing.Size(66, 13);
this.lblSubTotalValue.Text = "";
///
/// lblTotalValue
///
this.lblTotalValue.Location = new System.Drawing.Point(160, 136);
this.lblTotalValue.Size = new System.Drawing.Size(72, 13);
this.lblTotalValue.Text = "";
///
/// lblOrderDateValue
///
this.lblOrderDateValue.Location = new System.Drawing.Point(120, 33);
this.lblOrderDateValue.Size = new System.Drawing.Size(104, 13);
this.lblOrderDateValue.Text = "";
///
/// Orders
///
this.Controls.Add(this.lblOrderDateValue);
this.Controls.Add(this.lblTotalValue);
this.Controls.Add(this.lblSubTotalValue);
this.Controls.Add(this.lblCustomerValue);
this.Controls.Add(this.lstProducts);
this.Controls.Add(this.lblCustomer);
this.Controls.Add(this.btnSignature);
this.Controls.Add(this.lblTotal);
this.Controls.Add(this.lblSubtotal);
this.Controls.Add(this.lblPriceValue);
this.Controls.Add(this.lblPrice);
this.Controls.Add(this.lblQuantityValue);
this.Controls.Add(this.btnAddMore);
this.Controls.Add(this.lblQuantity);
this.Controls.Add(this.cboOrderIDs);
this.Controls.Add(this.lblProducts);
this.Controls.Add(this.lblOrderID);
this.Controls.Add(this.pboIDegree);
this.Size = new System.Drawing.Size(240, 240);
}
#endregion
/// This function initializes the Orders and OrderDetails datatables, binding them to UI controls.
///
internal void InitOrders()
{
/// Set the flag to indicate this is initialization.
///
init = true;
/// Get Orders datatable.
///
DataTable dtOrders = this.dataIBuySpy.CustomerOrderDataSet.Tables["Orders"];
if (null == dtOrders)
{
MessageBox.Show("No order data", "IBuySpy Delivery");
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -