Updated NH, Code Refactoring, made all DB transactions atomic.
Must use the Repositories with Using or else bad things will happen.
This commit is contained in:
@ -30,7 +30,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
}
|
||||
private void FillDataGrid()
|
||||
{
|
||||
dgExpenses.DataSource = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, false);
|
||||
using (var bi = new AdvanceBI(false))
|
||||
dgExpenses.DataSource = bi.GetAdvances(dtpFrom.Value, dtpTo.Value, false);
|
||||
}
|
||||
private void dtpFrom_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
@ -40,16 +41,17 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void btnSelect_Click(object sender, EventArgs e)
|
||||
{
|
||||
var item = (Advance)dgExpenses.SelectedRows[0].DataBoundItem;
|
||||
txtCashier.Text = item.CashierIn.Name;
|
||||
txtNarration.Tag = item.AdvanceID;
|
||||
txtNarration.Text = item.Narration;
|
||||
txtAmount.Text = item.Amount.ToString();
|
||||
var item = (Advance)dgExpenses.SelectedRows[0].DataBoundItem;
|
||||
txtCashier.Text = item.CashierIn.Name;
|
||||
txtNarration.Tag = item.AdvanceID;
|
||||
txtNarration.Text = item.Narration;
|
||||
txtAmount.Text = item.Amount.ToString();
|
||||
}
|
||||
|
||||
private void btnAdjust_Click(object sender, EventArgs e)
|
||||
{
|
||||
new AdvanceBI().Adjust((int)txtNarration.Tag, Session.User.UserID);
|
||||
using (var bi = new AdvanceBI())
|
||||
bi.Adjust((int)txtNarration.Tag, Session.User.UserID);
|
||||
FillDataGrid();
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
using (var bi = new UserBI())
|
||||
adv.CashierIn = bi.Get(x => x.UserID == (int)txtCashier.Tag);
|
||||
adv.DateIn = DateTime.Now;
|
||||
new AdvanceBI().Insert(adv);
|
||||
using (var bi = new AdvanceBI())
|
||||
bi.Insert(adv);
|
||||
GridBind();
|
||||
PrintAdvances();
|
||||
}
|
||||
@ -49,8 +50,8 @@ namespace Tanshu.Accounts.PointOfSale
|
||||
|
||||
private void GridBind()
|
||||
{
|
||||
var advance = new AdvanceBI().GetAdvances(dtpFrom.Value, dtpTo.Value, true);
|
||||
dgExpenses.DataSource = advance;
|
||||
using (var bi = new AdvanceBI(false))
|
||||
dgExpenses.DataSource = bi.GetAdvances(dtpFrom.Value, dtpTo.Value, true);
|
||||
}
|
||||
|
||||
private void dtpFrom_ValueChanged(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user