/// <summary> /// Insert or update a given purchase /// </summary> /// <param name="purchase">Sale to be synchronized</param> /// <param name="updateItem">True for updating rate or unit or tax of an item. /// False for not doing permanent update to item, but save vatiation in rate etc. for this purchase alone. </param> /// <param name="syncTransaction">False if transaction related to this purchase is synchronized already. /// True if need to be sychronized again, or if u r not sure what to pass.</param> /// <returns>Updated purchase</returns> public SalePurchase SyncSale(SalePurchase sale, bool updateItem, bool syncTransaction) { if (syncTransaction) { sale.Transaction = (new TransactionManager()).SyncTransaction(sale.Transaction); } //sync item sale.Item = (new ItemManager()).SyncItem(sale.Item, updateItem); sale.SaleUnit = (new UnitManager()).SyncUnit(sale.SaleUnit); return(SaleCache.GetInstance().SyncSale(sale)); }
/// <summary> /// Inserts new, updates existing, and deletes missing purchases in the list provided for the particular transaction. /// </summary> /// <param name="purchases"></param> /// <param name="updateItem"></param> public void SyncSales(List <SalePurchase> sales, bool updateItem, int transactionId, bool updateStock) { //sync common child object, ie, transaction //each of them wil b having reference to same transaction. //updating transaction of first purchase line will update everything. if (sales.Count > 0) { sales[0].Transaction = (new TransactionManager()).SyncTransaction(sales[0].Transaction); } for (int i = 0; i < sales.Count; i++) { sales[i] = SyncSale(sales[i], updateItem, false);//transaction got synced already for all sale items. } //clear removed purchases SaleCache.GetInstance().MarkRemovals(sales, transactionId, updateStock); }
internal void RefreshCache() { SaleCache.GetInstance().Clear(); SaleCache.GetInstance(); }
public void DeleteSale(int saleId, bool updateStock) { SaleCache.GetInstance().DeleteSale(saleId, updateStock); }
public List <SalePurchase> GetSalesByTransactionID(int transactionID) { return(SaleCache.GetInstance().GetSalesByTransactionId(transactionID)); }
public void DeleteSale(int saleId) { SaleCache.GetInstance().DeleteSale(saleId); }