Breaking Change: Changed Kot/Voucher Table Name to Guid Foreign key

Breaking Change: Renamed Discontinued to IsActive and added NA field to products.
Cleanup: Removed not used attributes
Change: RoleConstants changed to simple string
Feature: Table Create/Edit/Reorder and Modifier Create/Edit Form
Feature: Bills now show the Tax name from the database and not a hack
This commit is contained in:
tanshu
2014-10-16 16:41:55 +05:30
parent 69617949bd
commit da929ad036
76 changed files with 3472 additions and 1175 deletions

View File

@ -0,0 +1,385 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class FoodTableForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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();
this.Label4 = new System.Windows.Forms.Label();
this.bsProductGroups = new System.Windows.Forms.BindingSource(this.components);
this.Label7 = new System.Windows.Forms.Label();
this.bsServiceTax = new System.Windows.Forms.BindingSource(this.components);
this.label5 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.txtProductID = new System.Windows.Forms.TextBox();
this.txtCode = new System.Windows.Forms.TextBox();
this.Label2 = new System.Windows.Forms.Label();
this.txtUnits = new System.Windows.Forms.TextBox();
this.txtName = new System.Windows.Forms.TextBox();
this.txtPrice = new System.Windows.Forms.TextBox();
this.cmbVat = new System.Windows.Forms.ComboBox();
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
this.txtServiceCharge = new System.Windows.Forms.TextBox();
this.btnAddProductGroup = new System.Windows.Forms.Button();
this.cmbProductGroup = new System.Windows.Forms.ComboBox();
this.btnCancel = new System.Windows.Forms.Button();
this.btnOk = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.txtSortOrder = new System.Windows.Forms.TextBox();
this.txtFullPrice = new System.Windows.Forms.TextBox();
this.cmbServiceTax = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
this.bsVat = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
this.SuspendLayout();
//
// Label4
//
this.Label4.AutoSize = true;
this.Label4.Location = new System.Drawing.Point(25, 82);
this.Label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label4.Name = "Label4";
this.Label4.Size = new System.Drawing.Size(110, 17);
this.Label4.TabIndex = 15;
this.Label4.Text = "Price / Full Price";
//
// bsProductGroups
//
this.bsProductGroups.DataSource = typeof(Tanshu.Accounts.Entities.ProductGroup);
//
// Label7
//
this.Label7.AutoSize = true;
this.Label7.Location = new System.Drawing.Point(93, 174);
this.Label7.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label7.Name = "Label7";
this.Label7.Size = new System.Drawing.Size(48, 17);
this.Label7.TabIndex = 17;
this.Label7.Text = "Group";
//
// bsServiceTax
//
this.bsServiceTax.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(35, 142);
this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(105, 17);
this.label5.TabIndex = 16;
this.label5.Text = "Service Charge";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(16, 18);
this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(119, 17);
this.label3.TabIndex = 13;
this.label3.Text = "Product ID / Code";
//
// txtProductID
//
this.txtProductID.Location = new System.Drawing.Point(149, 15);
this.txtProductID.Margin = new System.Windows.Forms.Padding(4);
this.txtProductID.Name = "txtProductID";
this.txtProductID.ReadOnly = true;
this.txtProductID.Size = new System.Drawing.Size(251, 22);
this.txtProductID.TabIndex = 12;
//
// txtCode
//
this.txtCode.AccessibleName = "";
this.txtCode.Location = new System.Drawing.Point(409, 15);
this.txtCode.Margin = new System.Windows.Forms.Padding(4);
this.txtCode.Name = "txtCode";
this.txtCode.Size = new System.Drawing.Size(127, 22);
this.txtCode.TabIndex = 0;
this.txtCode.WordWrap = false;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(48, 50);
this.Label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(89, 17);
this.Label2.TabIndex = 14;
this.Label2.Text = "Name / Units";
//
// txtUnits
//
this.txtUnits.AccessibleName = "";
this.txtUnits.Location = new System.Drawing.Point(409, 47);
this.txtUnits.Margin = new System.Windows.Forms.Padding(4);
this.txtUnits.Name = "txtUnits";
this.txtUnits.Size = new System.Drawing.Size(127, 22);
this.txtUnits.TabIndex = 2;
//
// txtName
//
this.txtName.AccessibleName = "";
this.txtName.Location = new System.Drawing.Point(149, 47);
this.txtName.Margin = new System.Windows.Forms.Padding(4);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(251, 22);
this.txtName.TabIndex = 1;
//
// txtPrice
//
this.txtPrice.AccessibleName = "";
this.txtPrice.Location = new System.Drawing.Point(149, 79);
this.txtPrice.Margin = new System.Windows.Forms.Padding(4);
this.txtPrice.Name = "txtPrice";
this.txtPrice.Size = new System.Drawing.Size(111, 22);
this.txtPrice.TabIndex = 3;
this.txtPrice.Text = "0";
//
// cmbVat
//
this.cmbVat.DataSource = this.bsVat;
this.cmbVat.DisplayMember = "Name";
this.cmbVat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbVat.Location = new System.Drawing.Point(284, 107);
this.cmbVat.Margin = new System.Windows.Forms.Padding(4);
this.cmbVat.Name = "cmbVat";
this.cmbVat.Size = new System.Drawing.Size(116, 24);
this.cmbVat.TabIndex = 4;
this.cmbVat.ValueMember = "TaxID";
//
// chkDiscontinued
//
this.chkDiscontinued.AutoSize = true;
this.chkDiscontinued.Location = new System.Drawing.Point(409, 141);
this.chkDiscontinued.Margin = new System.Windows.Forms.Padding(4);
this.chkDiscontinued.Name = "chkDiscontinued";
this.chkDiscontinued.Size = new System.Drawing.Size(112, 21);
this.chkDiscontinued.TabIndex = 7;
this.chkDiscontinued.Text = "Discontinued";
this.chkDiscontinued.UseVisualStyleBackColor = true;
//
// txtServiceCharge
//
this.txtServiceCharge.AccessibleName = "Phone 1";
this.txtServiceCharge.Location = new System.Drawing.Point(149, 139);
this.txtServiceCharge.Margin = new System.Windows.Forms.Padding(4);
this.txtServiceCharge.Name = "txtServiceCharge";
this.txtServiceCharge.Size = new System.Drawing.Size(96, 22);
this.txtServiceCharge.TabIndex = 5;
this.txtServiceCharge.Text = "0";
//
// btnAddProductGroup
//
this.btnAddProductGroup.Location = new System.Drawing.Point(409, 171);
this.btnAddProductGroup.Margin = new System.Windows.Forms.Padding(4);
this.btnAddProductGroup.Name = "btnAddProductGroup";
this.btnAddProductGroup.Size = new System.Drawing.Size(128, 26);
this.btnAddProductGroup.TabIndex = 9;
this.btnAddProductGroup.Text = "Add Group";
//
// cmbProductGroup
//
this.cmbProductGroup.DataBindings.Add(new System.Windows.Forms.Binding("SelectedValue", this.bsProductGroups, "ProductGroupID", true));
this.cmbProductGroup.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.bsProductGroups, "Name", true));
this.cmbProductGroup.DataSource = this.bsProductGroups;
this.cmbProductGroup.DisplayMember = "Name";
this.cmbProductGroup.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbProductGroup.Location = new System.Drawing.Point(149, 171);
this.cmbProductGroup.Margin = new System.Windows.Forms.Padding(4);
this.cmbProductGroup.Name = "cmbProductGroup";
this.cmbProductGroup.Size = new System.Drawing.Size(251, 24);
this.cmbProductGroup.TabIndex = 8;
this.cmbProductGroup.ValueMember = "ProductGroupID";
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(437, 204);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(100, 92);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(329, 204);
this.btnOk.Margin = new System.Windows.Forms.Padding(4);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(100, 92);
this.btnOk.TabIndex = 10;
this.btnOk.Text = "&Ok";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(261, 142);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(34, 17);
this.label1.TabIndex = 18;
this.label1.Text = "Sort";
//
// txtSortOrder
//
this.txtSortOrder.AccessibleName = "";
this.txtSortOrder.Location = new System.Drawing.Point(304, 139);
this.txtSortOrder.Margin = new System.Windows.Forms.Padding(4);
this.txtSortOrder.Name = "txtSortOrder";
this.txtSortOrder.Size = new System.Drawing.Size(96, 22);
this.txtSortOrder.TabIndex = 6;
this.txtSortOrder.Text = "0";
//
// txtFullPrice
//
this.txtFullPrice.AccessibleName = "";
this.txtFullPrice.Location = new System.Drawing.Point(268, 79);
this.txtFullPrice.Margin = new System.Windows.Forms.Padding(4);
this.txtFullPrice.Name = "txtFullPrice";
this.txtFullPrice.Size = new System.Drawing.Size(104, 22);
this.txtFullPrice.TabIndex = 19;
this.txtFullPrice.Text = "0";
//
// cmbServiceTax
//
this.cmbServiceTax.DataSource = this.bsServiceTax;
this.cmbServiceTax.DisplayMember = "Name";
this.cmbServiceTax.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbServiceTax.Location = new System.Drawing.Point(149, 107);
this.cmbServiceTax.Margin = new System.Windows.Forms.Padding(4);
this.cmbServiceTax.Name = "cmbServiceTax";
this.cmbServiceTax.Size = new System.Drawing.Size(127, 24);
this.cmbServiceTax.TabIndex = 20;
this.cmbServiceTax.ValueMember = "TaxID";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(25, 110);
this.label6.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(115, 17);
this.label6.TabIndex = 21;
this.label6.Text = "Service Tax / Vat";
//
// chkIsScTaxable
//
this.chkIsScTaxable.AutoSize = true;
this.chkIsScTaxable.Location = new System.Drawing.Point(409, 109);
this.chkIsScTaxable.Margin = new System.Windows.Forms.Padding(4);
this.chkIsScTaxable.Name = "chkIsScTaxable";
this.chkIsScTaxable.Size = new System.Drawing.Size(114, 21);
this.chkIsScTaxable.TabIndex = 22;
this.chkIsScTaxable.Text = "Is Sc Taxable";
this.chkIsScTaxable.UseVisualStyleBackColor = true;
//
// bsVat
//
this.bsVat.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
//
// ProductForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(553, 340);
this.Controls.Add(this.chkIsScTaxable);
this.Controls.Add(this.label6);
this.Controls.Add(this.cmbServiceTax);
this.Controls.Add(this.txtFullPrice);
this.Controls.Add(this.txtSortOrder);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnAddProductGroup);
this.Controls.Add(this.cmbProductGroup);
this.Controls.Add(this.chkDiscontinued);
this.Controls.Add(this.txtServiceCharge);
this.Controls.Add(this.Label7);
this.Controls.Add(this.txtPrice);
this.Controls.Add(this.label5);
this.Controls.Add(this.cmbVat);
this.Controls.Add(this.txtUnits);
this.Controls.Add(this.txtName);
this.Controls.Add(this.Label2);
this.Controls.Add(this.txtCode);
this.Controls.Add(this.txtProductID);
this.Controls.Add(this.label3);
this.Controls.Add(this.Label4);
this.Margin = new System.Windows.Forms.Padding(4);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProductForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Products";
this.Load += new System.EventHandler(this.Products_Load);
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsVat)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal System.Windows.Forms.Label Label4;
internal System.Windows.Forms.Label Label7;
private System.Windows.Forms.BindingSource bsProductGroups;
private System.Windows.Forms.BindingSource bsServiceTax;
internal System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtProductID;
internal System.Windows.Forms.TextBox txtCode;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox txtUnits;
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.TextBox txtPrice;
internal System.Windows.Forms.ComboBox cmbVat;
private System.Windows.Forms.CheckBox chkDiscontinued;
internal System.Windows.Forms.TextBox txtServiceCharge;
internal System.Windows.Forms.Button btnAddProductGroup;
internal System.Windows.Forms.ComboBox cmbProductGroup;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnOk;
internal System.Windows.Forms.Label label1;
internal System.Windows.Forms.TextBox txtSortOrder;
internal System.Windows.Forms.TextBox txtFullPrice;
internal System.Windows.Forms.ComboBox cmbServiceTax;
internal System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox chkIsScTaxable;
private System.Windows.Forms.BindingSource bsVat;
}
}

View File

@ -0,0 +1,154 @@
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Entities;
namespace Tanshu.Accounts.PointOfSale
{
public partial class FoodTableForm : Form
{
private Guid? _productID;
public FoodTableForm(Guid? productID)
{
_productID = productID;
InitializeComponent();
}
private void Products_Load(object sender, EventArgs e)
{
FillCombos();
if (_productID.HasValue)
{
Product product;
using (var bi = new ProductBI())
product = bi.Get(x => x.ProductID == _productID.Value);
txtProductID.Text = _productID.Value.ToString();
txtCode.Text = product.Code.ToString();
txtName.Text = product.Name;
txtUnits.Text = product.Units;
txtPrice.Text = product.Price.ToString("#.##");
txtFullPrice.Text = product.FullPrice.ToString("#.##");
cmbVat.SelectedValue = product.Vat.TaxID;
cmbServiceTax.SelectedValue = product.ServiceTax.TaxID;
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
chkDiscontinued.Checked = product.Discontinued;
chkIsScTaxable.Checked = product.IsScTaxable;
cmbProductGroup.SelectedValue = product.ProductGroup.ProductGroupID;
txtSortOrder.Text = product.SortOrder.ToString();
}
else
{
txtProductID.Text = "(Auto)";
txtName.Focus();
}
}
private void FillCombos()
{
using (var bi = new ProductGroupBI())
bsProductGroups.DataSource = bi.List();
using (var bi = new TaxBI())
{
bsServiceTax.DataSource = bi.List();
bsVat.DataSource = bi.List();
}
}
private void btnAddCategory_Click(object sender, EventArgs e)
{
using (var frm = new ProductGroupListForm())
frm.ShowDialog();
FillCombos();
cmbProductGroup.SelectedIndex = -1;
}
private Product IsFormValid()
{
var product = new Product();
if (_productID.HasValue)
product.ProductID = _productID.Value;
int code;
if (!int.TryParse(txtCode.Text, out code))
return null;
if (code < 0)
return null;
product.Code = code;
if (string.IsNullOrEmpty(txtName.Text.Trim()))
return null;
product.Name = txtName.Text.Trim();
//if (string.IsNullOrEmpty(txtUnits.Text.Trim()))
// return null;
product.Units = txtUnits.Text.Trim();
decimal price;
if (!decimal.TryParse(txtPrice.Text, out price))
return null;
if (price < 0)
return null;
product.Price = price;
if (!decimal.TryParse(txtFullPrice.Text, out price))
return null;
if (price < 0 || price < product.Price)
return null;
product.FullPrice = price;
// Tax
if (cmbVat.SelectedItem == null)
return null;
product.Vat = (Tax)cmbVat.SelectedItem;
if (cmbServiceTax.SelectedItem == null)
return null;
product.ServiceTax = (Tax)cmbServiceTax.SelectedItem;
decimal serviceCharge;
if (!decimal.TryParse(txtServiceCharge.Text, out serviceCharge))
return null;
if (serviceCharge < 0 || serviceCharge > 1)
return null;
product.ServiceCharge = serviceCharge;
product.IsScTaxable = chkIsScTaxable.Checked;
product.Discontinued = chkDiscontinued.Checked;
int sortOrder;
if (!int.TryParse(txtSortOrder.Text, out sortOrder))
return null;
product.SortOrder = sortOrder;
//Group
if (cmbProductGroup.SelectedItem == null)
return null;
product.ProductGroup = (ProductGroup)cmbProductGroup.SelectedItem;
return product;
}
private void btnOk_Click(object sender, EventArgs e)
{
var product = IsFormValid();
if (product != null)
{
using (var bi = new ProductBI())
{
if (_productID.HasValue)
bi.Update(product);
else
bi.Insert(product);
bi.SaveChanges();
}
MessageBox.Show("Update / Save Successful");
this.Close();
}
else
MessageBox.Show("The form is not valid");
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="bsProductGroups.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>211, 17</value>
</metadata>
<metadata name="bsServiceTax.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>56, 25</value>
</metadata>
<metadata name="bsVat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>382, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>102</value>
</metadata>
</root>

View File

@ -0,0 +1,268 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class FoodTableListForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
this.btnAdd = new System.Windows.Forms.Button();
this.btnEdit = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.dgvProducts = new System.Windows.Forms.DataGridView();
this.bsList = new System.Windows.Forms.BindingSource(this.components);
this.btnSave = new System.Windows.Forms.Button();
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.unitsDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.moveUp = new System.Windows.Forms.DataGridViewButtonColumn();
this.moveDown = new System.Windows.Forms.DataGridViewButtonColumn();
this.Vat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ServiceTax = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.Group = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.serviceChargeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.salePriceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.discontinuedDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
this.SuspendLayout();
//
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAdd.Location = new System.Drawing.Point(12, 255);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 75);
this.btnAdd.TabIndex = 68;
this.btnAdd.Text = "&Add";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnEdit
//
this.btnEdit.AccessibleName = "Done";
this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnEdit.Location = new System.Drawing.Point(93, 255);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(75, 75);
this.btnEdit.TabIndex = 62;
this.btnEdit.Text = "&Edit";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
//
// btnExit
//
this.btnExit.AccessibleName = "Done";
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(575, 255);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 75);
this.btnExit.TabIndex = 61;
this.btnExit.Text = "E&xit";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// dgvProducts
//
this.dgvProducts.AllowUserToAddRows = false;
this.dgvProducts.AllowUserToDeleteRows = false;
this.dgvProducts.AllowUserToResizeRows = false;
this.dgvProducts.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.dgvProducts.AutoGenerateColumns = false;
this.dgvProducts.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dgvProducts.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProducts.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.nameDataGridViewTextBoxColumn,
this.unitsDataGridViewTextBoxColumn,
this.moveUp,
this.moveDown,
this.Vat,
this.ServiceTax,
this.Group,
this.serviceChargeDataGridViewTextBoxColumn,
this.salePriceDataGridViewTextBoxColumn,
this.discontinuedDataGridViewCheckBoxColumn});
this.dgvProducts.DataSource = this.bsList;
this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvProducts.Location = new System.Drawing.Point(12, 12);
this.dgvProducts.MultiSelect = false;
this.dgvProducts.Name = "dgvProducts";
this.dgvProducts.ReadOnly = true;
this.dgvProducts.RowHeadersVisible = false;
this.dgvProducts.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dgvProducts.RowTemplate.Height = 24;
this.dgvProducts.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvProducts.Size = new System.Drawing.Size(638, 237);
this.dgvProducts.TabIndex = 74;
this.dgvProducts.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.dgvProductTypes_CellFormatting);
//
// bsList
//
this.bsList.DataSource = typeof(Tanshu.Accounts.Entities.Product);
//
// btnSave
//
this.btnSave.AccessibleName = "Done";
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSave.Location = new System.Drawing.Point(174, 255);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 75);
this.btnSave.TabIndex = 75;
this.btnSave.Text = "&Save";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
this.nameDataGridViewTextBoxColumn.Width = 60;
//
// unitsDataGridViewTextBoxColumn
//
this.unitsDataGridViewTextBoxColumn.DataPropertyName = "Units";
this.unitsDataGridViewTextBoxColumn.HeaderText = "Units";
this.unitsDataGridViewTextBoxColumn.Name = "unitsDataGridViewTextBoxColumn";
this.unitsDataGridViewTextBoxColumn.ReadOnly = true;
this.unitsDataGridViewTextBoxColumn.Width = 56;
//
// moveUp
//
this.moveUp.HeaderText = "Up";
this.moveUp.Name = "moveUp";
this.moveUp.ReadOnly = true;
this.moveUp.Text = "Up";
this.moveUp.UseColumnTextForButtonValue = true;
this.moveUp.Width = 27;
//
// moveDown
//
this.moveDown.HeaderText = "Down";
this.moveDown.Name = "moveDown";
this.moveDown.ReadOnly = true;
this.moveDown.Text = "Down";
this.moveDown.UseColumnTextForButtonValue = true;
this.moveDown.Width = 41;
//
// Vat
//
this.Vat.DataPropertyName = "Vat";
this.Vat.HeaderText = "Vat";
this.Vat.Name = "Vat";
this.Vat.ReadOnly = true;
this.Vat.Width = 48;
//
// ServiceTax
//
this.ServiceTax.DataPropertyName = "ServiceTax";
this.ServiceTax.HeaderText = "ServiceTax";
this.ServiceTax.Name = "ServiceTax";
this.ServiceTax.ReadOnly = true;
this.ServiceTax.Width = 86;
//
// Group
//
this.Group.DataPropertyName = "ProductGroup";
this.Group.HeaderText = "ProductGroup";
this.Group.Name = "Group";
this.Group.ReadOnly = true;
this.Group.Width = 98;
//
// serviceChargeDataGridViewTextBoxColumn
//
this.serviceChargeDataGridViewTextBoxColumn.DataPropertyName = "ServiceCharge";
dataGridViewCellStyle1.Format = "P0";
this.serviceChargeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
this.serviceChargeDataGridViewTextBoxColumn.HeaderText = "SC";
this.serviceChargeDataGridViewTextBoxColumn.Name = "serviceChargeDataGridViewTextBoxColumn";
this.serviceChargeDataGridViewTextBoxColumn.ReadOnly = true;
this.serviceChargeDataGridViewTextBoxColumn.Width = 46;
//
// salePriceDataGridViewTextBoxColumn
//
this.salePriceDataGridViewTextBoxColumn.DataPropertyName = "Price";
dataGridViewCellStyle2.Format = "N0";
this.salePriceDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
this.salePriceDataGridViewTextBoxColumn.HeaderText = "Price";
this.salePriceDataGridViewTextBoxColumn.Name = "salePriceDataGridViewTextBoxColumn";
this.salePriceDataGridViewTextBoxColumn.ReadOnly = true;
this.salePriceDataGridViewTextBoxColumn.Width = 56;
//
// discontinuedDataGridViewCheckBoxColumn
//
this.discontinuedDataGridViewCheckBoxColumn.DataPropertyName = "Discontinued";
this.discontinuedDataGridViewCheckBoxColumn.HeaderText = "Discontinued";
this.discontinuedDataGridViewCheckBoxColumn.Name = "discontinuedDataGridViewCheckBoxColumn";
this.discontinuedDataGridViewCheckBoxColumn.ReadOnly = true;
this.discontinuedDataGridViewCheckBoxColumn.Width = 75;
//
// ProductListForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(662, 342);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.dgvProducts);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnEdit);
this.Controls.Add(this.btnExit);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ProductListForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Products";
this.Load += new System.EventHandler(this.ProductGroupListForm_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsList)).EndInit();
this.ResumeLayout(false);
}
#endregion
internal System.Windows.Forms.Button btnAdd;
internal System.Windows.Forms.Button btnEdit;
internal System.Windows.Forms.Button btnExit;
private System.Windows.Forms.DataGridView dgvProducts;
private System.Windows.Forms.BindingSource bsList;
internal System.Windows.Forms.Button btnSave;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn unitsDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewButtonColumn moveUp;
private System.Windows.Forms.DataGridViewButtonColumn moveDown;
private System.Windows.Forms.DataGridViewTextBoxColumn Vat;
private System.Windows.Forms.DataGridViewTextBoxColumn ServiceTax;
private System.Windows.Forms.DataGridViewTextBoxColumn Group;
private System.Windows.Forms.DataGridViewTextBoxColumn serviceChargeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn salePriceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn discontinuedDataGridViewCheckBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn discountLimitDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn groupTypeDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn productGroupDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn taxDataGridViewTextBoxColumn;
}
}

View File

@ -0,0 +1,114 @@
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Repository;
using System.Collections.Generic;
namespace Tanshu.Accounts.PointOfSale
{
public partial class FoodTableListForm : Form
{
private IList<Product> _list;
public FoodTableListForm()
{
InitializeComponent();
dgvProducts.CellClick += new DataGridViewCellEventHandler(dgvProducts_CellClick);
}
private void btnAdd_Click(object sender, EventArgs e)
{
using (var frm = new ProductForm(null))
frm.ShowDialog();
using (var bi = new ProductBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void ProductGroupListForm_Load(object sender, EventArgs e)
{
using (var bi = new ProductBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnEdit_Click(object sender, EventArgs e)
{
var id = ((Product)bsList.Current).ProductID;
using (var frm = new ProductForm(id))
frm.ShowDialog();
using (var bi = new ProductBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void dgvProductTypes_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
var data = dgvProducts.Rows[e.RowIndex].DataBoundItem as Product;
if (data == null)
return;
var tax = e.Value as Tax;
if (tax != null)
{
e.Value = string.Format("{1:P} - {0}", tax.Name, tax.Rate); ;
return;
}
var productGroup = e.Value as ProductGroup;
if (productGroup != null)
{
e.Value = productGroup.Name;
}
}
private void dgvProducts_CellClick(object sender, DataGridViewCellEventArgs e)
{
// Ignore clicks that are not on button cells.
if (e.RowIndex < 0)
return;
// Ignore clicks that are not on button cells.
if (e.ColumnIndex == dgvProducts.Columns["moveUp"].Index)
{
var product = dgvProducts.Rows[e.RowIndex].DataBoundItem as Product;
var index = _list.IndexOf(product);
if (index == 0)
return;
var previousProduct = _list[index - 1];
if (previousProduct.ProductGroup.ProductGroupID != product.ProductGroup.ProductGroupID)
return;
_list.RemoveAt(index);
_list.Insert(index -1, product);
bsList.DataSource = _list;
bsList.ResetBindings(false);
bsList.CurrencyManager.Position -= 1;
}
if (e.ColumnIndex == dgvProducts.Columns["moveDown"].Index)
{
var product = dgvProducts.Rows[e.RowIndex].DataBoundItem as Product;
var index = _list.IndexOf(product);
if (index == _list.Count + 1)
return;
var nextProduct = _list[index + 1];
if (product.ProductGroup.ProductGroupID != nextProduct.ProductGroup.ProductGroupID)
return;
_list.RemoveAt(index);
_list.Insert(index + 1, product);
bsList.DataSource = _list;
bsList.ResetBindings(false);
bsList.CurrencyManager.Position += 1;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
using (var bi = new ProductBI())
{
bi.UpdateSortOrder(_list);
bi.SaveChanges();
}
}
}
}

View File

@ -0,0 +1,138 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="moveUp.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="moveDown.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Vat.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ServiceTax.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Group.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -0,0 +1,165 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class ModifierEditForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.txtName = new System.Windows.Forms.TextBox();
this.Label2 = new System.Windows.Forms.Label();
this.txtPrice = new System.Windows.Forms.TextBox();
this.Label5 = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.chkShowInBill = new System.Windows.Forms.CheckBox();
this.chkShowForAll = new System.Windows.Forms.CheckBox();
this.clbGroups = new System.Windows.Forms.CheckedListBox();
this.SuspendLayout();
//
// txtName
//
this.txtName.AccessibleName = "";
this.txtName.Location = new System.Drawing.Point(94, 12);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(276, 20);
this.txtName.TabIndex = 0;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(53, 15);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(35, 13);
this.Label2.TabIndex = 10;
this.Label2.Text = "Name";
//
// txtPrice
//
this.txtPrice.AccessibleName = "Phone 1";
this.txtPrice.Location = new System.Drawing.Point(94, 64);
this.txtPrice.Name = "txtPrice";
this.txtPrice.Size = new System.Drawing.Size(65, 20);
this.txtPrice.TabIndex = 1;
this.txtPrice.Text = "0";
this.txtPrice.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
//
// Label5
//
this.Label5.AutoSize = true;
this.Label5.Location = new System.Drawing.Point(57, 67);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(31, 13);
this.Label5.TabIndex = 11;
this.Label5.Text = "Price";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(214, 317);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 75);
this.btnOk.TabIndex = 6;
this.btnOk.Text = "&Ok";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(295, 317);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 75);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// chkShowInBill
//
this.chkShowInBill.AutoSize = true;
this.chkShowInBill.Location = new System.Drawing.Point(94, 38);
this.chkShowInBill.Name = "chkShowInBill";
this.chkShowInBill.Size = new System.Drawing.Size(81, 17);
this.chkShowInBill.TabIndex = 4;
this.chkShowInBill.Text = "Show In Bill";
this.chkShowInBill.UseVisualStyleBackColor = true;
//
// chkShowForAll
//
this.chkShowForAll.AutoSize = true;
this.chkShowForAll.Location = new System.Drawing.Point(94, 90);
this.chkShowForAll.Name = "chkShowForAll";
this.chkShowForAll.Size = new System.Drawing.Size(119, 17);
this.chkShowForAll.TabIndex = 3;
this.chkShowForAll.Text = "Show for All Groups";
this.chkShowForAll.UseVisualStyleBackColor = true;
this.chkShowForAll.CheckedChanged += new System.EventHandler(this.chkShowForAll_CheckedChanged);
//
// clbGroups
//
this.clbGroups.FormattingEnabled = true;
this.clbGroups.Location = new System.Drawing.Point(94, 113);
this.clbGroups.Name = "clbGroups";
this.clbGroups.Size = new System.Drawing.Size(276, 184);
this.clbGroups.TabIndex = 20;
this.clbGroups.Format += new System.Windows.Forms.ListControlConvertEventHandler(this.clbGroups_Format);
//
// ModifierEditForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(382, 404);
this.Controls.Add(this.clbGroups);
this.Controls.Add(this.chkShowInBill);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.chkShowForAll);
this.Controls.Add(this.txtPrice);
this.Controls.Add(this.Label5);
this.Controls.Add(this.txtName);
this.Controls.Add(this.Label2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ModifierEditForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Product Types";
this.Load += new System.EventHandler(this.ModifierEditForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox txtPrice;
internal System.Windows.Forms.Label Label5;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chkShowInBill;
private System.Windows.Forms.CheckBox chkShowForAll;
private System.Windows.Forms.CheckedListBox clbGroups;
}
}

View File

@ -0,0 +1,111 @@
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Entities;
using System.Linq;
using System.Collections.Generic;
namespace Tanshu.Accounts.PointOfSale
{
public partial class ModifierEditForm : Form
{
private Guid? _modifierID;
public ModifierEditForm(Guid modifierID)
: this()
{
_modifierID = modifierID;
}
public ModifierEditForm()
{
InitializeComponent();
}
private void ModifierEditForm_Load(object sender, EventArgs e)
{
Modifier modifier;
using (var bi = new ModifierBI())
{
var groups = bi.ProductGroupList();
clbGroups.DataSource = groups;
if (_modifierID.HasValue)
{
modifier = bi.Get(x => x.ModifierID == _modifierID.Value);
txtName.Text = modifier.Name;
chkShowInBill.Checked = modifier.ShowInBill;
txtPrice.Text = modifier.Price.ToString();
if (modifier.ProductGroupModifiers.Any(x => x.ProductGroup == null))
{
chkShowForAll.Checked = true;
clbGroups.Hide();
}
else
{
chkShowForAll.Checked = false;
}
for (int i = 0; i < clbGroups.Items.Count; i++)
{
var item = (ProductGroup)clbGroups.Items[i];
if (item.ProductGroupModifiers.Any(x => x.Modifier == modifier))
{
clbGroups.SetItemChecked(i, true);
}
}
}
else
{
txtName.Focus();
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
Modifier modifier;
using (var bi = new ModifierBI())
{
if (_modifierID.HasValue)
modifier = bi.Get(x => x.ModifierID == _modifierID.Value);
else
modifier = new Modifier();
if (string.IsNullOrEmpty(txtName.Text.Trim()))
return;
modifier.Name = txtName.Text.Trim();
decimal price;
if (!decimal.TryParse(txtPrice.Text, out price))
return;
if (price < 0)
return;
modifier.Price = price;
modifier.ShowInBill = chkShowInBill.Checked;
if (_modifierID.HasValue)
bi.Update(modifier, chkShowForAll.Checked, clbGroups.CheckedItems.OfType<ProductGroup>());
else
bi.Insert(modifier, chkShowForAll.Checked, clbGroups.CheckedItems.OfType<ProductGroup>());
bi.SaveChanges();
}
MessageBox.Show("Update / Save Successful");
this.Close();
}
private void clbGroups_Format(object sender, ListControlConvertEventArgs e)
{
e.Value = ((ProductGroup)e.ListItem).Name;
}
private void chkShowForAll_CheckedChanged(object sender, EventArgs e)
{
if (chkShowForAll.Checked)
clbGroups.Hide();
else
clbGroups.Show();
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,201 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class ModifierListForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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();
this.btnAdd = new System.Windows.Forms.Button();
this.btnEdit = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.dgvProductGroups = new System.Windows.Forms.DataGridView();
this.bsList = new System.Windows.Forms.BindingSource(this.components);
this.btnSave = new System.Windows.Forms.Button();
this.nameDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.ShowInBill = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Price = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.moveUp = new System.Windows.Forms.DataGridViewButtonColumn();
this.moveDown = new System.Windows.Forms.DataGridViewButtonColumn();
((System.ComponentModel.ISupportInitialize)(this.dgvProductGroups)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
this.SuspendLayout();
//
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnAdd.Location = new System.Drawing.Point(12, 255);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 75);
this.btnAdd.TabIndex = 68;
this.btnAdd.Text = "&Add";
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnEdit
//
this.btnEdit.AccessibleName = "Done";
this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnEdit.Location = new System.Drawing.Point(93, 255);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(75, 75);
this.btnEdit.TabIndex = 62;
this.btnEdit.Text = "&Edit";
this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
//
// btnExit
//
this.btnExit.AccessibleName = "Done";
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(514, 255);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 75);
this.btnExit.TabIndex = 61;
this.btnExit.Text = "E&xit";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// dgvProductGroups
//
this.dgvProductGroups.AllowUserToAddRows = false;
this.dgvProductGroups.AllowUserToDeleteRows = false;
this.dgvProductGroups.AllowUserToResizeRows = false;
this.dgvProductGroups.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.dgvProductGroups.AutoGenerateColumns = false;
this.dgvProductGroups.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells;
this.dgvProductGroups.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvProductGroups.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.nameDataGridViewTextBoxColumn,
this.ShowInBill,
this.Price,
this.moveUp,
this.moveDown});
this.dgvProductGroups.DataSource = this.bsList;
this.dgvProductGroups.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvProductGroups.Location = new System.Drawing.Point(12, 12);
this.dgvProductGroups.MultiSelect = false;
this.dgvProductGroups.Name = "dgvProductGroups";
this.dgvProductGroups.ReadOnly = true;
this.dgvProductGroups.RowHeadersVisible = false;
this.dgvProductGroups.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing;
this.dgvProductGroups.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
this.dgvProductGroups.Size = new System.Drawing.Size(577, 237);
this.dgvProductGroups.TabIndex = 74;
//
// bsList
//
this.bsList.DataSource = typeof(Tanshu.Accounts.Entities.Modifier);
//
// btnSave
//
this.btnSave.AccessibleName = "Done";
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnSave.Location = new System.Drawing.Point(174, 255);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 75);
this.btnSave.TabIndex = 75;
this.btnSave.Text = "&Save";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// nameDataGridViewTextBoxColumn
//
this.nameDataGridViewTextBoxColumn.DataPropertyName = "Name";
this.nameDataGridViewTextBoxColumn.HeaderText = "Name";
this.nameDataGridViewTextBoxColumn.Name = "nameDataGridViewTextBoxColumn";
this.nameDataGridViewTextBoxColumn.ReadOnly = true;
this.nameDataGridViewTextBoxColumn.Width = 60;
//
// ShowInBill
//
this.ShowInBill.DataPropertyName = "ShowInBill";
this.ShowInBill.HeaderText = "ShowInBill";
this.ShowInBill.Name = "ShowInBill";
this.ShowInBill.ReadOnly = true;
this.ShowInBill.Width = 62;
//
// Price
//
this.Price.DataPropertyName = "Price";
this.Price.HeaderText = "Price";
this.Price.Name = "Price";
this.Price.ReadOnly = true;
this.Price.Width = 56;
//
// moveUp
//
this.moveUp.HeaderText = "Up";
this.moveUp.Name = "moveUp";
this.moveUp.ReadOnly = true;
this.moveUp.Text = "Up";
this.moveUp.UseColumnTextForButtonValue = true;
this.moveUp.Width = 27;
//
// moveDown
//
this.moveDown.HeaderText = "Down";
this.moveDown.Name = "moveDown";
this.moveDown.ReadOnly = true;
this.moveDown.Text = "Down";
this.moveDown.UseColumnTextForButtonValue = true;
this.moveDown.Width = 41;
//
// ModifierListForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(601, 342);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.dgvProductGroups);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnEdit);
this.Controls.Add(this.btnExit);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "ModifierListForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Product Types";
this.Load += new System.EventHandler(this.ProductGroupListForm_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvProductGroups)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsList)).EndInit();
this.ResumeLayout(false);
}
#endregion
internal System.Windows.Forms.Button btnAdd;
internal System.Windows.Forms.Button btnEdit;
internal System.Windows.Forms.Button btnExit;
private System.Windows.Forms.DataGridView dgvProductGroups;
private System.Windows.Forms.BindingSource bsList;
internal System.Windows.Forms.Button btnSave;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn ShowInBill;
private System.Windows.Forms.DataGridViewTextBoxColumn Price;
private System.Windows.Forms.DataGridViewButtonColumn moveUp;
private System.Windows.Forms.DataGridViewButtonColumn moveDown;
}
}

View File

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Repository;
namespace Tanshu.Accounts.PointOfSale
{
public partial class ModifierListForm : Form
{
private IList<Modifier> _list;
public ModifierListForm()
{
InitializeComponent();
dgvProductGroups.CellClick += new DataGridViewCellEventHandler(dgvProductGroups_CellClick);
}
private void btnAdd_Click(object sender, EventArgs e)
{
using (var frm = new ModifierEditForm())
frm.ShowDialog();
using (var bi = new ModifierBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void ProductGroupListForm_Load(object sender, EventArgs e)
{
using (var bi = new ModifierBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnEdit_Click(object sender, EventArgs e)
{
var id = ((Modifier)bsList.Current).ModifierID;
using (var frm = new ModifierEditForm(id))
frm.ShowDialog();
using (var bi = new ModifierBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
private void dgvProductGroups_CellClick(object sender, DataGridViewCellEventArgs e)
{
// Ignore clicks that are not on button cells.
if (e.RowIndex < 0)
return;
// Ignore clicks that are not on button cells.
if (e.ColumnIndex == dgvProductGroups.Columns["moveUp"].Index)
{
var modifier = dgvProductGroups.Rows[e.RowIndex].DataBoundItem as Modifier;
var index = _list.IndexOf(modifier);
if (index == 0)
return;
var previousProduct = _list[index - 1];
_list.RemoveAt(index);
_list.Insert(index - 1, modifier);
bsList.DataSource = _list;
bsList.ResetBindings(false);
bsList.CurrencyManager.Position -= 1;
}
if (e.ColumnIndex == dgvProductGroups.Columns["moveDown"].Index)
{
var modifier = dgvProductGroups.Rows[e.RowIndex].DataBoundItem as Modifier;
var index = _list.IndexOf(modifier);
if (index == _list.Count + 1)
return;
var nextProduct = _list[index + 1];
_list.RemoveAt(index);
_list.Insert(index + 1, modifier);
bsList.DataSource = _list;
bsList.ResetBindings(false);
bsList.CurrencyManager.Position += 1;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
//using (var bi = new ModifierBI())
//{
// bi.UpdateSortOrder(_list);
// bi.SaveChanges();
// _list = bi.List();
// bsList.DataSource = _list;
//}
}
}
}

View File

@ -0,0 +1,135 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="ShowInBill.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Price.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="moveUp.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="moveDown.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="bsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -43,7 +43,7 @@
this.txtPrice = new System.Windows.Forms.TextBox();
this.cmbVat = new System.Windows.Forms.ComboBox();
this.bsVat = new System.Windows.Forms.BindingSource(this.components);
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
this.chkIsActive = new System.Windows.Forms.CheckBox();
this.txtServiceCharge = new System.Windows.Forms.TextBox();
this.btnAddProductGroup = new System.Windows.Forms.Button();
this.cmbProductGroup = new System.Windows.Forms.ComboBox();
@ -53,6 +53,7 @@
this.cmbServiceTax = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.chkIsScTaxable = new System.Windows.Forms.CheckBox();
this.chkIsNotAvailable = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.bsProductGroups)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsServiceTax)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsVat)).BeginInit();
@ -168,15 +169,15 @@
//
this.bsVat.DataSource = typeof(Tanshu.Accounts.Entities.Tax);
//
// chkDiscontinued
// chkIsActive
//
this.chkDiscontinued.AutoSize = true;
this.chkDiscontinued.Location = new System.Drawing.Point(307, 115);
this.chkDiscontinued.Name = "chkDiscontinued";
this.chkDiscontinued.Size = new System.Drawing.Size(88, 17);
this.chkDiscontinued.TabIndex = 7;
this.chkDiscontinued.Text = "Discontinued";
this.chkDiscontinued.UseVisualStyleBackColor = true;
this.chkIsActive.AutoSize = true;
this.chkIsActive.Location = new System.Drawing.Point(191, 115);
this.chkIsActive.Name = "chkIsActive";
this.chkIsActive.Size = new System.Drawing.Size(67, 17);
this.chkIsActive.TabIndex = 7;
this.chkIsActive.Text = "Is Active";
this.chkIsActive.UseVisualStyleBackColor = true;
//
// txtServiceCharge
//
@ -267,11 +268,22 @@
this.chkIsScTaxable.Text = "Is Sc Taxable";
this.chkIsScTaxable.UseVisualStyleBackColor = true;
//
// chkIsNotAvailable
//
this.chkIsNotAvailable.AutoSize = true;
this.chkIsNotAvailable.Location = new System.Drawing.Point(255, 114);
this.chkIsNotAvailable.Name = "chkIsNotAvailable";
this.chkIsNotAvailable.Size = new System.Drawing.Size(57, 17);
this.chkIsNotAvailable.TabIndex = 23;
this.chkIsNotAvailable.Text = "Is N/A";
this.chkIsNotAvailable.UseVisualStyleBackColor = true;
//
// ProductForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(415, 276);
this.Controls.Add(this.chkIsNotAvailable);
this.Controls.Add(this.chkIsScTaxable);
this.Controls.Add(this.label6);
this.Controls.Add(this.cmbServiceTax);
@ -280,7 +292,7 @@
this.Controls.Add(this.btnOk);
this.Controls.Add(this.btnAddProductGroup);
this.Controls.Add(this.cmbProductGroup);
this.Controls.Add(this.chkDiscontinued);
this.Controls.Add(this.chkIsActive);
this.Controls.Add(this.txtServiceCharge);
this.Controls.Add(this.Label7);
this.Controls.Add(this.txtPrice);
@ -322,7 +334,7 @@
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.TextBox txtPrice;
internal System.Windows.Forms.ComboBox cmbVat;
private System.Windows.Forms.CheckBox chkDiscontinued;
private System.Windows.Forms.CheckBox chkIsActive;
internal System.Windows.Forms.TextBox txtServiceCharge;
internal System.Windows.Forms.Button btnAddProductGroup;
internal System.Windows.Forms.ComboBox cmbProductGroup;
@ -333,5 +345,6 @@
internal System.Windows.Forms.Label label6;
private System.Windows.Forms.CheckBox chkIsScTaxable;
private System.Windows.Forms.BindingSource bsVat;
private System.Windows.Forms.CheckBox chkIsNotAvailable;
}
}

View File

@ -31,8 +31,9 @@ namespace Tanshu.Accounts.PointOfSale
cmbVat.SelectedValue = product.Vat.TaxID;
cmbServiceTax.SelectedValue = product.ServiceTax.TaxID;
txtServiceCharge.Text = product.ServiceCharge.ToString("#.##");
chkDiscontinued.Checked = product.Discontinued;
chkIsActive.Checked = product.IsActive;
chkIsScTaxable.Checked = product.IsScTaxable;
chkIsNotAvailable.Checked = product.IsNotAvailable;
cmbProductGroup.SelectedValue = product.ProductGroup.ProductGroupID;
}
else
@ -112,7 +113,8 @@ namespace Tanshu.Accounts.PointOfSale
product.ServiceCharge = serviceCharge;
product.IsScTaxable = chkIsScTaxable.Checked;
product.Discontinued = chkDiscontinued.Checked;
product.IsActive = chkIsActive.Checked;
product.IsNotAvailable = chkIsNotAvailable.Checked;
//Group
if (cmbProductGroup.SelectedItem == null)

View File

@ -39,7 +39,7 @@
this.label3 = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.chkDiscontinued = new System.Windows.Forms.CheckBox();
this.chkIsActive = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// txtName
@ -146,22 +146,22 @@
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// chkDiscontinued
// chkIsActive
//
this.chkDiscontinued.AutoSize = true;
this.chkDiscontinued.Location = new System.Drawing.Point(237, 90);
this.chkDiscontinued.Name = "chkDiscontinued";
this.chkDiscontinued.Size = new System.Drawing.Size(88, 17);
this.chkDiscontinued.TabIndex = 4;
this.chkDiscontinued.Text = "Discontinued";
this.chkDiscontinued.UseVisualStyleBackColor = true;
this.chkIsActive.AutoSize = true;
this.chkIsActive.Location = new System.Drawing.Point(237, 90);
this.chkIsActive.Name = "chkIsActive";
this.chkIsActive.Size = new System.Drawing.Size(67, 17);
this.chkIsActive.TabIndex = 4;
this.chkIsActive.Text = "Is Active";
this.chkIsActive.UseVisualStyleBackColor = true;
//
// ProductGroupForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(373, 226);
this.Controls.Add(this.chkDiscontinued);
this.Controls.Add(this.chkIsActive);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtGroupType);
@ -197,6 +197,6 @@
internal System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chkDiscontinued;
private System.Windows.Forms.CheckBox chkIsActive;
}
}

View File

@ -28,7 +28,7 @@ namespace Tanshu.Accounts.PointOfSale
txtDiscountLimit.Text = productGroup.DiscountLimit.ToString();
chkModifierCompulsory.Checked = productGroup.IsModifierCompulsory;
txtGroupType.Text = productGroup.GroupType;
chkDiscontinued.Checked = productGroup.Discontinued;
chkIsActive.Checked = productGroup.IsActive;
}
else
{
@ -76,7 +76,7 @@ namespace Tanshu.Accounts.PointOfSale
return null;
productGroup.DiscountLimit = discount;
productGroup.IsModifierCompulsory = chkModifierCompulsory.Checked;
productGroup.Discontinued = chkDiscontinued.Checked;
productGroup.IsActive = chkIsActive.Checked;
if (string.IsNullOrEmpty(txtGroupType.Text.Trim()))
return null;
productGroup.GroupType = txtGroupType.Text.Trim();

View File

@ -46,7 +46,7 @@
this.Group = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.serviceChargeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.salePriceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.discontinuedDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.isActiveDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
this.SuspendLayout();
@ -104,7 +104,7 @@
this.Group,
this.serviceChargeDataGridViewTextBoxColumn,
this.salePriceDataGridViewTextBoxColumn,
this.discontinuedDataGridViewCheckBoxColumn});
this.isActiveDataGridViewCheckBoxColumn});
this.dgvProducts.DataSource = this.bsList;
this.dgvProducts.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically;
this.dgvProducts.Location = new System.Drawing.Point(12, 12);
@ -212,13 +212,13 @@
this.salePriceDataGridViewTextBoxColumn.ReadOnly = true;
this.salePriceDataGridViewTextBoxColumn.Width = 56;
//
// discontinuedDataGridViewCheckBoxColumn
// isActiveDataGridViewCheckBoxColumn
//
this.discontinuedDataGridViewCheckBoxColumn.DataPropertyName = "Discontinued";
this.discontinuedDataGridViewCheckBoxColumn.HeaderText = "Discontinued";
this.discontinuedDataGridViewCheckBoxColumn.Name = "discontinuedDataGridViewCheckBoxColumn";
this.discontinuedDataGridViewCheckBoxColumn.ReadOnly = true;
this.discontinuedDataGridViewCheckBoxColumn.Width = 75;
this.isActiveDataGridViewCheckBoxColumn.DataPropertyName = "IsActive";
this.isActiveDataGridViewCheckBoxColumn.HeaderText = "Is Active";
this.isActiveDataGridViewCheckBoxColumn.Name = "isActiveDataGridViewCheckBoxColumn";
this.isActiveDataGridViewCheckBoxColumn.ReadOnly = true;
this.isActiveDataGridViewCheckBoxColumn.Width = 75;
//
// ProductListForm
//
@ -259,7 +259,7 @@
private System.Windows.Forms.DataGridViewTextBoxColumn Group;
private System.Windows.Forms.DataGridViewTextBoxColumn serviceChargeDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn salePriceDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn discontinuedDataGridViewCheckBoxColumn;
private System.Windows.Forms.DataGridViewCheckBoxColumn isActiveDataGridViewCheckBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn discountLimitDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn groupTypeDataGridViewTextBoxColumn;
//private System.Windows.Forms.DataGridViewTextBoxColumn productGroupDataGridViewTextBoxColumn;

View File

@ -0,0 +1,137 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class TableForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.txtName = new System.Windows.Forms.TextBox();
this.Label2 = new System.Windows.Forms.Label();
this.txtLocation = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.chkIsActive = new System.Windows.Forms.CheckBox();
this.SuspendLayout();
//
// txtName
//
this.txtName.AccessibleName = "";
this.txtName.Location = new System.Drawing.Point(94, 12);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(267, 20);
this.txtName.TabIndex = 0;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(53, 15);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(35, 13);
this.Label2.TabIndex = 10;
this.Label2.Text = "Name";
//
// txtLocation
//
this.txtLocation.AccessibleName = "";
this.txtLocation.Location = new System.Drawing.Point(94, 38);
this.txtLocation.Name = "txtLocation";
this.txtLocation.Size = new System.Drawing.Size(267, 20);
this.txtLocation.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(40, 41);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 13);
this.label3.TabIndex = 12;
this.label3.Text = "Location";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(205, 114);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 75);
this.btnOk.TabIndex = 6;
this.btnOk.Text = "&Ok";
this.btnOk.UseVisualStyleBackColor = true;
this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(286, 114);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 75);
this.btnCancel.TabIndex = 7;
this.btnCancel.Text = "&Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// chkIsActive
//
this.chkIsActive.AutoSize = true;
this.chkIsActive.Location = new System.Drawing.Point(94, 64);
this.chkIsActive.Name = "chkIsActive";
this.chkIsActive.Size = new System.Drawing.Size(67, 17);
this.chkIsActive.TabIndex = 4;
this.chkIsActive.Text = "Is Active";
this.chkIsActive.UseVisualStyleBackColor = true;
//
// TableForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(373, 201);
this.Controls.Add(this.chkIsActive);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.txtLocation);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtName);
this.Controls.Add(this.Label2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TableForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Tables";
this.Load += new System.EventHandler(this.TableForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal System.Windows.Forms.TextBox txtName;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.TextBox txtLocation;
internal System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox chkIsActive;
}
}

View File

@ -0,0 +1,87 @@
using System;
using System.Windows.Forms;
using Tanshu.Accounts.Repository;
using Tanshu.Accounts.Entities;
using System.Linq;
namespace Tanshu.Accounts.PointOfSale
{
public partial class TableForm : Form
{
private Guid? _tableID;
public TableForm()
{
InitializeComponent();
}
public TableForm(Guid tableID)
: this()
{
_tableID = tableID;
}
private void TableForm_Load(object sender, EventArgs e)
{
if (_tableID.HasValue)
{
FoodTable foodTable;
using (var bi = new FoodTableBI())
foodTable = bi.Get(x => x.FoodTableID == _tableID.Value);
txtName.Text = foodTable.Name;
txtLocation.Text = foodTable.Location;
chkIsActive.Checked = foodTable.IsActive;
}
else
{
txtName.Focus();
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
if (IsFormValid())
{
using (var bi = new FoodTableBI())
{
FoodTable foodTable;
if (_tableID.HasValue)
{
foodTable = bi.Get(x => x.FoodTableID == _tableID.Value);
if (foodTable.IsActive && chkIsActive.Checked == false && (foodTable.Status != null || foodTable.VoucherID.HasValue))
{
MessageBox.Show("Cannot deactivate a table with running bill");
return;
}
}
else
foodTable = new FoodTable();
foodTable.Name = txtName.Text.Trim();
foodTable.IsActive = chkIsActive.Checked;
foodTable.Location = txtLocation.Text.Trim();
if (_tableID.HasValue)
bi.Update(foodTable);
else
bi.Insert(foodTable);
bi.SaveChanges();
}
MessageBox.Show("Update / Save Successful");
this.Close();
}
else
MessageBox.Show("The form is not valid");
}
private bool IsFormValid()
{
if (string.IsNullOrEmpty(txtName.Text.Trim()))
return false;
return true;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>