private void btnCancel_Click(object sender, EventArgs e) { DialogResult result = MessageBox.Show("Are you sure you want to cancel?", "Cancel Notification", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { //yes... this.Hide(); mainform.loadUCMenuEdit(); } }
private void btnSave_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtDes.Text) || String.IsNullOrEmpty(lbURLText.Text) || String.IsNullOrEmpty(cbAvailable.Text) || String.IsNullOrEmpty(cbFoodDrink.Text)) { MessageBox.Show("Please insert fully information of Food/Drink"); } else { FoodDrink f = new FoodDrink(); f.FoodDrinkName = txtName.Text; f.Description = txtDes.Text; f.ImageURL = lbURLText.Text; string isFood = cbFoodDrink.Text; f.IsFood = (isFood == "Food") ? true : false; string isAvailable = cbAvailable.Text; f.IsAvailable = (isAvailable == "Available") ? true : false; f.FoodPrice = Convert.ToInt32(txtPrice.Text); if (f.FoodDrinkID == 0) { if (foodDrinkBLL.AddFoodDrink(f) == true) { MessageBox.Show("Saved successfully"); this.Hide(); mainform.loadUCMenuEdit(); } else { MessageBox.Show("Cannot save. Please try again!"); } } } }
private void btnEditFood_Click_1(object sender, EventArgs e) { mainform.loadUCMenuEdit(); }