Beispiel #1
0
        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;
            }
        }