public void OnUpdate(AprajitaRetailsContext db, DailySale dailySale) { var oldSale = db.DailySales.Find(dailySale.DailySaleId); UpDateAmount(db, oldSale, true); if (oldSale.IsSaleReturn) { // SaleRetun } else { // Normal Bill if (oldSale.IsDue) { if (!dailySale.IsDue) { UpdateSalesRetun(db, oldSale, true); } else { } } else { //TODO: Add due } UpDateAmount(db, oldSale, true); UpDateAmount(db, dailySale, false); } SaleBot.NotifySale(db, dailySale.SalesmanId, dailySale.Amount); }
public void OnInsert(AprajitaRetailsContext db, DailySale dailySale) { if (!dailySale.IsSaleReturn) { if (!dailySale.IsDue) { UpDateAmount(db, dailySale, false); } else { UpdateDueAmount(db, dailySale, false); UpDateAmount(db, dailySale, false); } } else { UpdateSalesRetun(db, dailySale, false); } SaleBot.NotifySale(db, dailySale.SalesmanId, dailySale.Amount); }