/// <summary> /// method wich works when the user press on "add product" button /// the method will check the inputs and insert the new product to data base /// </summary> private void btnAddProduct_Click(object sender, EventArgs e) { if (Checks.IsEmptyString(txtProductName.Text) || Checks.IsNumberPositive(int.Parse(nudProductPrice.Value.ToString()))) { MessageBox.Show("אחד מהשדות לא מלא !! ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { if (db.IsProductNameAlreadyExists(txtProductName.Text)) { MessageBox.Show("המוצר כבר קיים במלאי !! ", "הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { InsertNewProduct(); MessageBox.Show(txtProductName.Text + " נוסף בהצלחה לתפריט ! ", " הודעת מערכת ", MessageBoxButtons.OK, MessageBoxIcon.Information); CleanFields(); } } }