private void removeIngredientToolStripMenuItem_Click(object sender, EventArgs e) { RecBO = new RecipeBO(); RecBL = new RecipeBL(); int counter = ingmeass.Count(); int index = 0; if (MessageBox.Show("Are you sure?", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { int indicator = 0; RecBO.recipeid = Convert.ToString(RecipeID); RecBO.ingdesc = ingdesc; RecBL.removeRecipeIng(RecBO); countremovedIng = countremovedIng + 1; foreach (DataRow row in RecBL.searchIngByID(RecBO).Rows) { tempRemoveIng.Add(row.ItemArray[0].ToString()); } RecBO.recipeid = Convert.ToString(RecipeID); dataGridView1.DataSource = RecBL.getIngByRecID(RecBO); time = 0; notifier("Ingredient successfully remove to the dish!"); lblNotif.Left = (this.ClientSize.Width - lblNotif.Size.Width) / 2; this.panel3.BackColor = System.Drawing.Color.DodgerBlue; } }
private void diagAddRecipe_Load(object sender, EventArgs e) { RecBL = new RecipeBL(); RecBO = new RecipeBO(); if (SelectedAction == "New") { getRecipeID(); } else { backToolStripMenuItem.Text = "Close"; RecBO.recipeid = Convert.ToString(RecipeID); DataTable dt = RecBL.searchRecipeByID(RecBO); foreach (DataRow row in dt.Rows) { oldStatus = row.ItemArray[3].ToString(); textBox1.Text = row.ItemArray[1].ToString(); origDesc = row.ItemArray[1].ToString(); comboBox1.Text = row.ItemArray[2].ToString(); RecBO.recipeid = row.ItemArray[0].ToString(); dataGridView1.DataSource = RecBL.getIngByRecID(RecBO); } RecBO.recipeid = Convert.ToString(RecipeID); origIng = RecBL.getIngByRecIdOrig(RecBO); } }
private void dataGridView1_DoubleClick(object sender, EventArgs e) { recBO = new RecipeBO(); recBL = new RecipeBL(); IngredientBL IngBL = new IngredientBL(); IngredientBO ingBO = new IngredientBO(); foreach (DataGridViewRow row in dataGridView1.SelectedRows) { RecipeID = row.Cells[0].Value.ToString(); Recipe = row.Cells[1].Value.ToString(); groupBox2.Text = Recipe; } recBO.recipeid = Convert.ToString(RecipeID); DataTable dt = recBL.getIngByRecID(recBO); double dishprice = 0; foreach (DataRow row in dt.Rows) { ingBO.ing = row[0].ToString(); DataTable ings = IngBL.searchIngredientReturnPrice(ingBO); foreach (DataRow ing in ings.Rows) { dishprice = dishprice + (getPrice(row[1].ToString(), "1") * Convert.ToDouble(ing[4].ToString())); } } dt.Rows.Add("TOTAL ", "P " + dishprice.ToString("F")); dataGridView2.DataSource = dt; }
private void dataGridView2_DoubleClick(object sender, EventArgs e) { RecBL = new RecipeBL(); RecBO = new RecipeBO(); foreach (DataGridViewRow row in dataGridView2.SelectedRows) { selectedIng = row.Cells[0].Value.ToString(); } RecBO.recipeid = Convert.ToString(RecipeID); RecBO.ingid = selectedIng; DataTable dt = RecBL.checkRecipeIng(RecBO); if (dt.Rows.Count == 0) { diagRecipeMeas diagMeas = new diagRecipeMeas(selectedIng); if (diagMeas.ShowDialog() == DialogResult.OK) { newlyaddeding[numOfAddedIng] = selectedIng; numOfAddedIng = numOfAddedIng + 1; RecBO.recipeid = Convert.ToString(RecipeID); RecBO.ingid = selectedIng; RecBO.meas = diagMeas.meas; RecBL.addRecipeIng(RecBO); RecBO.recipeid = Convert.ToString(RecipeID); dataGridView1.DataSource = RecBL.getIngByRecID(RecBO); time = 0; notifier("Ingredient Successfully added!"); lblNotif.Left = (this.ClientSize.Width - lblNotif.Size.Width) / 2; this.panel3.BackColor = System.Drawing.Color.DodgerBlue; } } else { time = 0; notifier("Ingredient is already included!"); lblNotif.Left = (this.ClientSize.Width - lblNotif.Size.Width) / 2; this.panel3.BackColor = System.Drawing.Color.Tomato; } }