public string DamageInStock(Transaction aTransaction) { string sr = string.Empty; try { TransactionDAO aDao=new TransactionDAO(); aDao.InsertTransactionForReport(aTransaction); StockBLL aStockBll = new StockBLL(); aStockBll.UpdateStockForDamage(aTransaction.Stock); sr = "Save Successfully"; } catch { sr = "Please Try Again"; } return sr; }
public string SendToKitchen(Transaction aTransaction) { string sr = string.Empty; TransactionDAO aDao=new TransactionDAO(); Stock aStock=new Stock(); StockBLL aBll=new StockBLL(); aStock = aBll.GetStockByItemidFrominventory_kitchen_stock(aTransaction.Item); if(aStock.StockId==0) { aStock = aTransaction.Stock; aStock.Category = aTransaction.Category; aStock.Item = aTransaction.Item; sr = aBll.InsertKitchenStock(aStock); } else if (aStock.StockId > 0) { Stock stock=new Stock(); stock = aTransaction.Stock; double pricePrevious = stock.Stocks * stock.UnitPrice; double priceNow = aStock.Stocks * aStock.UnitPrice; double totalStocks = stock.Stocks + aStock.Stocks; double totalPrice = priceNow + pricePrevious; aStock.Stocks = totalStocks; if (totalStocks != 0 && totalPrice != 0) { aStock.UnitPrice = totalPrice / totalStocks; } else aStock.UnitPrice = 0; // aStock.StockId = stock.StockId; sr=aBll.UpdateKitchenStock(aStock); } if (sr == "Insert Sucessfully") { aDao.InsertTransactionForReport(aTransaction); } if (sr == "Insert Sucessfully") { Stock aaStock=new Stock(); aaStock = aTransaction.Stock; aaStock.Stocks *= -1; aBll.UpdateStockByStockId(aaStock); } return sr; }
public string ReturnFromKitchen(Transaction aTransaction) { string sr=""; try { TransactionDAO aDao = new TransactionDAO(); aDao.InsertTransactionForReport(aTransaction); StockBLL aBll = new StockBLL(); Stock dStock=new Stock(); dStock = aTransaction.Stock; aBll.InsertStockOrUpdate(dStock); Stock cStock = new Stock(); cStock = aTransaction.Stock; cStock.Stocks *= -1; aBll.UpdateKitchenStockByStockId(cStock); sr = "Insert Successfully"; } catch { sr = "Plz Try again"; } return sr; }