Feature: Added Machine Locations so that setting the location in the config file is not needed.

Feature: Settings database table added to store string based settings.
         It is right now used to store bill header and footer.
         Hard Coded header/footer removed from file.
Feature: Tax Analysis form created to easily show the tax calculation.
Feature: Management form uses background workers.  Dont' know if it is functional though.
Chore: Reorder Table form moved to masters from sales folder.
Refactor: ManagementBI and SalesAnalysisBI
This commit is contained in:
tanshu
2016-01-04 10:52:01 +05:30
parent 0456135497
commit caf9b3106c
37 changed files with 1893 additions and 507 deletions

View File

@ -0,0 +1,136 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class MachineEditForm
{
/// <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.txtMachine = new System.Windows.Forms.TextBox();
this.Label2 = new System.Windows.Forms.Label();
this.Label5 = new System.Windows.Forms.Label();
this.btnOk = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.cmbLocation = new System.Windows.Forms.ComboBox();
this.bsLocations = new System.Windows.Forms.BindingSource(this.components);
((System.ComponentModel.ISupportInitialize)(this.bsLocations)).BeginInit();
this.SuspendLayout();
//
// txtMachine
//
this.txtMachine.AccessibleName = "";
this.txtMachine.Location = new System.Drawing.Point(94, 12);
this.txtMachine.Name = "txtMachine";
this.txtMachine.Size = new System.Drawing.Size(276, 20);
this.txtMachine.TabIndex = 0;
//
// Label2
//
this.Label2.AutoSize = true;
this.Label2.Location = new System.Drawing.Point(40, 15);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(48, 13);
this.Label2.TabIndex = 10;
this.Label2.Text = "Machine";
//
// Label5
//
this.Label5.AutoSize = true;
this.Label5.Location = new System.Drawing.Point(40, 41);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(48, 13);
this.Label5.TabIndex = 11;
this.Label5.Text = "Location";
//
// btnOk
//
this.btnOk.Location = new System.Drawing.Point(214, 65);
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, 65);
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);
//
// cmbLocation
//
this.cmbLocation.DataSource = this.bsLocations;
this.cmbLocation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cmbLocation.Location = new System.Drawing.Point(94, 38);
this.cmbLocation.Name = "cmbLocation";
this.cmbLocation.Size = new System.Drawing.Size(276, 21);
this.cmbLocation.TabIndex = 21;
//
// bsLocations
//
this.bsLocations.DataSource = typeof(string);
//
// MachineEditForm
//
this.AcceptButton = this.btnOk;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(382, 153);
this.Controls.Add(this.cmbLocation);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOk);
this.Controls.Add(this.Label5);
this.Controls.Add(this.txtMachine);
this.Controls.Add(this.Label2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MachineEditForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Machine Location";
this.Load += new System.EventHandler(this.MachineEditForm_Load);
((System.ComponentModel.ISupportInitialize)(this.bsLocations)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
internal System.Windows.Forms.TextBox txtMachine;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.Label Label5;
private System.Windows.Forms.Button btnOk;
private System.Windows.Forms.Button btnCancel;
internal System.Windows.Forms.ComboBox cmbLocation;
private System.Windows.Forms.BindingSource bsLocations;
}
}

View File

@ -0,0 +1,89 @@
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 MachineEditForm : Form
{
private Guid? _machineLocationID;
private string _machineName;
public MachineEditForm(Guid machineLocationID)
: this()
{
_machineLocationID = machineLocationID;
}
public MachineEditForm(string machineName)
: this()
{
_machineName = machineName;
}
public MachineEditForm()
{
InitializeComponent();
}
private void MachineEditForm_Load(object sender, EventArgs e)
{
MachineLocation machineLocation;
using (var bi = new MachineLocationBI())
{
bsLocations.DataSource = bi.LocationList();
if (_machineLocationID.HasValue)
{
machineLocation = bi.Get(x => x.MachineLocationID == _machineLocationID.Value);
txtMachine.Text = machineLocation.Machine;
cmbLocation.SelectedItem = machineLocation.Location;
txtMachine.Focus();
}
else if (!string.IsNullOrEmpty(_machineName))
{
txtMachine.Text = _machineName;
txtMachine.ReadOnly = true;
cmbLocation.Focus();
}
else
{
txtMachine.Focus();
}
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnOk_Click(object sender, EventArgs e)
{
MachineLocation machineLocation;
using (var bi = new MachineLocationBI())
{
if (_machineLocationID.HasValue)
machineLocation = bi.Get(x => x.MachineLocationID == _machineLocationID.Value);
else
machineLocation = new MachineLocation();
if (string.IsNullOrEmpty(txtMachine.Text.Trim()))
return;
machineLocation.Machine = txtMachine.Text.Trim();
var location = (string)cmbLocation.SelectedItem;
if (string.IsNullOrEmpty(location))
return;
machineLocation.Location = location;
if (_machineLocationID.HasValue)
bi.Update(machineLocation);
else
bi.Insert(machineLocation);
bi.SaveChanges();
}
MessageBox.Show("Update / Save Successful");
this.Close();
}
}
}

View File

@ -0,0 +1,123 @@
<?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="bsLocations.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,152 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class MachineListForm
{
/// <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.machineDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.locationDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((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.machineDataGridViewTextBoxColumn,
this.locationDataGridViewTextBoxColumn});
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.MachineLocation);
//
// machineDataGridViewTextBoxColumn
//
this.machineDataGridViewTextBoxColumn.DataPropertyName = "Machine";
this.machineDataGridViewTextBoxColumn.HeaderText = "Machine";
this.machineDataGridViewTextBoxColumn.Name = "machineDataGridViewTextBoxColumn";
this.machineDataGridViewTextBoxColumn.ReadOnly = true;
this.machineDataGridViewTextBoxColumn.Width = 73;
//
// locationDataGridViewTextBoxColumn
//
this.locationDataGridViewTextBoxColumn.DataPropertyName = "Location";
this.locationDataGridViewTextBoxColumn.HeaderText = "Location";
this.locationDataGridViewTextBoxColumn.Name = "locationDataGridViewTextBoxColumn";
this.locationDataGridViewTextBoxColumn.ReadOnly = true;
this.locationDataGridViewTextBoxColumn.Width = 73;
//
// MachineListForm
//
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.dgvProductGroups);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.btnEdit);
this.Controls.Add(this.btnExit);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "MachineListForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Machines";
this.Load += new System.EventHandler(this.MachineListForm_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;
private System.Windows.Forms.DataGridViewTextBoxColumn machineDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn locationDataGridViewTextBoxColumn;
}
}

View File

@ -0,0 +1,53 @@
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 MachineListForm : Form
{
private IList<MachineLocation> _list;
public MachineListForm()
{
InitializeComponent();
}
private void btnAdd_Click(object sender, EventArgs e)
{
using (var frm = new MachineEditForm())
frm.ShowDialog();
using (var bi = new MachineLocationBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void MachineListForm_Load(object sender, EventArgs e)
{
using (var bi = new MachineLocationBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnEdit_Click(object sender, EventArgs e)
{
var id = ((MachineLocation)bsList.Current).MachineLocationID;
using (var frm = new MachineEditForm(id))
frm.ShowDialog();
using (var bi = new MachineLocationBI())
_list = bi.List();
bsList.DataSource = _list;
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
}
}

View File

@ -0,0 +1,126 @@
<?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="locationDataGridViewTextBoxColumn.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,67 @@
namespace Tanshu.Accounts.PointOfSale
{
partial class ReorderTableForm
{
/// <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.flpTables = new System.Windows.Forms.FlowLayoutPanel();
this.SuspendLayout();
//
// flpTables
//
this.flpTables.AllowDrop = true;
this.flpTables.AutoScroll = true;
this.flpTables.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flpTables.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpTables.Location = new System.Drawing.Point(0, 0);
this.flpTables.Name = "flpTables";
this.flpTables.Size = new System.Drawing.Size(847, 492);
this.flpTables.TabIndex = 7;
this.flpTables.DragDrop += new System.Windows.Forms.DragEventHandler(this.flpTables_DragDrop);
this.flpTables.DragEnter += new System.Windows.Forms.DragEventHandler(this.flpTables_DragEnter);
//
// ReorderTableForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(847, 492);
this.Controls.Add(this.flpTables);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.Name = "ReorderTableForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Move Table / Kot";
this.Load += new System.EventHandler(this.MoveTableForm_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.FlowLayoutPanel flpTables;
}
}

View File

@ -0,0 +1,126 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using Tanshu.Accounts.Entities;
using Tanshu.Accounts.Helpers;
using System.Diagnostics;
using Tanshu.Accounts.Repository;
namespace Tanshu.Accounts.PointOfSale
{
public partial class ReorderTableForm : Form
{
private readonly IList<FoodTable> _tableList;
public ReorderTableForm()
{
InitializeComponent();
using (var bi = new FoodTableBI())
{
_tableList = bi.List();
}
Selection = null;
}
private void button_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left && e.Clicks == 1)
{
var button = (Button)sender;
button.DoDragDrop(button, DragDropEffects.Move);
}
}
private void flpTables_DragEnter(object sender, DragEventArgs e)
{
e.Effect = DragDropEffects.All;
}
private void flpTables_DragDrop(object sender, DragEventArgs e)
{
Button button = (Button)e.Data.GetData(typeof(Button));
Point p = flpTables.PointToClient(new Point(e.X, e.Y));
var item = flpTables.GetChildAtPoint(p);
int index = flpTables.Controls.GetChildIndex(item, false);
flpTables.Controls.SetChildIndex(button, index);
flpTables.Invalidate();
var foodTable = (FoodTable)button.Tag;
var listIndex = _tableList.IndexOf(foodTable);
var newIndex = _tableList.IndexOf((FoodTable)((Button)item).Tag);
_tableList.Remove(foodTable);
_tableList.Insert(index - 1, foodTable);
}
public FoodTable Selection { get; private set; }
private void MoveTableForm_Load(object sender, EventArgs e)
{
GenerateTables(new Point(75, 75));
}
private void tableButton_Click(object sender, EventArgs e)
{
var button = sender as Button;
if (button == null)
return;
var item = button.Tag as FoodTable;
Selection = item;
using (var frm = new TableForm(item.FoodTableID))
{
frm.ShowDialog();
}
}
private void GenerateTables(Point size)
{
var saveButton = new Button()
{
Name = "saveButton",
Text = "Save",
Width = size.X,
Height = size.Y,
};
saveButton.Click += saveButton_Click;
flpTables.Controls.Add(saveButton);
for (int i = 0; i < _tableList.Count; i++)
{
var item = _tableList[i];
var control = new Button()
{
Name = string.Format("g{0}", i),
Text = item.Name,
Width = size.X,
Height = size.Y,
Tag = item,
BackColor = item.IsActive ? Color.Green : Color.Red
};
control.MouseDown += button_MouseDown;
control.Click += tableButton_Click;
flpTables.Controls.Add(control);
}
var addButton = new Button()
{
Name = "addButton",
Text = "Add Table",
Width = size.X,
Height = size.Y,
};
addButton.Click += addButton_Click;
flpTables.Controls.Add(addButton);
}
private void addButton_Click(object sender, EventArgs e)
{
using (var frm = new TableForm())
{
frm.ShowDialog();
}
}
private void saveButton_Click(object sender, EventArgs e)
{
using (var bi = new FoodTableBI())
{
bi.UpdateSortOrder(_tableList);
bi.SaveChanges();
}
MessageBox.Show("Order Updated");
}
}
}

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>