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 AddTypeBL(TypeBO objTypeBO) { objTypeBO.TypeCount = 0; TypeDA objTypeDA = new TypeDA(); objTypeDA.AddTypeDA(objTypeBO); }
public void DeleteTypeBL(string ProductName, string TypeName) { TypeDA objTypeDA = new TypeDA(); SellDA objSellDA = new SellDA(); int ProductID = objSellDA.GetProductID(ProductName); objTypeDA.DeleteTypeBL(ProductID, TypeName); }
public void DeleteProductBL(string ProductName) { SellDA objSellDA = new SellDA(); ProductDA objProductDA = new ProductDA(); TypeDA objTypeDA = new TypeDA(); int ProductID = objSellDA.GetProductID(ProductName); objProductDA.DeleteProductBL(ProductName); objTypeDA.DeleteTypeBL(ProductID); }
public DataSet PopulateGridViewProductsBL() { TypeDA objTypeDA = new TypeDA(); DataSet ds = objTypeDA.PopulateGridViewProductsDA(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { decimal dec = Convert.ToDecimal(ds.Tables[0].Rows[i][2]); string decStr = dec.ToString("0.##"); ds.Tables[0].Rows[i].SetField(2, decStr); ds.AcceptChanges(); } return(ds); }
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); }
public void UpdateProduct(TypeBO objTypeBO) { TypeDA objTypeDA = new TypeDA(); objTypeDA.UpdateProduct(objTypeBO); }
public int GetTypeID(TypeBO objTypeBO) { TypeDA objTypeDA = new TypeDA(); return(objTypeDA.GetTypeID(objTypeBO)); }
public DataSet PopulateComboBoxProductTypeBL(int ProductID) { TypeDA objTypeDA = new TypeDA(); return(objTypeDA.PopulateComboBoxProductTypeDA(ProductID)); }
public TypeFactory() { typeDa = new TypeDA(); }