private void BtnSave_Click_1(object sender, EventArgs e) { if (tbName.Text != "") { if (tbSelling_price_per_unit.Text != "") { if (tbUnit_number.Text != "") { if (Imagepath != "") { if (lbMeasurement.SelectedItem.ToString() != "") { if (tbStock.Text != "") { ingredientRepository.AddNewIngredientToDatabase(tbName.Text, decimal.Parse(tbSelling_price_per_unit.Text), int.Parse(tbUnit_number.Text), Imagepath, ingredientRepository.GetIdMeasurement(lbMeasurement.SelectedItem.ToString()), int.Parse(tbStock.Text)); GoToMenu(); } else { MessageBox.Show("Please write a stock number", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please select a measurement", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please select an image with upload button", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please write an unit number", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please write a selling price per unit", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please write a name", "Warning Name", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }