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 decimal CalculatePriceBL(SellBO objSellBO) { SellDA objSellDA = new SellDA(); int ProductID = objSellDA.GetProductID(objSellBO.ProductName); decimal Price = objSellDA.GetPriceOfProduct(objSellBO, ProductID); objSellBO.ProductPrice = Price * objSellBO.ProductCount; return(objSellBO.ProductPrice); }