示例#1
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        int memberId = PrizeMemberAuthUtils.GetMemberID();

        PrizeExercisePlan plan = dbAccess.GetNotStartedExercisePlan(memberId);

        if (plan == null)
        {
            MemberExercisePlan curMemberPlan = dbAccess.GetCurrentMemberPlan(memberId);
            if (curMemberPlan != null)
            {
                plan = dbAccess.GetExercisePlan(curMemberPlan.ExercisePlanId);
            }
            if (plan == null)
            {
                plan = dbAccess.GetLastFinishedExercisePlan(memberId);
            }
        }

        PrizeExercisePlan nextPlan = dbAccess.GetNextExercisePlan(plan);

        if (nextPlan != null)
        {
            Response.Redirect(String.Format("{0}?targetplanid={1}", PrizeConstants.URL_MEMBER_BUY_PLAN, nextPlan.Id));
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int memberId = PrizeMemberAuthUtils.GetMemberID();

        var exercisePlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);

        if (exercisePlan == null)
        {
            PrizeMember            member  = PrizeMemberAuthUtils.GetMemberData(memberId);
            PrizeMemberPlanManager planMan = new PrizeMemberPlanManager();
            Response.Redirect(planMan.GetEmptyPlanJumpURL(member));
        }

        MemberExercisePlanWeek memberPlanWeek;

        if (Request["MemberPlanWeekID"] != null)
        {
            int memberPlanWeekId;
            int.TryParse(Request["MemberPlanWeekID"], out memberPlanWeekId);
            memberPlanWeek = dbAccess.GetMemberPlanWeekById(memberPlanWeekId);
        }
        else
        {
            memberPlanWeek = dbAccess.GetCurrentMemberPlanWeek(memberId);
        }

        if (memberPlanWeek == null)
        {
            divMealPlanContent.Visible = false;
            divNotStarted.Visible      = true;
            return;
        }

        int iWeekNum = memberPlanWeek.Week;

        lblWeekNum.Text = "Week " + iWeekNum;
        divMainMealPlan.Attributes.Add("class", "tab-inner-content nodisplay wk" + iWeekNum);
        lblDateDuration.Text = PrizeCommonUtils.ParseDateToEnglish(memberPlanWeek.StartDate) + " - "
                               + PrizeCommonUtils.ParseDateToEnglish(memberPlanWeek.EndDate);

        MemberExercisePlan memberPlan = dbAccess.GetCurrentMemberPlan(memberId);

        if (memberPlan == null)
        {
            return;
        }
        PrizeExercisePlan plan = dbAccess.GetExercisePlan(memberPlan.ExercisePlanId);

        if (plan == null)
        {
            return;
        }
        lblPlanProgram.Text = plan.PrizePlanProgram.Name;

        MemberExercisePlanWeek prevWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(memberPlan.Id, memberPlanWeek.Week - 1);

        if (prevWeek != null)
        {
            int prevWeekNum = iWeekNum - 1;
            weekPre.NavigateUrl = "/my-account/meal-plan?MemberPlanWeekID=" + prevWeek.Id;
            weekPre.Text        = "Week " + (memberPlanWeek.Week - 1);
        }
        else
        {
            weekPre.Attributes.Add("class", "no-arrow");
        }

        MemberExercisePlanWeek nextWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(memberPlan.Id, memberPlanWeek.Week + 1);

        if (nextWeek != null)
        {
            weekNext.NavigateUrl = "/my-account/meal-plan?MemberPlanWeekID=" + nextWeek.Id;
            weekNext.Text        = "Week " + (memberPlanWeek.Week + 1);
        }
        else
        {
            weekNext.Attributes.Add("class", "no-arrow");
        }

        MemberFoodPlanWeek foodWeek = dbAccess.GetMemberFoodPlanWeek(memberId, memberPlanWeek.MemberExercisePlanId, memberPlanWeek.Week);

        if (foodWeek == null)
        {
            return;
        }
        if (foodWeek.Food1 == null || foodWeek.Food1.Equals(""))
        {
            this.colories.Visible = false;
        }
        else
        {
            lblFood1.Text = foodWeek.Food1;
        }

        if (foodWeek.Food2 == null || foodWeek.Food2.Equals(""))
        {
            this.protein.Visible = false;
        }
        else
        {
            lblFood2.Text = foodWeek.Food2;
        }

        if (foodWeek.Food3 == null || foodWeek.Food3.Equals(""))
        {
            this.carbo.Visible = false;
        }
        else
        {
            lblFood3.Text = foodWeek.Food3;
        }

        if (foodWeek.Food4 == null || foodWeek.Food4.Equals(""))
        {
            this.fats.Visible = false;
        }
        else
        {
            lblFood4.Text = foodWeek.Food4;
        }

        if (foodWeek.Food5 != null)
        {
            string[] sPersentage = foodWeek.Food5.Split(';');
            if (sPersentage.Length > 0)
            {
                lblFood5.Text = sPersentage[0];
                if (sPersentage.Length > 1)
                {
                    lblFood6.Text = sPersentage[1];
                    if (sPersentage.Length > 2)
                    {
                        lblFood7.Text = sPersentage[2];
                    }
                }
            }
        }
    }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int memberId = PrizeMemberAuthUtils.GetMemberID();

        var exercisePlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);

        if (exercisePlan == null)
        {
            PrizeMember            member  = PrizeMemberAuthUtils.GetMemberData(memberId);
            PrizeMemberPlanManager planMan = new PrizeMemberPlanManager();
            Response.Redirect(planMan.GetEmptyPlanJumpURL(member));
        }

        if (int.TryParse(Request["MemberPlanWeekId"], out memberPlanWeekId))
        {
            _MemberPlanWeek = dbAccess.GetMemberPlanWeekById(memberPlanWeekId);
        }

        if (_MemberPlanWeek == null)
        {
            _MemberPlanWeek = dbAccess.GetCurrentMemberPlanWeek(memberId);
        }

        if (_MemberPlanWeek == null)
        {
            divMeasurement.Visible        = false;
            btnUpdateProgress.Enabled     = false;
            this.photoPanelUpload.Visible = false;
            return;
        }

        InitPageControls();

        frontUpload.Attributes["onchange"] = "UploadFile(this)";
        sideUpload.Attributes["onchange"]  = "UploadFile(this)";
        backUpload.Attributes["onchange"]  = "UploadFile(this)";

        _PlanWeek = dbAccess.GetExercisePlanWeek(_MemberPlanWeek.ExercisePlanWeekId);

        iWeekNum = this.GetLatestMeasurementWeekNum(_MemberPlanWeek.Week);

        if (iWeekNum != _MemberPlanWeek.Week)
        {
            _MemberPlanWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(_MemberPlanWeek.MemberExercisePlanId, iWeekNum);
        }
        if (_MemberPlanWeek == null)
        {
            divMeasurement.Visible        = false;
            btnUpdateProgress.Enabled     = false;
            this.photoPanelUpload.Visible = false;
            return;
        }

        if (!PrizeConstants.WEEKS_NEEDS_RESULT.Contains(iWeekNum))
        {
            divMeasurement.Visible = false;
        }

        lblWeekNum.Text = iWeekNum.ToString();
        //lblWeekNum2.Text = lblWeekNum.Text;
        lblWeekNum3.Text = iWeekNum.ToString();

        if (!IsPostBack)
        {
            WeekResults = dbAccess.GetMemberPlanResults(_MemberPlanWeek.MemberExercisePlanId);

            LoadWeeklyResult(WeekResults);

            LoadMemberPhotos(iWeekNum, WeekResults);

            DrawProgressGraph((int)_MemberPlanWeek.MemberExercisePlanId, WeekResults);

            LoadPreNextLinks();
        }


        MemberExercisePlan myPlan = dbAccess.GetCurrentMemberPlan(PrizeMemberAuthUtils.GetMemberID());

        if (myPlan != null)
        {
            PrizeExercisePlan plan = dbAccess.GetExercisePlan(myPlan.ExercisePlanId);
            if (plan != null)
            {
                if (plan.PlanName.ToLower().Contains("muscle"))
                {
                    lblMeasurement3.Text            = "Right arm biceps (cm)";
                    lblMeasurementGraph3.Text       = "Right arm biceps";
                    lblMeasurementMetricGraph3.Text = "(cm)";
                    lblMeasurement4.Text            = "Chest (cm)";
                    lblMeasurementGraph4.Text       = "Chest";
                    lblMeasurementMetricGraph4.Text = "(cm)";
                    lblMeasurement5.Text            = "Right thigh (cm)";
                    lblMeasurementGraph5.Text       = "Right thigh";
                    lblMeasurementMetricGraph5.Text = "(cm)";
                }
                if (plan.PlanName.ToLower().Contains("tone"))
                {
                    lblMeasurement3.Text            = "Right arm biceps (cm)";
                    lblMeasurementGraph3.Text       = "Right arm biceps";
                    lblMeasurementMetricGraph3.Text = "(cm)";
                    lblMeasurement4.Text            = "Hips (cm)";
                    lblMeasurementGraph4.Text       = "Hips";
                    lblMeasurementMetricGraph4.Text = "(cm)";
                    lblMeasurement5.Text            = "Right thigh (cm)";
                    lblMeasurementGraph5.Text       = "Right thigh";
                    lblMeasurementMetricGraph5.Text = "(cm)";
                }
                if (plan.PlanName.ToLower().Contains("weight"))
                {
                    lblMeasurement3.Text            = "Chest (cm)";
                    lblMeasurementGraph3.Text       = "Chest";
                    lblMeasurementMetricGraph3.Text = "(cm)";
                    lblMeasurement4.Text            = "Hips (cm)";
                    lblMeasurementGraph4.Text       = "Hips";
                    lblMeasurementMetricGraph4.Text = "(cm)";
                    lblMeasurement5.Text            = "Heart rate (per min)";
                    lblMeasurementGraph5.Text       = "Heart rate";
                    lblMeasurementMetricGraph5.Text = "(per min)";
                }
            }
        }
    }