public static void UpdatePurchase(Model.POS_Purchase purchase) { // string query = // "BEGIN " + // "ingredient_pkg.update_ingredient(" + ingredient.Id + ", '" + ingredient.Name + "', '" + ingredient.Description + "', " + ingredient.Unit_Id + ", " + ingredient.Unit_Cost + ", " + ingredient.Amount + "); " + // "END;"; // DB_Handler.ExecuteQuery(query); }
public static void InsertPurchase(Model.POS_Purchase purchase) { string query = "BEGIN " + "purchase_pkg.insert_purchase('" + purchase.Description + "', '" + purchase.Time.ToString(string.Format("dd/MMM/yyyy")) + "', " + purchase.Employee_Id + ", " + purchase.Supplier_Id + ", " + purchase.Cost + ", " + purchase.Discount_Rate + ", " + purchase.Total_Cost + "); " + "END;"; DB_Handler.ExecuteQuery(query); }
private static Model.POS_Purchase RowToEntity(DataRow row) { Model.POS_Purchase purchase = new Model.POS_Purchase { Id = Int32.Parse(row["Id"].ToString()), Description = row["Description"].ToString(), Time = Convert.ToDateTime(row["Time"].ToString()), Employee_Id = Int32.Parse(row["Employee_Id"].ToString()), Supplier_Id = Int32.Parse(row["Supplier_Id"].ToString()), Cost = Convert.ToDouble(row["Cost"].ToString()), Discount_Rate = Convert.ToInt32(row["Discount_Rate"].ToString()), Total_Cost = Convert.ToDouble(row["Total_Cost"].ToString()) }; return(purchase); }