public void Edit() { IngredientORM ingredientORM = new IngredientORM(); Ingredient ingredient = Build(); ingredientORM.Edit(ingredient); }
public void Create() { DishORM dishORM = new DishORM(); int dishId = dishORM.Create(Build()); IngredientORM ingredientORM = new IngredientORM(); List <Ingredient> addedIgredients = getAddedIngredients(dishId); foreach (Ingredient ingredient in addedIgredients) { ingredientORM.addRelation(ingredient); } }
private void FormAddDish_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'categorySet.VW_CATEGORY' table. You can move, or remove it, as needed. this.vW_CATEGORYTableAdapter.Fill(this.categorySet.VW_CATEGORY); IngredientORM ingredientORM = new IngredientORM(); dgvADiAdded.DataSource = ingredientORM.SearchFromDish(id); dgvADiAvailable.DataSource = ingredientORM.SearchExceptFromDish(id); formatAddedDgv(dgvADiAdded); formatDgv(dgvADiAvailable); resizeGrids(); }
public void Edit() { DishORM dishORM = new DishORM(); dishORM.Edit(Build()); IngredientORM ingredientORM = new IngredientORM(); ingredientORM.DeleteAllRelations(id); List <Ingredient> addedIgredients = getAddedIngredients(id); foreach (Ingredient ingredient in addedIgredients) { ingredientORM.addRelation(ingredient); } }
public void Buy(Dish dish) { string query = "SELECT * FROM FOO_DIS_ING_RELATION WHERE DIR_DIS_ID = :DIR_DIS_ID"; OracleCommand command = connection.SqlPrepare(query); connection.AddInt(command, "DIR_DIS_ID", dish.id); OracleDataReader oracleDataReader = connection.Execute(command); DataTable ingredients = new DataTable(); ingredients.Load(oracleDataReader); foreach (DataRow dataRow in ingredients.Rows) { IngredientORM ingredientORM = new IngredientORM(); int ingredientId = Convert.ToInt32(dataRow["DIR_ING_ID"].ToString()); double quantityUsed = Convert.ToDouble(dataRow["DIR_QUANTITY"].ToString()); Console.WriteLine("quantityUsed " + quantityUsed); ingredientORM.Buy(ingredientId, quantityUsed * dish.quantity); } }
public void Create() { IngredientORM ingredientORM = new IngredientORM(); int id = ingredientORM.Create(Build()); }