예제 #1
0
 protected void btnSaveChengeFoodMenu_Click(object sender, EventArgs e)
 {
     try
     {
         if (Session["f_id"] != null)
         {
             if (ddlWeekdays.SelectedItem.Text.Length > 0)
             {
                 string f_id = Session["f_id"].ToString();
                 uc.UpdateFooMenu(f_id, ddlWeekdays.SelectedItem.Text, ddlWeekdays.SelectedItem.Text, txtBreakfast.Text, txtBreakfastTime.Text, txtBreakfastTimeTo.Text, txtLunch.Text, txtLunchTime.Text, txtLunchTimeTo.Text, txtSnacks.Text, txtSnacksTime.Text, txttxtSnacksTimeTo.Text, txtDinner.Text, txtDinnarTime.Text, txtDinnerTimeTo.Text);
                 string textmsg = "" + ddlWeekdays.SelectedItem.Text + " Menu Updated Successfully !";
                 ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false);
                 txtBreakfast.Text       = string.Empty;
                 txtBreakfastTime.Text   = string.Empty;
                 txtBreakfastTimeTo.Text = string.Empty;
                 txtLunch.Text           = string.Empty;
                 txtLunchTime.Text       = string.Empty;
                 txtLunchTimeTo.Text     = string.Empty;
                 txtSnacks.Text          = string.Empty;
                 txtSnacksTime.Text      = string.Empty;
                 txttxtSnacksTimeTo.Text = string.Empty;
                 txtDinner.Text          = string.Empty;
                 txtDinnarTime.Text      = string.Empty;
                 txtDinnerTimeTo.Text    = string.Empty;
                 btnFoodMenu.Visible     = false;
                 Session.Remove("f_id");
                 btnSaveChengeFoodMenu.Visible = true;
             }
         }
         else
         {
             if (CheckWeekday() == true)
             {
                 if (ddlWeekdays.SelectedItem.Text.Length > 0)
                 {
                     string f_id = Request.QueryString["f_id"].ToString();
                     uc.UpdateFooMenu(f_id, ddlWeekdays.SelectedItem.Text, ddlWeekdays.SelectedItem.Text, txtBreakfast.Text, txtBreakfastTime.Text, txtBreakfastTimeTo.Text, txtLunch.Text, txtLunchTime.Text, txtLunchTimeTo.Text, txtSnacks.Text, txtSnacksTime.Text, txttxtSnacksTimeTo.Text, txtDinner.Text, txtDinnarTime.Text, txtDinnerTimeTo.Text);
                     string textmsg = "" + ddlWeekdays.SelectedItem.Text + " Menu Updated Successfully !";
                     ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpopsuccess('" + textmsg + "')</script>", false);
                     txtBreakfast.Text             = string.Empty;
                     txtBreakfastTime.Text         = string.Empty;
                     txtBreakfastTimeTo.Text       = string.Empty;
                     txtLunch.Text                 = string.Empty;
                     txtLunchTime.Text             = string.Empty;
                     txtLunchTimeTo.Text           = string.Empty;
                     txtSnacks.Text                = string.Empty;
                     txtSnacksTime.Text            = string.Empty;
                     txttxtSnacksTimeTo.Text       = string.Empty;
                     txtDinner.Text                = string.Empty;
                     txtDinnarTime.Text            = string.Empty;
                     txtDinnerTimeTo.Text          = string.Empty;
                     btnFoodMenu.Visible           = false;
                     btnSaveChengeFoodMenu.Visible = true;
                 }
             }
         }
     }
     catch (Exception Ex)
     {
         string text = Ex.Message.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "Warning", "<script>showpoperror('" + text + "')</script>", false);
     }
 }