Lot of changes. Now table must be explicitly updated and not from inside various functions. This makes for better understanding and lesser mistakes.
Product form now has an IsActive checkbox to show only active products.
This commit is contained in:
@ -29,14 +29,12 @@
|
||||
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();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle();
|
||||
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = 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();
|
||||
@ -47,6 +45,9 @@
|
||||
this.serviceChargeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.salePriceDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.isActiveDataGridViewCheckBoxColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
|
||||
this.bsList = new System.Windows.Forms.BindingSource(this.components);
|
||||
this.btnSave = new System.Windows.Forms.Button();
|
||||
this.chkIsActive = new System.Windows.Forms.CheckBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
@ -119,21 +120,6 @@
|
||||
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";
|
||||
@ -195,8 +181,8 @@
|
||||
// serviceChargeDataGridViewTextBoxColumn
|
||||
//
|
||||
this.serviceChargeDataGridViewTextBoxColumn.DataPropertyName = "ServiceCharge";
|
||||
dataGridViewCellStyle1.Format = "P0";
|
||||
this.serviceChargeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle1;
|
||||
dataGridViewCellStyle7.Format = "P0";
|
||||
this.serviceChargeDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle7;
|
||||
this.serviceChargeDataGridViewTextBoxColumn.HeaderText = "SC";
|
||||
this.serviceChargeDataGridViewTextBoxColumn.Name = "serviceChargeDataGridViewTextBoxColumn";
|
||||
this.serviceChargeDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
@ -205,8 +191,8 @@
|
||||
// salePriceDataGridViewTextBoxColumn
|
||||
//
|
||||
this.salePriceDataGridViewTextBoxColumn.DataPropertyName = "Price";
|
||||
dataGridViewCellStyle2.Format = "N0";
|
||||
this.salePriceDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle2;
|
||||
dataGridViewCellStyle8.Format = "N0";
|
||||
this.salePriceDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle8;
|
||||
this.salePriceDataGridViewTextBoxColumn.HeaderText = "Price";
|
||||
this.salePriceDataGridViewTextBoxColumn.Name = "salePriceDataGridViewTextBoxColumn";
|
||||
this.salePriceDataGridViewTextBoxColumn.ReadOnly = true;
|
||||
@ -218,13 +204,44 @@
|
||||
this.isActiveDataGridViewCheckBoxColumn.HeaderText = "Is Active";
|
||||
this.isActiveDataGridViewCheckBoxColumn.Name = "isActiveDataGridViewCheckBoxColumn";
|
||||
this.isActiveDataGridViewCheckBoxColumn.ReadOnly = true;
|
||||
this.isActiveDataGridViewCheckBoxColumn.Width = 75;
|
||||
this.isActiveDataGridViewCheckBoxColumn.Width = 54;
|
||||
//
|
||||
// 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);
|
||||
//
|
||||
// chkIsActive
|
||||
//
|
||||
this.chkIsActive.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.chkIsActive.AutoSize = true;
|
||||
this.chkIsActive.Checked = true;
|
||||
this.chkIsActive.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkIsActive.Location = new System.Drawing.Point(255, 285);
|
||||
this.chkIsActive.Name = "chkIsActive";
|
||||
this.chkIsActive.Size = new System.Drawing.Size(116, 17);
|
||||
this.chkIsActive.TabIndex = 76;
|
||||
this.chkIsActive.Text = "Show Active Only?";
|
||||
this.chkIsActive.ThreeState = true;
|
||||
this.chkIsActive.UseVisualStyleBackColor = true;
|
||||
this.chkIsActive.CheckStateChanged += new System.EventHandler(this.chkIsActive_CheckStateChanged);
|
||||
//
|
||||
// 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.chkIsActive);
|
||||
this.Controls.Add(this.btnSave);
|
||||
this.Controls.Add(this.dgvProducts);
|
||||
this.Controls.Add(this.btnAdd);
|
||||
@ -239,6 +256,7 @@
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvProducts)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.bsList)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@ -260,6 +278,7 @@
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn serviceChargeDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn salePriceDataGridViewTextBoxColumn;
|
||||
private System.Windows.Forms.DataGridViewCheckBoxColumn isActiveDataGridViewCheckBoxColumn;
|
||||
private System.Windows.Forms.CheckBox chkIsActive;
|
||||
//private System.Windows.Forms.DataGridViewTextBoxColumn discountLimitDataGridViewTextBoxColumn;
|
||||
//private System.Windows.Forms.DataGridViewTextBoxColumn groupTypeDataGridViewTextBoxColumn;
|
||||
//private System.Windows.Forms.DataGridViewTextBoxColumn productGroupDataGridViewTextBoxColumn;
|
||||
|
||||
@ -25,9 +25,24 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
|
||||
private void ProductGroupListForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ShowGrid();
|
||||
}
|
||||
private void ShowGrid()
|
||||
{
|
||||
using (var bi = new ProductBI())
|
||||
_list = bi.List();
|
||||
switch (chkIsActive.CheckState)
|
||||
{
|
||||
case CheckState.Checked:
|
||||
_list = bi.List(x => x.IsActive == true);
|
||||
break;
|
||||
case CheckState.Unchecked:
|
||||
_list = bi.List(x => x.IsActive == false);
|
||||
break;
|
||||
default:
|
||||
_list = bi.List();
|
||||
break;
|
||||
}
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
|
||||
@ -108,9 +123,25 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
{
|
||||
bi.UpdateSortOrder(_list);
|
||||
bi.SaveChanges();
|
||||
_list = bi.List();
|
||||
switch (chkIsActive.CheckState)
|
||||
{
|
||||
case CheckState.Checked:
|
||||
_list = bi.List(x => x.IsActive == true);
|
||||
break;
|
||||
case CheckState.Unchecked:
|
||||
_list = bi.List(x => x.IsActive == false);
|
||||
break;
|
||||
default:
|
||||
_list = bi.List();
|
||||
break;
|
||||
}
|
||||
bsList.DataSource = _list;
|
||||
}
|
||||
}
|
||||
|
||||
private void chkIsActive_CheckStateChanged(object sender, EventArgs e)
|
||||
{
|
||||
ShowGrid();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,4 +135,22 @@
|
||||
<metadata name="bsList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</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="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>
|
||||
Reference in New Issue
Block a user