public ItemPurchase GetItempurchaseByID(int id) { ObjProditmpurchase = null; ObjProditmpurchase = DataRepository.ItemPurchaseProvider.GetById(id); return ObjProditmpurchase; }
public string UpdateProd(Items obitem, ItemPurchase objitmpurchase, ItemSell ObjitmSell, ProdTable objtable) { TransactionManager transaction = null; try { transaction = DataRepository.Provider.CreateTransaction(); transaction.BeginTransaction(); if ((DataRepository.ItemsProvider.Update(transaction, obitem))) { // Show proper message //objitmpurchase.ItemId = obitem.Id; //ObjitmSell.ItemId = obitem.Id; if ((DataRepository.ItemPurchaseProvider.Update(transaction, objitmpurchase)) && ((DataRepository.ItemSellProvider.Update(transaction, ObjitmSell)))) { //objtable.ItemId = obitem.Id; //objtable.SellId = ObjitmSell.Id; //objtable.PurchaseId = objitmpurchase.Id; if (DataRepository.ProdTableProvider.Update(transaction, objtable)) { } else { transaction.Rollback(); return "Information could not be saved."; } } else { transaction.Rollback(); return "Information could not be saved."; } } else { return "Information could not be saved."; } transaction.Commit(); return "Information Update successfully."; } catch (Exception e) { transaction.Rollback(); return "Information could not be saved.Please contact Administrator."; } }