public bool SellProductBL(SellBO objSellBO) { SellDA objSellDA = new SellDA(); int ProductID = objSellDA.GetProductID(objSellBO.ProductName); TypeDA objTypeDA = new TypeDA(); int OldTypeCount = objTypeDA.GetOldTypeCount(objSellBO.TypeName, ProductID); Constants.RemainingProduct = OldTypeCount; if (OldTypeCount < objSellBO.ProductCount) { return(false); } int NewTypeCount = OldTypeCount - objSellBO.ProductCount; objTypeDA.DecreaseFromStock(objSellBO.TypeName, ProductID, NewTypeCount); decimal Price = objSellDA.GetPriceOfProduct(objSellBO, ProductID); objSellBO.ProductPrice = Price * objSellBO.ProductCount; objSellDA.SellProductDA(objSellBO); decimal oldLoan = objSellDA.GetOldLoan(objSellBO); decimal newLoan = oldLoan + objSellBO.ProductPrice; objSellDA.AddLoanDA(objSellBO, newLoan); return(true); }
public void AddProductToStockBL(TypeBO objTypeBO) { StockBO objStockBO = new StockBO(); StockDA objStockDA = new StockDA(); TypeDA objTypeDA = new TypeDA(); ProductDA objProductDA = new ProductDA(); objStockBO.StockName = objProductDA.GetProductName(objTypeBO.ProductID); objStockBO.StockType = objTypeBO.TypeName; objStockBO.StockCount = objTypeBO.TypeCount; objStockBO.StockDate = DateTime.Today; int oldCount = objTypeDA.GetOldTypeCount(objTypeBO.TypeName, objTypeBO.ProductID); objTypeBO.TypeCount = objTypeBO.TypeCount + oldCount; objTypeDA.AddProductToStockDA(objTypeBO); objStockDA.AddStockRecord(objStockBO); }