protected void btnSaveMealPlan_Click(object sender, EventArgs e) { ClearMessage(ltrlEditMealPlanMsg); if (ddlMealPlan.SelectedIndex > -1 && ddlMealPlan.SelectedValue != "-1") { MealPlanFacade mealPlanFacade = new MealPlanFacade(); CNTRMealPlan.Facades.MealPlan mealPlan = mealPlanFacade.getMealPlan(ddlMealPlan.SelectedValue); if (!String.IsNullOrEmpty(tbxPlanName.Text.Trim())) { mealPlan.Name = tbxPlanName.Text.Trim(); mealPlan.Description = tbxPlanDescr.Text.Trim(); mealPlan.CanChange = cbxChange.Checked; mealPlanFacade.Save(mealPlan); ShowMessage(ltrlEditMealPlanMsg, success, "Meal plan successfully saved."); ClearMealPlanScreen(); } else { ShowMessage(ltrlEditMealPlanMsg, alert, "You must enter a meal plan name before saving."); } } else { ShowMessage(ltrlEditMealPlanMsg, alert, "Invalid meal plan option, please try again."); } }
private void GetMealPlanInfo(string code) { MealPlanFacade mealPlanFacade = new MealPlanFacade(); CNTRMealPlan.Facades.MealPlan mealPlan = mealPlanFacade.getMealPlan(code); if (mealPlan != null) { if (!String.IsNullOrEmpty(mealPlan.Name)) { tbxPlanName.Text = mealPlan.Name.Trim(); } else { tbxPlanName.Text = String.Empty; } if (!String.IsNullOrEmpty(mealPlan.Description)) { tbxPlanDescr.Text = mealPlan.Description.Trim(); } else { tbxPlanDescr.Text = String.Empty; } cbxChange.Checked = mealPlan.CanChange; } else { ShowMessage(ltrlEditMealPlanMsg, alert, "Unable to find the meal plan, please try again."); } }
protected void btnRemoveMealPlan_Click(object sender, EventArgs e) { ClearMessage(ltrlEditMealPlanMsg); if (ddlMealPlan.SelectedIndex > -1 && ddlMealPlan.SelectedValue != "-1") { MealPlanFacade mealPlanFacade = new MealPlanFacade(); CNTRMealPlan.Facades.MealPlan mealPlan = mealPlanFacade.getMealPlan(ddlMealPlan.SelectedValue); mealPlan.InactiveDate = DateTime.Today; mealPlanFacade.Save(mealPlan); ShowMessage(ltrlEditMealPlanMsg, success, "Meal plan successfully removed."); ClearMealPlanScreen(); ddlMealPlan.Items.Clear(); PopulateMealPlans(); } else { ShowMessage(ltrlEditMealPlanMsg, alert, "Invalid meal plan option, please try again."); } }