public string Save(StockOutDB stockOutDB) { // stockOutGateway.GetAvailable() //available = stockOutGateway.GetAvailable(stockOutDB.Item); //quantity = stockOutDB.StockOutQuantity; //if (quantity > available) //{ // return "Insufficient Items in ="+stockOutDB.Item; //} //else //{ int rowAffect = stockOutGateway.Save(stockOutDB); int rowAffect2 = stockOutGateway.ChangeInAvailableInItemSetup(stockOutDB); if (rowAffect > 0 && rowAffect2 > 0) { return("Save Successful"); } else { return("Save Failed"); } }
public int Check(StockOutDB stockOutDB) { available = stockOutGateway.GetAvailable(stockOutDB.ItemName, stockOutDB.CompanyId); quantity = stockOutDB.StockOutQuantity; if (quantity > available) { return(checkInS + 1); } else { return(0); } }
public int ChangeInAvailableInItemSetup(StockOutDB stockOutDB) { availble = availble - quantity; string query = "UPDATE ItemSetup SET AvailableQuantity='" + availble + "' WHERE ItemName= '" + stockOutDB.ItemName + "' AND CompanyId= '" + stockOutDB.CompanyId + "'"; command = new SqlCommand(query, connection); connection.Open(); int rowAffect = command.ExecuteNonQuery(); connection.Close(); return(rowAffect); }
public int Save(StockOutDB stockOutDB) { quantity = stockOutDB.StockOutQuantity; string query = "INSERT INTO StockOut (CompanyId,ItemId,Quantity,ItemType) VALUES('" + stockOutDB.CompanyId + "','" + stockOutDB.ItemId + "'," + stockOutDB.StockOutQuantity + ",'" + stockOutDB.ItemType + "')"; command = new SqlCommand(query, connection); connection.Open(); int rowAffect = command.ExecuteNonQuery(); connection.Close(); return(rowAffect); }
public int CheckBefore(int quantity, string itemName, int companyId) { StockOutDB stockOutDB = new StockOutDB(); available = stockOutGateway.GetAvailable(itemName, companyId); int check_CheckBefore = 0; if (quantity > available) { check_CheckBefore = check_CheckBefore + 1; return(check_CheckBefore); } else { return(0); } }
public int GetReorderLevel(string item, int companyId) { string query = "SELECT ReorderLevel FROM ItemSetup WHERE ItemName= '" + item + "' AND CompanyId='" + companyId + "'"; command = new SqlCommand(query, connection); connection.Open(); reader = command.ExecuteReader(); StockOutDB stockOutDB = new StockOutDB(); reader.Read(); if (reader.HasRows) { stockOutDB = new StockOutDB(); stockOutDB.ReorderLevel = Convert.ToInt32(reader["ReorderLevel"]); } reader.Close(); connection.Close(); return(stockOutDB.ReorderLevel);; }
public int GetAvailable(string item, int companyId) { string query = "SELECT AvailableQuantity FROM ItemSetup WHERE ItemName= '" + item + "' AND CompanyId= '" + companyId + "'"; command = new SqlCommand(query, connection); connection.Open(); reader = command.ExecuteReader(); StockOutDB stockOutDB = new StockOutDB(); reader.Read(); if (reader.HasRows) { stockOutDB = new StockOutDB(); stockOutDB.AvailableQuantity = Convert.ToInt32(reader["AvailableQuantity"]); availble = stockOutDB.AvailableQuantity; } reader.Close(); connection.Close(); return(stockOutDB.AvailableQuantity);; }