Initial Json commit from 2 years ago

This commit is contained in:
Amritanshu
2018-08-24 16:11:33 +05:30
parent 9301d8d07e
commit d3be8d8481
146 changed files with 3709 additions and 7402 deletions

View File

@ -31,26 +31,23 @@ namespace Tanshu.Accounts.PointOfSale
private void MachineEditForm_Load(object sender, EventArgs e)
{
MachineLocation machineLocation;
using (var bi = new MachineLocationBI())
bsLocations.DataSource = LocationBI.List();
if (_machineLocationID.HasValue)
{
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();
}
machineLocation = MachineLocationBI.Get(_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();
}
}
@ -62,26 +59,22 @@ namespace Tanshu.Accounts.PointOfSale
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 (_machineLocationID.HasValue)
machineLocation = MachineLocationBI.Get(_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();
}
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)
MachineLocationBI.Update(machineLocation);
else
MachineLocationBI.Insert(machineLocation);
MessageBox.Show("Update / Save Successful");
this.Close();
}

View File

@ -23,15 +23,13 @@ namespace Tanshu.Accounts.PointOfSale
{
using (var frm = new MachineEditForm())
frm.ShowDialog();
using (var bi = new MachineLocationBI())
_list = bi.List();
_list = MachineLocationBI.List();
bsList.DataSource = _list;
}
private void MachineListForm_Load(object sender, EventArgs e)
{
using (var bi = new MachineLocationBI())
_list = bi.List();
_list = MachineLocationBI.List();
bsList.DataSource = _list;
}
@ -40,8 +38,7 @@ namespace Tanshu.Accounts.PointOfSale
var id = ((MachineLocation)bsList.Current).MachineLocationID;
using (var frm = new MachineEditForm(id))
frm.ShowDialog();
using (var bi = new MachineLocationBI())
_list = bi.List();
_list = MachineLocationBI.List();
bsList.DataSource = _list;
}

View File

@ -15,10 +15,7 @@ namespace Tanshu.Accounts.PointOfSale
public ReorderTableForm()
{
InitializeComponent();
using (var bi = new FoodTableBI())
{
_tableList = bi.List();
}
_tableList = FoodTableBI.List(null);
Selection = null;
}
private void button_MouseDown(object sender, MouseEventArgs e)
@ -115,11 +112,7 @@ namespace Tanshu.Accounts.PointOfSale
}
private void saveButton_Click(object sender, EventArgs e)
{
using (var bi = new FoodTableBI())
{
bi.UpdateSortOrder(_tableList);
bi.SaveChanges();
}
FoodTableBI.UpdateSortOrder(_tableList);
MessageBox.Show("Order Updated");
}
}

View File

@ -27,12 +27,9 @@ namespace Tanshu.Accounts.PointOfSale
Tax tax;
if (_taxID.HasValue)
{
using (var bi = new TaxBI())
{
tax = bi.Get(x => x.TaxID == _taxID.Value);
txtName.Text = tax.Name;
txtRate.Text = (tax.Rate * 100).ToString();
}
tax = TaxBI.Get(_taxID.Value);
txtName.Text = tax.Name;
txtRate.Text = (tax.Rate * 100).ToString();
}
txtName.Focus();
}
@ -45,35 +42,31 @@ namespace Tanshu.Accounts.PointOfSale
private void btnOk_Click(object sender, EventArgs e)
{
Tax tax;
using (var bi = new TaxBI())
if (_taxID.HasValue)
tax = TaxBI.Get(_taxID.Value);
else
tax = new Tax();
if (string.IsNullOrEmpty(txtName.Text.Trim()))
return;
tax.Name = txtName.Text.Trim();
if (string.IsNullOrEmpty(txtRate.Text.Trim()))
txtRate.Text = "0";
decimal rate;
if (!decimal.TryParse(txtRate.Text, out rate) || (rate < 0 || rate > 100))
{
if (_taxID.HasValue)
tax = bi.Get(x => x.TaxID == _taxID.Value);
else
tax = new Tax();
if (string.IsNullOrEmpty(txtName.Text.Trim()))
return;
tax.Name = txtName.Text.Trim();
if (string.IsNullOrEmpty(txtRate.Text.Trim()))
txtRate.Text = "0";
decimal rate;
if (!decimal.TryParse(txtRate.Text, out rate) || (rate < 0 || rate > 100))
{
MessageBox.Show("Tax Rate is not valid, it must be between 0 to 100 percent.");
txtRate.Focus();
return;
}
else
tax.Rate = rate / 100;
if (_taxID.HasValue)
bi.Update(tax);
else
bi.Insert(tax);
bi.SaveChanges();
MessageBox.Show("Tax Rate is not valid, it must be between 0 to 100 percent.");
txtRate.Focus();
return;
}
else
tax.Rate = rate / 100;
if (_taxID.HasValue)
TaxBI.Update(tax);
else
TaxBI.Insert(tax);
MessageBox.Show("Update / Save Successful");
this.Close();
}

View File

@ -150,7 +150,6 @@
internal System.Windows.Forms.Button btnExit;
private System.Windows.Forms.DataGridView dgvTaxes;
private System.Windows.Forms.BindingSource bsList;
private System.Windows.Forms.DataGridViewTextBoxColumn machineDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn nameDataGridViewTextBoxColumn;
private System.Windows.Forms.DataGridViewTextBoxColumn rateDataGridViewTextBoxColumn;
}

View File

@ -23,15 +23,13 @@ namespace Tanshu.Accounts.PointOfSale
{
using (var frm = new TaxEditForm())
frm.ShowDialog();
using (var bi = new TaxBI())
_list = bi.List();
_list = TaxBI.List();
bsList.DataSource = _list;
}
private void TaxListForm_Load(object sender, EventArgs e)
{
using (var bi = new TaxBI())
_list = bi.List();
_list = TaxBI.List();
bsList.DataSource = _list;
}
@ -40,8 +38,7 @@ namespace Tanshu.Accounts.PointOfSale
var id = ((Tax)bsList.Current).TaxID;
using (var frm = new TaxEditForm(id))
frm.ShowDialog();
using (var bi = new TaxBI())
_list = bi.List();
_list = TaxBI.List();
bsList.DataSource = _list;
}