예제 #1
0
 protected void btnPlan_Click(object sender, EventArgs e)
 {
     planIDs = dlP.getCustomerPlanIDs((Int32)Session["CustomerID"]);
     if (planIDs.Count == 0)
     {
         ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                             "err_msg",
                                             "alert('Sorry, you do not have a plan yet, please create your own plan by starting with calculator your BMR');",
                                             true);
     }
     else
     {
         if (Session["CustomerID"] != null)
         {
             Response.Redirect("~/ViewMyPlan.aspx");
         }
     }
 }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Convert.ToInt32(Session["PlanID"]) != 0)
            {
                PlanID = Convert.ToInt32(Session["PlanID"]); // from customize
            }

            if (Session["CustomerID"] != null)
            {
                custID = (int)Session["CustomerID"];
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(),
                                                    "err_msg",
                                                    "alert('Please log in to manage your plans!');",
                                                    true);
                Response.Redirect("~/Default.aspx");
            }

            if (Request.QueryString["Day"] != null)
            {
                PlaceHolder1.Visible = true;
            }
            //display tracked plan
            int    trackedPlan     = CatalogAccess.getTrackedPlanByCustID(custID);
            String planDescription = CatalogAccess.getPlanDesc(trackedPlan);

            lblTrackedPlan.Text = planDescription;


            GridView2.DataSource = CatalogAccess.GetCastomerPlans(PlanID.ToString());
            GridView2.DataBind();

            planIDs = dlP.getCustomerPlanIDs(custID);

            foreach (int planIDa in planIDs)
            {
                String planDesc = CatalogAccess.getPlanDesc(planIDa);
                planDescs.Add(planDesc);
            }
            if (planDescs.Count >= 1)
            {
                if (!String.IsNullOrEmpty(planDescs[0]))
                {
                    Button1.Visible = true;
                    Button1.Text    = "Plan: " + planDescs[0];
                }
            }
            if (planDescs.Count >= 2)
            {
                if (!String.IsNullOrEmpty(planDescs[1]))
                {
                    Button2.Visible = true;
                    Button2.Text    = "Plan: " + planDescs[1];
                }
            }
            if (planDescs.Count >= 3)
            {
                if (!String.IsNullOrEmpty(planDescs[2]))
                {
                    Button3.Visible = true;
                    Button3.Text    = "Plan: " + planDescs[2];
                }
            }

            if (!IsPostBack)
            {
                //  planID = 0 means no plan is tracked for this Customer

                //ddlCustomer.DataTextField = "Text";
                //ddlCustomer.DataValueField = "Value";
                //  ddlCustomer.DataSource = CatalogAccess.GetCustomers();

                //   ddlCustomer.DataBind();

                DropDownList1.Text   = Request.QueryString["Day"];
                DropDownList2.Text   = Request.QueryString["MealType"];
                lblAddDisplay.Text   = "";
                lblDeleteResult.Text = "";
                Table3.Visible       = false;
                Table4.Visible       = false;
            }
        }