Example #1
0
    public PrizeExercisePlan GetNextPlanToBuy(int memberId)
    {
        PrizeExercisePlan plan = GetNotStartedExercisePlan(memberId);

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

        PrizeExercisePlan nextPlan;

        if (plan != null && plan.IsTrialPlan == 1)
        {
            nextPlan = GetNextExercisePlanForTrialPlan(plan);
        }
        else
        {
            nextPlan = GetNextExercisePlan(plan);
        }

        return(nextPlan);
    }
Example #2
0
    public PrizeExercisePlan GetNextExercisePlanForTrialPlan(PrizeExercisePlan finishedPlan)
    {
        try
        {
            if (finishedPlan == null)
            {
                return(null);
            }

            if (finishedPlan.IsTrialPlan == 0)
            {
                return(null);
            }

            db.Database.Connection.Open();

            PrizeExercisePlan nextPlan = (from c in db.PrizeExercisePlans
                                          where c.LocationId == finishedPlan.LocationId && c.ProgramId == finishedPlan.ProgramId &&
                                          c.ExperienceId == finishedPlan.ExperienceId && c.LevelId == finishedPlan.LevelId &&
                                          c.IsTrialPlan == 0
                                          select c).FirstOrDefault();

            return(nextPlan);
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
Example #3
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));
        }
    }
Example #4
0
    public PrizeExercisePlan GetLastFinishedExercisePlan(int memberId)
    {
        try
        {
            db.Database.Connection.Open();
            string             finishedStatus = PrizeConstants.STATUS_PLAN_FINISHED + PrizeConstants.STATUS_PLAN_PAID;
            MemberExercisePlan memberPlan     = (from c in db.MemberExercisePlans
                                                 where c.MemberId == memberId && c.Status.Equals(finishedStatus)
                                                 orderby c.EndDate descending
                                                 select c).FirstOrDefault();
            if (memberPlan == null)
            {
                return(null);
            }
            PrizeExercisePlan finishedPlan = (from c in db.PrizeExercisePlans
                                              where c.Id == memberPlan.ExercisePlanId
                                              select c).FirstOrDefault();

            return(finishedPlan);
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
Example #5
0
    private void BindDropDownList()
    {
        PrizeExercisePlan plan = dbAccess.GetCurrentOrStartingExercisePlanInfo(memberId);

        if (plan == null)
        {
            return;
        }

        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();
            {
                var ProgramQuery = from c in db.PrizePlanPrograms
                                   select new { c.Name, c.Id };
                ddlProgram.DataValueField = "Id";
                ddlProgram.DataTextField  = "Name";
                ddlProgram.DataSource     = ProgramQuery.ToList();

                ddlProgram.DataBind();

                ddlProgram.Items.FindByValue("" + plan.ProgramId).Selected = true;

                var LevelQuery = from e in db.PrizePlanLevels
                                 select new { e.Name, e.Id };
                ddlLevel.DataValueField = "Id";
                ddlLevel.DataTextField  = "Name";
                ddlLevel.DataSource     = LevelQuery.ToList();

                ddlLevel.DataBind();

                ddlLevel.Items.FindByValue("" + plan.LevelId).Selected = true;

                var planQuery = from a in db.PrizeExercisePlans
                                join Program in db.PrizePlanPrograms on a.ProgramId equals Program.Id
                                join Location in db.PrizePlanLocations on a.LocationId equals Location.Id
                                join Level in db.PrizePlanLevels on a.LevelId equals Level.Id
                                join Experience in db.PrizePlanExperiences on a.ExperienceId equals Experience.Id
                                where a.IsTrialPlan == plan.IsTrialPlan
                                orderby Program.Name, Location.Name, Level.Name, Experience.Name
                    select new
                {
                    PlanId   = a.Id,
                    PlanName = Program.Name + "_" + Location.Name + "_" + Level.Name + "_" + Experience.Name
                };
                ddlPlan.DataValueField = "PlanId";
                ddlPlan.DataTextField  = "PlanName";
                ddlPlan.DataSource     = planQuery.ToList();

                ddlPlan.DataBind();

                ddlPlan.Items.FindByValue("" + plan.Id).Selected = true;

                db.Database.Connection.Close();
            }
        }
    }
Example #6
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        bool bLogin = Membership.ValidateUser(username.Text, password.Text);

        if (bLogin != false)
        {
            Member uMember = Member.GetMemberFromLoginNameAndPassword(username.Text, password.Text);
            if (uMember != null)
            {
                Session["taRegistration"] = uMember.Email;
                System.Web.Security.FormsAuthentication.SetAuthCookie(uMember.LoginName, true);
                Member.AddMemberToCache(uMember);
                MemberExercisePlan myPlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(uMember.Id);
                int myPlanId = 0;
                if (myPlan != null)
                {
                    myPlanId = myPlan.ExercisePlanId;
                }
                PrizeMemberAuthUtils.SaveMemberLoginLog(uMember.Id, myPlanId, this.ToString(), "Login");
                if (myPlan == null)
                {
                    PrizeMember            member  = PrizeMemberAuthUtils.GetMemberData(uMember.Id);
                    PrizeMemberPlanManager planMan = new PrizeMemberPlanManager();
                    Response.Redirect(planMan.GetEmptyPlanJumpURL(member));
                }
                else
                {
                    if (Request.QueryString["returnUrl"] != null)
                    {
                        Response.Redirect(Request.QueryString["returnUrl"]);
                    }
                    PrizeExercisePlan plan = dbAccess.GetExercisePlan(myPlan.ExercisePlanId);
                    if (plan.IsTrialPlan != 1)
                    {
                        Response.Redirect(String.Format("{0}?loginName={1}&memberId={2}", PrizeConstants.URL_MEMBER_COMING_UP, uMember.LoginName, uMember.Id));
                    }
                    else
                    {
                        Response.Redirect(String.Format("{0}?loginName={1}&memberId={2}", PrizeConstants.URL_MEMBER_LANDING, uMember.LoginName, uMember.Id));
                    }
                }
                //var log = new MemberVisitLogs();
                //log.UmbracoId = uMember.Id;
                //log.Page = HttpContext.Current.Request.Url.AbsolutePath;
                //log.CreatedOn = PrizeCommonUtils.GetSystemDate();
                //log.MembersReference.EntityKey = new EntityKey("SydneyCatalystMemberEntities.Members", "Id", member.Id);
                //db.AddToMemberVisitLogs(log);
                //db.SaveChanges();
                return;
            }
        }
        errorLabel.Text = "Invalid UserId/password.";
    }
Example #7
0
 public PrizeExercisePlan GetExercisePlan(int planId)
 {
     try
     {
         db.Database.Connection.Open();
         PrizeExercisePlan plan = (from c in db.PrizeExercisePlans
                                   where c.Id == planId
                                   select c).FirstOrDefault();
         return(plan);
     }
     finally
     {
         db.Database.Connection.Close();
     }
 }
Example #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DateTime myDate = GetOrientationDate(2);

        lblDay.Text  = myDate.ToString("dddd d").ToUpper();
        lblDate.Text = myDate.ToString("MMMM, yyyy");
        MemberExercisePlan myPlan = dbAccess.GetCurrentMemberPlan(PrizeMemberAuthUtils.GetMemberID());

        if (myPlan == null)
        {
            Response.Write(PrizeConstants.CONST_JS_WARNING_PLAN_NOT_START);
            this.div1.Visible = false;
            return;
        }
        var acc = new PrizeDataAccess();
        PrizeExercisePlan plan = acc.GetExercisePlan(myPlan.ExercisePlanId);

        if (plan.PlanName.ToLower().Contains("muscle"))
        {
            divMuscle.Attributes.Add("class", "show-pg-b");
            hiddenPlan.Text = "muscle";
        }
        if (plan.PlanName.ToLower().Contains("tone"))
        {
            divTone.Attributes.Add("class", "show-pg-t");
            hiddenPlan.Text = "tone";
        }
        if (plan.PlanName.ToLower().Contains("weight"))
        {
            divWeight.Attributes.Add("class", "show-pg-l");
            hiddenPlan.Text = "weight";
        }


        var planName  = acc.GetPlanName(plan);
        var sPlanName = planName.Split('_');

        hiddenLocation.Text = sPlanName[1].ToLower();
        if (sPlanName[1].ToLower() == "gym")
        {
            divFitness.Attributes.Add("class", "tab-inner-content show-gym");
        }
        else
        {
            divFitness.Attributes.Add("class", "tab-inner-content show-home");
        }
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
        {
            return;
        }

        member = PrizeMemberAuthUtils.GetMemberData();

        /*if (dbAcess.RemainningWeeks(member.UmbracoId) > 0)
         * {
         *  Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('Not the last week')</SCRIPT>");
         *  this.btnSubmit.Enabled = false;
         *  return;
         * }*/

        plan = dbAcess.GetNextPlanToBuy(member.UmbracoId);
        LoadUserDetails();

        if (plan == null)
        {
            Response.Write(@"<SCRIPT LANGUAGE=""JavaScript"">alert('There is no new plan to buy')</SCRIPT>");
            this.btnSubmit.Enabled = false;
            return;
        }
        else
        {
            planName         = dbAcess.GetPlanName(plan);
            sPlanName        = planName.Split('_');
            lblProg.Text     = sPlanName[0];
            lblSem.Text      = sPlanName[3].Replace("Semester ", "");
            lblLvl.Text      = sPlanName[2];
            lblLoc.Text      = sPlanName[1];
            ddlLocation.Text = sPlanName[1];

            string continueType = Request.QueryString["type"];
            if (continueType != null && continueType == "new")
            {
                ddlProgram.Items[0].Text = "Select a new program";
            }
        }
    }
Example #10
0
    public string GetPlanInfoForPublish()
    {
        string      planInfo = "";
        PrizeMember member   = PrizeMemberAuthUtils.GetMemberData();

        if (member == null)
        {
            return(planInfo);
        }
        MemberExercisePlan myPlan = this.GetCurrentMemberPlanOrStartingPlan(member.UmbracoId);

        if (myPlan == null)
        {
            return(planInfo);
        }
        PrizeExercisePlan plan = this.GetExercisePlan(myPlan.ExercisePlanId);

        char c = PrizeMemberAuthUtils.GetMemberSetting(member.UserSettings, PrizeConstants.MemberSettings.ShowProgram);

        if (c != '0')
        {
            PrizePlanProgram level = (from tbl in db.PrizePlanPrograms
                                      where tbl.Id == plan.ProgramId
                                      select tbl).SingleOrDefault();
            planInfo += level.Name;
        }

        c = PrizeMemberAuthUtils.GetMemberSetting(member.UserSettings, PrizeConstants.MemberSettings.ShowLevel);
        if (c != '0')
        {
            PrizePlanLevel level = (from tbl in db.PrizePlanLevels
                                    where tbl.Id == plan.LevelId
                                    select tbl).SingleOrDefault();
            if (!planInfo.Equals(""))
            {
                planInfo += " ";
            }
            planInfo += level.Name;
        }

        return(planInfo);
    }
Example #11
0
    public PrizeExercisePlan ChangeExercisePlanLocation(PrizeExercisePlan originalPlan, string sLocation)
    {
        try
        {
            db.Database.Connection.Open();
            PrizePlanLocation location = (from l in db.PrizePlanLocations
                                          where l.Name.Equals(sLocation)
                                          select l).FirstOrDefault();

            PrizeExercisePlan nextPlan = (from c in db.PrizeExercisePlans
                                          where c.LocationId == location.Id && c.ProgramId == originalPlan.ProgramId && c.ExperienceId == originalPlan.ExperienceId && c.LevelId == originalPlan.LevelId &&
                                          c.IsTrialPlan == 0
                                          select c).FirstOrDefault();

            return(nextPlan);
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
Example #12
0
    protected void WeekChanged(object sender, EventArgs e)
    {
        DropDownList       ddlWeekList = (DropDownList)sender;
        int                weekNum     = int.Parse(ddlWeekList.SelectedValue);
        MemberExercisePlan myPlan;

        if (Session["MPID"] != null)
        {
            int mPlanId = Convert.ToInt32(Session["MPID"]);
            myPlan = dbAccess.GetMemberExercisePlan(mPlanId);
        }
        else
        {
            myPlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);
        }

        PrizeExercisePlan plan = dbAccess.GetExercisePlan(myPlan.ExercisePlanId);

        lblPlanInfo.Text = "Plan " + plan.PlanName + " from " + PrizeCommonUtils.ParseDateToEnglish(myPlan.StartDate) + " to " + PrizeCommonUtils.ParseDateToEnglish(myPlan.EndDate.Value);
        LoadFoodPlanWeek(memberId, myPlan, weekNum);
    }
    protected void OnRowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row     = GridView1.Rows[e.RowIndex];
        int         Id      = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0]);
        double      price   = Convert.ToDouble((row.FindControl("txtPrice") as TextBox).Text);
        int         isTrial = Convert.ToInt16((row.FindControl("txtTrialOrNot") as CheckBox).Checked);

        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();
            PrizeExercisePlan plan = (from c in db.PrizeExercisePlans
                                      where c.Id == Id
                                      select c).FirstOrDefault();

            plan.Price       = price;
            plan.IsTrialPlan = isTrial;
            db.SaveChanges();
            db.Database.Connection.Close();
        }
        GridView1.EditIndex = -1;
        this.BindGrid();
    }
Example #14
0
    public string GetPlanName(PrizeExercisePlan plan)
    {
        string           planName    = "";
        PrizePlanProgram planProgram = (from l in db.PrizePlanPrograms
                                        where l.Id == plan.ProgramId
                                        select l).FirstOrDefault();

        PrizePlanLocation planLocation = (from l in db.PrizePlanLocations
                                          where l.Id == plan.LocationId
                                          select l).FirstOrDefault();

        PrizePlanExperience planExp = (from l in db.PrizePlanExperiences
                                       where l.Id == plan.ExperienceId
                                       select l).FirstOrDefault();

        PrizePlanLevel planLevel = (from l in db.PrizePlanLevels
                                    where l.Id == plan.LevelId
                                    select l).FirstOrDefault();

        planName = planProgram.Name + "_" + planLocation.Name + "_" + planLevel.Name + "_" + planExp.Name;
        return(planName);
    }
Example #15
0
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        if (plan == null)
        {
            return;
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Side-plank');
                    $('#exerciseModal2').load('/exercise/Powerband-high-to-low-woodchop');
                    $('#exerciseModal3').load('/exercise/Side-plank-powerband-pull');";
                imgExercise1.ImageUrl = "/media/15009/landscape_side_plank_step1.jpg";
                imgExercise2.ImageUrl = "/media/14715/landscape_powerband_high_to_low_woodchop_step1.jpg";
                imgExercise3.ImageUrl = "/media/15150/landscape_side_plank_powerband_pull_step1.jpg";

                lblExercise1.Text = "Side plank";
                lblExercise2.Text = "Powerband high to low woodchop";
                lblExercise3.Text = "Side plank powerband pull";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Ab-circles');
                    $('#exerciseModal2').load('/exercise/Cable-mid-woodchop');
                    $('#exerciseModal3').load('/exercise/Deadball-woodchop-slam');";
                imgExercise1.ImageUrl = "/media/15145/landscape_ab_circles.jpg";
                imgExercise2.ImageUrl = "/media/15126/landscape_cable_woodchop-mid_step1.jpg";
                imgExercise3.ImageUrl = "/media/14403/landscape_deadball_woodchop_slam_step1.jpg";

                lblExercise1.Text = "Ab circles";
                lblExercise2.Text = "Cable mid woodchop";
                lblExercise3.Text = "Deadball woodchop slam";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Side-plank');
                    $('#exerciseModal2').load('/exercise/Powerband-high-to-low-woodchop');
                    $('#exerciseModal3').load('/exercise/Powerband-pallof-press');";
                imgExercise1.ImageUrl = "/media/15009/landscape_side_plank_step1.jpg";
                imgExercise2.ImageUrl = "/media/14715/landscape_powerband_high_to_low_woodchop_step1.jpg";
                imgExercise3.ImageUrl = "/media/14689/landscape_powerband_pallof_press_step1.jpg";

                lblExercise1.Text = "Side plank";
                lblExercise2.Text = "Powerband high to low woodchop";
                lblExercise3.Text = "Powerband pallof press";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Ab-circles');
                    $('#exerciseModal2').load('/exercise/Cable-low-to-high-woodchop');
                    $('#exerciseModal3').load('/exercise/Cable-pallof-press');";
                imgExercise1.ImageUrl = "/media/15145/landscape_ab_circles.jpg";
                imgExercise2.ImageUrl = "/media/15123/landscape_cable_woodchop-low_to_high_step1.jpg";
                imgExercise3.ImageUrl = "/media/15106/landscape_cable_pallof_press_step1.jpg";

                lblExercise1.Text = "Ab circles";
                lblExercise2.Text = "Cable low to high woodchop";
                lblExercise3.Text = "Cable pallof press";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
Example #16
0
 protected void ShowNewPlan(PrizeExercisePlan plan, MemberExercisePlan myPlan)
 {
     //if (myPlan.StartDate != null)
     //    lblPlan.Text = dbAccess.GetPlanName(plan);   //plan.PlanName +" Start on " + PrizeCommonUtils.ParseDateTime((DateTime)myPlan.StartDate);
 }
Example #17
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string PaymentURL = "";

        if (!IsPostBack)
        {
            string sProgram  = Request.QueryString["program"];
            string sLocation = Request.QueryString["location"];
            string sLevel    = Request.QueryString["level"];
            string sExp      = Request.QueryString["experience"];

            string sPlanId   = Request.QueryString["targetplanid"];
            string sMyPlanId = Request.QueryString["targetmemberplanid"];

            PaymentURL = Request.QueryString["paymenturl"];

            if (Request.UrlReferrer != null)
            {
                string referer = Request.UrlReferrer.ToString();
                if (referer.Contains("signup") || referer.Contains("continue"))
                {
                    lblMsg.Text = "Please review your details and click one of the payment options below.";
                }
                else
                {
                    lblMsg.Text = "Whoops, you've missed the payment step. Please click Pay with PayPal button below.";
                }
            }
            var member = PrizeMemberAuthUtils.GetMemberData();
            txtFirstName.Text    = member.Firstname;
            tbLastName.Text      = member.Surname;
            txtEmail.Text        = member.Email;
            tbMobile.Text        = member.Mobile;
            tbPhone.Text         = member.Phone;
            tbStreetAddress.Text = member.StreetAddress;
            tbSuburb.Text        = member.Suburb;
            tbState.Text         = member.State;
            ddCountry.Text       = member.Country;
            tbPostCode.Text      = member.Postcode;

            ddlProgram.Text  = sProgram;
            ddlLocation.Text = sLocation;
            //ddlQ3.Text = member.Questions;
            //PrizeMemberAuthUtils.GetMemberAnswer(member, 3);
            //ddlQ4.Text = "test " + member.Email;

            IsTrial = false;
            if (Request.QueryString["Trial"] != null && Request.QueryString["Trial"].Equals("1"))
            {
                IsTrial = true;
            }
            int newPlanId = 0;
            MemberExercisePlan     myPlan      = new MemberExercisePlan();
            PrizeExercisePlan      prizePlan   = new PrizeExercisePlan();
            double                 nPrize      = 0;
            PrizeMemberPlanManager planManager = new PrizeMemberPlanManager();
            int ret;
            if (String.IsNullOrEmpty(sMyPlanId))
            {
                if (String.IsNullOrEmpty(sPlanId))
                {
                    newPlanId = planManager.FindNewPlan(sProgram, sLocation, sLevel, sExp, IsTrial);
                    if (newPlanId < 0)
                    {
                        //throw new Exception("ERROR: could not find the plan " + PrizeErrorCode.getErrorMessage(newPlanId));
                        this.btnPayFully.Enabled  = false;
                        this.btnPayWeekly.Enabled = false;
                        Response.Write("<script>alert('There is no new plan suitable for you.');</script>");
                        return;
                    }
                }
                else
                {
                    newPlanId = int.Parse(sPlanId);
                }
                ret = planManager.BuyNewPlan(newPlanId, ref prizePlan, ref myPlan);
            }
            else
            {
                if (String.IsNullOrEmpty(sPlanId))
                {
                    ret = -1;
                }
                else
                {
                    prizePlan = dbAccess.GetExercisePlan(int.Parse(sPlanId));
                    myPlan    = dbAccess.GetMemberExercisePlan(int.Parse(sMyPlanId));
                    ret       = 0;
                }
            }

            if (ret < 0)
            {
                throw new Exception("ERROR: error for buying plan " + ret);
            }
            else
            {
                ShowNewPlan(prizePlan, myPlan);
                Session["buying_plan_name"]  = prizePlan.PlanName;
                Session["buying_my_plan_id"] = myPlan.Id;
                Session["buying_plan_id"]    = myPlan.ExercisePlanId;
                if (prizePlan.Price > 0)
                {
                    Session["payment_amt"] = prizePlan.Price;
                }
                else
                {
                    Session["payment_amt"] = PrizeConstants.GENERAL_PLAN_PRIZE;
                }
            }
        }
        if (IsTrial)
        {
            this.btnPayWeekly.Visible = false;
        }
    }
Example #18
0
    public PrizeExercisePlan GetNextExercisePlan(PrizeExercisePlan finishedPlan)
    {
        try
        {
            int programSeq  = 1;
            int expSeq      = 1;
            int levelSeq    = 1;
            int locationSeq = 1;
            int locationId;
            db.Database.Connection.Open();
            PrizePlanProgram    program;
            PrizePlanExperience exp;
            PrizePlanLevel      lvl;
            PrizePlanLocation   location;

            bool bUpgraded = false;

            location = (from c in db.PrizePlanLocations
                        orderby c.Sequence
                        select c).FirstOrDefault();
            locationId = location.Id;

            if (finishedPlan != null)
            {
                if (finishedPlan.IsTrialPlan == 0)
                {
                    exp = (from c in db.PrizePlanExperiences
                           where c.Id == finishedPlan.ExperienceId
                           select c).FirstOrDefault();
                    if (exp.Sequence < db.PrizePlanExperiences.Count())
                    {
                        expSeq    = exp.Sequence + 1;
                        bUpgraded = false;
                    }
                    else
                    {
                        expSeq    = 1;
                        bUpgraded = true;
                    }

                    lvl = (from c in db.PrizePlanLevels
                           where c.Id == finishedPlan.LevelId
                           select c).FirstOrDefault();
                    if (!bUpgraded)
                    {
                        levelSeq = lvl.Sequence;
                    }
                    else
                    {
                        if (lvl.Sequence < db.PrizePlanLevels.Count())
                        {
                            levelSeq  = lvl.Sequence + 1;
                            bUpgraded = false;
                        }
                        else
                        {
                            levelSeq  = 1;
                            bUpgraded = true;
                        }
                    }

                    program = (from c in db.PrizePlanPrograms
                               where c.Id == finishedPlan.ProgramId
                               select c).FirstOrDefault();
                    if (!bUpgraded)
                    {
                        programSeq = program.Sequence;
                    }
                    else
                    {
                        if (program.Sequence < db.PrizePlanPrograms.Count())
                        {
                            programSeq = program.Sequence + 1;
                            bUpgraded  = false;
                        }
                    }

                    locationId = finishedPlan.LocationId;
                }
            }

            program = (from c in db.PrizePlanPrograms
                       where c.Sequence == programSeq
                       select c).FirstOrDefault();

            exp = (from c in db.PrizePlanExperiences
                   where c.Sequence == expSeq
                   select c).FirstOrDefault();

            lvl = (from c in db.PrizePlanLevels
                   where c.Sequence == levelSeq
                   select c).FirstOrDefault();



            PrizeExercisePlan nextPlan = (from c in db.PrizeExercisePlans
                                          where c.LocationId == locationId && c.ProgramId == program.Id && c.ExperienceId == exp.Id && c.LevelId == lvl.Id &&
                                          c.IsTrialPlan == 0
                                          select c).FirstOrDefault();

            return(nextPlan);
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/squat');
                    $('#exerciseModal2').load('/exercise/powerband-front-squat');
                    $('#exerciseModal3').load('/exercise/powerband-back-squat');";
                imgExercise1.ImageUrl = "/media/15196/landscape_bw_squat_step1.jpg";
                imgExercise2.ImageUrl = "/media/14724/landscape_powerband_front_raise_step1.jpg";
                imgExercise3.ImageUrl = "/media/14739/landscape_powerband_back_squat_step1.jpg";

                lblExercise1.Text = "BW squat";
                lblExercise2.Text = "Powerband front squat";
                lblExercise3.Text = "Powerband back squat";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/squat');
                    $('#exerciseModal2').load('/exercise/bb-back-squat');
                    $('#exerciseModal3').load('/exercise/bb-front-squat');";
                imgExercise1.ImageUrl = "/media/15196/landscape_bw_squat_step1.jpg";
                imgExercise2.ImageUrl = "/media/13366/landscape_bb_back_squat_step1.jpg";
                imgExercise3.ImageUrl = "/media/13373/landscape_bb_front_squat_step1.jpg";
                lblExercise1.Text     = "BW squat";
                lblExercise2.Text     = "BB back squat";
                lblExercise3.Text     = "BB front squat";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/squat');
                    $('#exerciseModal2').load('/exercise/bb-pulse-squat');
                    $('#exerciseModal3').load('/exercise/bb-front-squat');";
                imgExercise1.ImageUrl = "/media/15196/landscape_bw_squat_step1.jpg";
                imgExercise2.ImageUrl = "/media/14673/landscape_bb_pulse_squat.jpg";
                imgExercise3.ImageUrl = "/media/13373/landscape_bb_front_squat_step1.jpg";
                lblExercise1.Text     = "BW squat";
                lblExercise2.Text     = "BB pulse squat";
                lblExercise3.Text     = "BB front squat";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/squat');
                    $('#exerciseModal2').load('/exercise/bb-back-squat');
                    $('#exerciseModal3').load('/exercise/bb-front-squat');";
                imgExercise1.ImageUrl = "/media/15196/landscape_bw_squat_step1.jpg";
                imgExercise2.ImageUrl = "/media/13366/landscape_bb_back_squat_step1.jpg";
                imgExercise3.ImageUrl = "/media/13373/landscape_bb_front_squat_step1.jpg";
                lblExercise1.Text     = "BW squat";
                lblExercise2.Text     = "BB back squat";
                lblExercise3.Text     = "BB front squat";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
    protected void Insert(object sender, EventArgs e)
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();
            {
                string pname      = ddlProgram.SelectedItem.Text;
                string plevel     = ddlLevel.SelectedItem.Text;
                string plocation  = ddlLocation.SelectedItem.Text;
                string pexpericen = ddlExperience.SelectedItem.Text;

                PrizePlanProgram planprogram = (from c in db.PrizePlanPrograms
                                                where c.Name == pname
                                                select c).FirstOrDefault();

                int pid = planprogram.Id;


                PrizePlanLocation planlocation = (from d in db.PrizePlanLocations
                                                  where d.Name == plocation
                                                  select d).FirstOrDefault();

                int locationid = planlocation.Id;


                PrizePlanLevel planlevel = (from g in db.PrizePlanLevels
                                            where g.Name == plevel
                                            select g).FirstOrDefault();

                int levelid = planlevel.Id;

                PrizePlanExperience planexperience = (from f in db.PrizePlanExperiences
                                                      where f.Name == pexpericen
                                                      select f).FirstOrDefault();

                int expid = planexperience.Id;

                double dPrice;
                if (!double.TryParse(txtPrice.Text, out dPrice))
                {
                    dPrice = 0;
                }
                PrizeExercisePlan exerciseplan;
                int trialFlag = 0;

                if (cbTrialFlag.Checked)
                {
                    exerciseplan = (
                        from ExercisePlan in db.PrizeExercisePlans
                        join Program in db.PrizePlanPrograms on ExercisePlan.ProgramId equals Program.Id
                        join Location in db.PrizePlanLocations on ExercisePlan.LocationId equals Location.Id
                        join Experience in db.PrizePlanExperiences on ExercisePlan.ExperienceId equals Experience.Id
                        join Level in db.PrizePlanLevels on ExercisePlan.LevelId equals Level.Id
                        where Program.Name == pname &&
                        Level.Name == plevel && Location.Name == plocation && Experience.Name == pexpericen && ExercisePlan.IsTrialPlan == 1
                        select ExercisePlan).FirstOrDefault();
                    trialFlag = 1;
                }
                else
                {
                    exerciseplan = (
                        from ExercisePlan in db.PrizeExercisePlans
                        join Program in db.PrizePlanPrograms on ExercisePlan.ProgramId equals Program.Id
                        join Location in db.PrizePlanLocations on ExercisePlan.LocationId equals Location.Id
                        join Experience in db.PrizePlanExperiences on ExercisePlan.ExperienceId equals Experience.Id
                        join Level in db.PrizePlanLevels on ExercisePlan.LevelId equals Level.Id
                        where Program.Name == pname &&
                        Level.Name == plevel && Location.Name == plocation && Experience.Name == pexpericen && ExercisePlan.IsTrialPlan == 0
                        select ExercisePlan).FirstOrDefault();
                }



                if (exerciseplan != null)
                {
                    string errorText = "Exercise plan already exist!";
                    Response.Write(
                        @"<SCRIPT LANGUAGE=""JavaScript"">alert('" + errorText + "')</SCRIPT>");
                }
                else
                {
                    string planname = ddlProgram.SelectedItem.Text + "_" + ddlLocation.SelectedItem.Text
                                      + "_" + ddlExperience.SelectedItem.Text + "_" + ddlLevel.SelectedItem.Text;
                    PrizeExercisePlan addplan = new PrizeExercisePlan();
                    addplan.PlanName     = planname;
                    addplan.ProgramId    = pid;
                    addplan.LevelId      = levelid;
                    addplan.ExperienceId = expid;
                    addplan.LocationId   = locationid;
                    addplan.Price        = dPrice;
                    addplan.IsTrialPlan  = trialFlag;
                    addplan.Description  = "";
                    db.PrizeExercisePlans.Add(addplan);
                    db.SaveChanges();
                    this.BindGrid();
                    ddlProgram.SelectedIndex    = 0;
                    ddlLocation.SelectedIndex   = 0;
                    ddlLevel.SelectedIndex      = 0;
                    ddlExperience.SelectedIndex = 0;
                }
            }

            //   transaction.Complete();
            db.Database.Connection.Close();
        }
    }
Example #21
0
    protected void LoadMemberDetails()
    {
        string username = member.Firstname + " " + member.Surname;

        this.lblFullName.Text = username;

        lblFirstName.Text = member.Firstname;
        lblLastName.Text  = member.Surname;
        tbFirstName.Text  = member.Firstname;
        tbLastName.Text   = member.Surname;
        lblEmail.Text     = member.Email;
        txtEmail.Text     = member.Email;
        lblGender.Text    = member.Gender;
        RdoGender.Text    = member.Gender;
        if (member.DoB.HasValue)
        {
            txtDob.Text = member.DoB.Value.ToString("dd/MM/yyyy");
            lblDoB.Text = txtDob.Text;
        }
        lblStreetAddress.Text = member.StreetAddress;
        lblSuburb.Text        = member.Suburb;
        lblState.Text         = member.State;
        lblCountry.Text       = member.Country;
        lblPostCode.Text      = member.Postcode;
        lblMobile.Text        = member.Mobile;
        lblPhone.Text         = member.Phone;
        lblWhyDiypt.Text      = member.WhyDIYPT;

        tbStreetAddress.Text = member.StreetAddress;
        tbSuburb.Text        = member.Suburb;
        tbState.Text         = member.State;
        tbCountry.Text       = member.Country;
        tbPostCode.Text      = member.Postcode;
        tbMobile.Text        = member.Mobile;
        tbPhone.Text         = member.Phone;
        tbWhyDiypt.Text      = member.WhyDIYPT;

        PrizeDataAccess    dbAccess = new PrizeDataAccess();
        MemberExercisePlan myPlan   = dbAccess.GetCurrentMemberPlanOrStartingPlan(member.UmbracoId);

        if (myPlan != null)
        {
            PrizeExercisePlan plan = dbAccess.GetExercisePlan(myPlan.ExercisePlanId);
            lblGoalDec.Text = plan.PrizePlanProgram.Name;
            tbGoalDec.Text  = plan.PrizePlanProgram.Name;

            var      planName  = dbAccess.GetPlanName(plan);
            string[] sPlanName = planName.Split('_');
            //lblProg.Text = sPlanName[0];
            //lblSem.Text = sPlanName[3].Replace("Semester", "");
            //lblLvl.Text = sPlanName[2];
            //lblLoc.Text = sPlanName[1];
            //ddlLocation.Text = sPlanName[1];

            lblLevel.Text    = sPlanName[2];
            lblLocation.Text = sPlanName[1];
            lblSemester.Text = sPlanName[3].Replace("Semester", "");
        }

        lblFacebook.Text      = member.Facebook;
        lblInstagram.Text     = member.Instagram;
        lblTwitter.Text       = member.Twiter;
        tbFacebook.Text       = member.Facebook;
        tbInstagram.Text      = member.Instagram;
        tbTwitter.Text        = member.Twiter;
        profilePhoto.ImageUrl = member.Photo;

        if (PrizeMemberAuthUtils.GetMemberSetting(member.UserSettings, PrizeConstants.MemberSettings.PromotionalPhoto) == '1')
        {
            cbPromotionalPhoto.Checked  = true;
            lblPromotionalPhoto.Checked = true;
        }
        else
        {
            cbPromotionalPhoto.Checked  = false;
            lblPromotionalPhoto.Checked = false;
        }
    }
Example #22
0
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        if (plan == null)
        {
            return;
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Alternate-lunges');
                    $('#exerciseModal2').load('/exercise/Walking-lunges');
                    $('#exerciseModal3').load('/exercise/Alternating-reverse-lunge');";
                imgExercise1.ImageUrl = "/media/14977/landscape_alternate_lunges_step3.jpg";
                imgExercise2.ImageUrl = "/media/15198/landscape_walking_lunges.jpg";
                imgExercise3.ImageUrl = "/media/14977/landscape_alternate_lunges_step3.jpg";

                lblExercise1.Text = "Alternate lunges";
                lblExercise2.Text = "Walking lunges";
                lblExercise3.Text = "Alternating reverse lunge";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Alternate-lunges');
                    $('#exerciseModal2').load('/exercise/Walking-lunges');
                    $('#exerciseModal3').load('/exercise/Alternating-reverse-lunge');";
                imgExercise1.ImageUrl = "/media/14977/landscape_alternate_lunges_step3.jpg";
                imgExercise2.ImageUrl = "/media/15198/landscape_walking_lunges.jpg";
                imgExercise3.ImageUrl = "/media/14977/landscape_alternate_lunges_step3.jpg";

                lblExercise1.Text = "Alternate lunges";
                lblExercise2.Text = "Walking lunges";
                lblExercise3.Text = "Alternating reverse lunge";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Alternate-lunges');
                    $('#exerciseModal2').load('/exercise/Walking-lunges');
                    $('#exerciseModal3').load('/exercise/side-lunge');";
                imgExercise1.ImageUrl = "//media/14977/landscape_alternate_lunges_step3.jpg";
                imgExercise2.ImageUrl = "/media/15198/landscape_walking_lunges.jpg";
                imgExercise3.ImageUrl = "/media/13771/landscape_side_lunge_step3.jpg";

                lblExercise1.Text = "Alternate lunges";
                lblExercise2.Text = "Walking lunges";
                lblExercise3.Text = "Side lunge";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Alternate-lunges');
                    $('#exerciseModal2').load('/exercise/Walking-lunges');
                    $('#exerciseModal3').load('/exercise/side-lunge');";
                imgExercise1.ImageUrl = "/media/14977/landscape_alternate_lunges_step3.jpg";
                imgExercise2.ImageUrl = "/media/15198/landscape_walking_lunges.jpg";
                imgExercise3.ImageUrl = "/media/13771/landscape_side_lunge_step3.jpg";

                lblExercise1.Text = "Alternate lunges";
                lblExercise2.Text = "Walking lunges";
                lblExercise3.Text = "Side lunge";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
Example #23
0
    private void BindGrid()
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();
            {
                var languages = from a in db.MemberPlanWeekResults
                                join b in db.PrizeMembers on a.MemberId equals b.UmbracoId
                                join c in db.MemberExercisePlanWeeks on a.MemberExercisePlanWeekId equals c.Id
                                join d in db.MemberExercisePlans on c.MemberExercisePlanId equals d.Id
                                join e in db.PrizeExercisePlans on d.ExercisePlanId equals e.Id
                                where a.MemberId == memberId && d.Status.EndsWith("P")
                                orderby d.StartDate descending, c.StartDate
                    select new
                {
                    Memberid     = a.MemberId,
                    Firstname    = b.Firstname,
                    Surname      = b.Surname,
                    Week         = c.Week,
                    Status       = c.Status,
                    StartDate    = c.StartDate,
                    EndDate      = c.EndDate,
                    PlanName     = e.PlanName,
                    EndWeight    = a.EndWeight,
                    EndWaist     = a.EndWaist,
                    EndBodyFat   = a.EndBodyFat,
                    EndChest     = a.EndChest,
                    EndHip       = a.EndHip,
                    EndHeartRate = a.EndHeartRate,
                    FrontPhoto   = a.FrontPhoto,
                    BackPhoto    = a.BackPhoto,
                    SidePhoto    = a.SidePhoto,
                    Tasks        = a.Tasks,
                };

                GridView1.DataSource = languages.ToList();

                GridView1.DataBind();

                MemberExercisePlan     myPlan     = null;
                MemberExercisePlanWeek myPlanWeek = null;
                if (Session["MPID"] != null)
                {
                    int mPlanId = Convert.ToInt32(Session["MPID"]);
                    myPlan = dbAccess.GetMemberExercisePlan(mPlanId);
                }
                else
                {
                    myPlan     = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);
                    myPlanWeek = dbAccess.GetCurrentMemberPlanWeek(memberId);
                }

                this.btnSave.Enabled = false;
                if (myPlan != null)
                {
                    this.btnSave.Enabled = true;
                    var memberPlanWeeks = from a in db.MemberExercisePlanWeeks
                                          where a.MemberExercisePlanId == myPlan.Id
                                          orderby a.Week
                                          select new
                    {
                        WeekText = a.Week,
                        WeekNum  = a.Week
                    };
                    ddlWeek.DataValueField = "WeekNum";
                    ddlWeek.DataTextField  = "WeekText";
                    ddlWeek.DataSource     = memberPlanWeeks.ToList();
                    ddlWeek.DataBind();
                    int weekNum = -1;
                    if (myPlanWeek != null)
                    {
                        weekNum = myPlanWeek.Week;
                    }

                    PrizeExercisePlan plan = dbAccess.GetExercisePlan(myPlan.ExercisePlanId);

                    lblPlanInfo.Text = "Plan " + plan.PlanName + " from " + PrizeCommonUtils.ParseDateToEnglish(myPlan.StartDate) + " to " + PrizeCommonUtils.ParseDateToEnglish(myPlan.EndDate.Value);
                    LoadFoodPlanWeek(memberId, myPlan, weekNum);
                }
            }
            db.Database.Connection.Close();
        }
    }
Example #24
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];
                    }
                }
            }
        }
    }
    public int BuyNewPlan(int newPlanId, ref PrizeExercisePlan prizePlan, ref MemberExercisePlan newMemberPlan)
    {
        DIYPTEntities db = new DIYPTEntities();

        try
        {
            if (PrizeMemberAuthUtils.CurrentUserLogin() != true)
            {
                return(PrizeErrorCode.ERROR_NOT_LOGGED_IN);
            }
            int memberId = PrizeMemberAuthUtils.GetMemberID();

            db.Database.Connection.Open();

            PrizeExercisePlan plan = (from c in db.PrizeExercisePlans
                                      where c.Id == newPlanId
                                      select c).FirstOrDefault();

            if (plan == null)
            {
                return(-1);
            }

            //using (TransactionScope transaction = new TransactionScope())
            //{
            if (plan == null)
            {
                return(PrizeErrorCode.ERROR_PLAN_NOT_EXIST);
            }

            MemberExercisePlan myExistingPaidPlan = (from c in db.MemberExercisePlans
                                                     where c.MemberId == memberId &&
                                                     (c.Status.Equals(PrizeConstants.STATUS_PLAN_STARTED + PrizeConstants.STATUS_PLAN_PAID) ||
                                                      c.Status.Equals(PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_PAID))
                                                     orderby c.EndDate descending
                                                     select c).FirstOrDefault();
            DateTime currentEndDate;
            if (myExistingPaidPlan != null)
            {
                currentEndDate = myExistingPaidPlan.EndDate.Value;
            }
            else
            {
                currentEndDate = PrizeCommonUtils.GetSystemDate();
            }

            List <MemberExercisePlan> myNotPaidPlans = (from c in db.MemberExercisePlans
                                                        where c.MemberId == memberId && (c.Status.EndsWith(PrizeConstants.STATUS_PLAN_NOT_PAID) || c.Status.EndsWith(PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT))
                                                        select c).ToList();

            foreach (MemberExercisePlan notPaidPlan in myNotPaidPlans)
            {
                IQueryable <MemberExercisePlanWeek> notPaidPlanWeeks = (from c in db.MemberExercisePlanWeeks
                                                                        where c.MemberExercisePlanId == notPaidPlan.Id
                                                                        select c);
                foreach (var week in notPaidPlanWeeks)
                {
                    MemberPlanWeekResult weekResult = (from c in db.MemberPlanWeekResults
                                                       where c.MemberExercisePlanWeekId == week.Id
                                                       select c).SingleOrDefault();
                    db.MemberExercisePlanWeeks.Remove(week);
                    db.MemberPlanWeekResults.Remove(weekResult);
                }
                notPaidPlan.Status = PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_PAYMENT_CANCELLED;

                List <MemberManualPayment> manualPayments = (from c in db.MemberManualPayments
                                                             where c.MemberExercisePlanId == notPaidPlan.Id && c.Status.StartsWith(PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_NOT_APPROVED)
                                                             select c).ToList();
                foreach (var notPaidRecord in manualPayments)
                {
                    db.MemberManualPayments.Remove(notPaidRecord);
                    db.SaveChanges();
                }
            }
            db.SaveChanges();

            DateTime startDate = PrizeCommonUtils.GetNextWeekStart(currentEndDate);
            DateTime endDate   = PrizeCommonUtils.GetWeekEnd(startDate);

            MemberExercisePlan myPlan = new MemberExercisePlan();
            myPlan.MemberId       = memberId;
            myPlan.ExercisePlanId = plan.Id;
            myPlan.StartDate      = startDate;
            myPlan.Status         = PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_NOT_PAID;              //Not paid
            db.MemberExercisePlans.Add(myPlan);
            db.SaveChanges();
            MemberPlanWeekResult myWeekResult;

            if (plan.IsTrialPlan != 1)
            {
                MemberExercisePlanWeek myPlanWeekOrientation = new MemberExercisePlanWeek();
                myPlanWeekOrientation.MemberExercisePlanId = myPlan.Id;
                myPlanWeekOrientation.ExercisePlanWeekId   = 0;
                myPlanWeekOrientation.MemberId             = memberId;
                myPlanWeekOrientation.StartDate            = startDate;
                myPlanWeekOrientation.EndDate = endDate;
                myPlanWeekOrientation.Status  = PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED;
                myPlanWeekOrientation.Week    = 0;
                db.MemberExercisePlanWeeks.Add(myPlanWeekOrientation);
                db.SaveChanges();

                myWeekResult          = new MemberPlanWeekResult();
                myWeekResult.MemberId = memberId;
                myWeekResult.MemberExercisePlanWeekId = myPlanWeekOrientation.Id;
                InitialiseWeekResult(ref myWeekResult);
                db.MemberPlanWeekResults.Add(myWeekResult);
                db.SaveChanges();
                myPlan.EndDate = endDate;
                startDate      = startDate.AddDays(7);
                endDate        = endDate.AddDays(7);
            }

            IList <PrizeExercisePlanWeek> planWeeks = plan.PrizeExercisePlanWeeks.OrderBy(s => s.StartWeek).ToList();
            foreach (PrizeExercisePlanWeek planWeek in planWeeks)
            {
                for (int i = planWeek.StartWeek; i <= planWeek.EndWeek; i++)
                {
                    MemberExercisePlanWeek myPlanWeek = new MemberExercisePlanWeek();
                    myPlanWeek.MemberExercisePlanId = myPlan.Id;
                    myPlanWeek.ExercisePlanWeekId   = planWeek.Id;
                    myPlanWeek.MemberId             = memberId;
                    myPlanWeek.StartDate            = startDate;
                    myPlanWeek.EndDate = endDate;
                    myPlanWeek.Status  = PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED;
                    myPlanWeek.Week    = i;
                    db.MemberExercisePlanWeeks.Add(myPlanWeek);
                    db.SaveChanges();

                    myWeekResult          = new MemberPlanWeekResult();
                    myWeekResult.MemberId = memberId;
                    myWeekResult.MemberExercisePlanWeekId = myPlanWeek.Id;
                    InitialiseWeekResult(ref myWeekResult);
                    db.MemberPlanWeekResults.Add(myWeekResult);
                    myPlan.EndDate = endDate;
                    db.SaveChanges();

                    startDate = startDate.AddDays(7);
                    endDate   = endDate.AddDays(7);
                }
            }

            //transaction.Complete();
            newMemberPlan = myPlan;
            prizePlan     = plan;

            return(newPlanId);
            //}
        }
        finally
        {
            db.Dispose();
        }
    }
    public bool ChangeMemberPlan(int myPlanId, int targetPlanId)
    {
        bool          ret = false;
        DIYPTEntities db  = new DIYPTEntities();

        try
        {
            db.Database.Connection.Open();

            MemberExercisePlan myPlan = (from c in db.MemberExercisePlans
                                         where c.Id == myPlanId
                                         select c).FirstOrDefault();
            if (myPlan == null)
            {
                return(ret);
            }

            PrizeExercisePlan plan = (from c in db.PrizeExercisePlans
                                      where c.Id == myPlan.ExercisePlanId
                                      select c).FirstOrDefault();

            if (plan == null)
            {
                return(ret);
            }

            PrizeExercisePlan targetPlan;
            if (plan.IsTrialPlan == 1)
            {
                targetPlan = (from c in db.PrizeExercisePlans
                              where c.Id == targetPlanId && c.IsTrialPlan == 1
                              select c).FirstOrDefault();
            }
            else
            {
                targetPlan = (from c in db.PrizeExercisePlans
                              where c.Id == targetPlanId && c.IsTrialPlan == 0
                              select c).FirstOrDefault();
            }

            if (targetPlan == null)
            {
                return(ret);
            }

            IQueryable <PrizeExercisePlanWeek> targetPlanWeeks = (from c in db.PrizeExercisePlanWeeks
                                                                  where c.ExercisePlanId == targetPlan.Id
                                                                  orderby c.StartWeek
                                                                  select c);

            foreach (var targetPlanWeek in targetPlanWeeks)
            {
                IQueryable <MemberExercisePlanWeek> myPlanWeeks = (from c in db.MemberExercisePlanWeeks
                                                                   join d in db.PrizeExercisePlanWeeks on c.ExercisePlanWeekId equals d.Id
                                                                   where c.MemberExercisePlanId == myPlan.Id && c.Week >= targetPlanWeek.StartWeek && c.Week <= targetPlanWeek.EndWeek
                                                                   select c);
                foreach (var myPlanWeek in myPlanWeeks)
                {
                    myPlanWeek.ExercisePlanWeekId = targetPlanWeek.Id;
                }
            }

            myPlan.ExercisePlanId = targetPlan.Id;

            db.SaveChanges();

            return(true);
        }
        catch
        {
            return(false);
        }
        finally
        {
            db.Dispose();
        }
    }
Example #27
0
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        if (plan == null)
        {
            return;
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Powerband-low-row');
                    $('#exerciseModal2').load('/exercise/Powerband-high-row');
                    $('#exerciseModal3').load('/exercise/Powerband-bent-over-row');";
                imgExercise1.ImageUrl = "/media/14692/landscape_powerband_low_row_step1.jpg";
                imgExercise2.ImageUrl = "/media/14695/landscape_powerband_high_row_step1.jpg";
                imgExercise3.ImageUrl = "/media/14736/landscape_powerband_bent_over_row_step1.jpg";

                lblExercise1.Text = "Powerband low row";
                lblExercise2.Text = "Powerband high row";
                lblExercise3.Text = "Powerband bent over row";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/seated-row');
                    $('#exerciseModal2').load('/exercise/lat-pulldown');
                    $('#exerciseModal3').load('/exercise/Assisted-Powerband-pullups');";
                imgExercise1.ImageUrl = "/media/14705/landscape_seated_row_step1.jpg";
                imgExercise2.ImageUrl = "/media/15138/landscape_lat_pulldown_step1.jpg";
                imgExercise3.ImageUrl = "/media/15073/landscape_assisted_powerband_pullups_step1.jpg";
                lblExercise1.Text     = "Seated row NG";
                lblExercise2.Text     = "Lat pulldown machine";
                lblExercise3.Text     = "Assisted Powerband pullups";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Powerband-high-row');
                    $('#exerciseModal2').load('/exercise/Powerband-bent-over-row');
                    $('#exerciseModal3').load('/exercise/Powerband-lat-pulldown');";
                imgExercise1.ImageUrl = "/media/14695/landscape_powerband_high_row_step1.jpg";
                imgExercise2.ImageUrl = "/media/14736/landscape_powerband_bent_over_row_step1.jpg";
                imgExercise3.ImageUrl = "/media/15054/landscape_powerband_lat_pulldown_step1.jpg";
                lblExercise1.Text     = "Powerband high row";
                lblExercise2.Text     = "Powerband bent over row";
                lblExercise3.Text     = "Powerband lat pulldown";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/seated-row');
                    $('#exerciseModal2').load('/exercise/lat-pulldown');
                    $('#exerciseModal3').load('/exercise/Pullup-negatives');";
                imgExercise1.ImageUrl = "/media/14705/landscape_seated_row_step1.jpg";
                imgExercise2.ImageUrl = "/media/15138/landscape_lat_pulldown_step1.jpg";
                imgExercise3.ImageUrl = "/media/14787/landscape_pullup_negatives_step1w.jpg";
                lblExercise1.Text     = "Seated row";
                lblExercise2.Text     = "Lat pulldown machine";
                lblExercise3.Text     = "Pullup negatives";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
Example #28
0
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        if (plan == null)
        {
            return;
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/powerband-deadlift');
                    $('#exerciseModal2').load('/exercise/powerband-sumo-deadlift');
                    $('#exerciseModal3').load('/exercise/bb-deadlift');";
                imgExercise1.ImageUrl = "/media/14727/landscape_powerband_deadlift_step1.jpg";
                imgExercise2.ImageUrl = "/media/14762/landscape_powerband_sumo_deadlift_step1.jpg";
                imgExercise3.ImageUrl = "/media/14998/landscape_bb_deadlift_step1.jpg";

                lblExercise1.Text = "Powerband deadlift";
                lblExercise2.Text = "Powerband sumo deadlift";
                lblExercise3.Text = "BB deadlift";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/KB-deadlift');
                    $('#exerciseModal2').load('/exercise/bb-deadlift');
                    $('#exerciseModal3').load('/exercise/powerband-sumo-deadlift');";
                imgExercise1.ImageUrl = "/media/13939/landscape_kettlebell_deadlift_step1.jpg";
                imgExercise2.ImageUrl = "/media/14998/landscape_bb_deadlift_step1.jpg";
                imgExercise3.ImageUrl = "/media/14992/landscape_bb_sumo_deadlift_step1.jpg";
                lblExercise1.Text     = "KB deadlift";
                lblExercise2.Text     = "BB deadlift";
                lblExercise3.Text     = "BB sumo deadlift";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/powerband-deadlift');
                    $('#exerciseModal2').load('/exercise/Powerband-good-morning');
                    $('#exerciseModal3').load('/exercise/bb-deadlift');";
                imgExercise1.ImageUrl = "/media/14727/landscape_powerband_deadlift_step1.jpg";
                imgExercise2.ImageUrl = "/media/14768/landscape_powerband_good_morning_step1.jpg";
                imgExercise3.ImageUrl = "/media/14998/landscape_bb_deadlift_step1.jpg";
                lblExercise1.Text     = "Powerband deadlift";
                lblExercise2.Text     = "Powerband good morning";
                lblExercise3.Text     = "BB deadlift";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/bb-rack-pull');
                    $('#exerciseModal2').load('/exercise/bb-deadlift');
                    $('#exerciseModal3').load('/exercise/bb-stiff-leg-deadlift');";
                imgExercise1.ImageUrl = "/media/13967/landscape_rack_pull_step1.jpg";
                imgExercise2.ImageUrl = "/media/14998/landscape_bb_deadlift_step1.jpg";
                imgExercise3.ImageUrl = "/media/15085/landscape_bb_stiff_leg_deadlift_step1.jpg";
                lblExercise1.Text     = "Rack pull";
                lblExercise2.Text     = "BB deadlift";
                lblExercise3.Text     = "BB stiff leg deadlift";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
Example #29
0
    private void DisplayExercise()
    {
        string            tempScript = "<script>";
        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);
            }
        }

        if (plan == null)
        {
            return;
        }

        var acc         = new PrizeDataAccess();
        var planDetails = acc.GetPlanName(plan);
        var planArray   = planDetails.Split('_');

        switch (planArray[0])
        {
        case "Lose Weight":
        case "Tone Up":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/pushups-on-knees');
                    $('#exerciseModal2').load('/exercise/powerband-push-press');
                    $('#exerciseModal3').load('/exercise/powerband-pushup-on-knees');";
                imgExercise1.ImageUrl = "/media/13400/landscape_pushup_on_knees_step1.jpg";
                imgExercise2.ImageUrl = "/media/14686/landscape_powerband_push_press_step1.jpg";
                imgExercise3.ImageUrl = "/media/15048/landscape_powerband_pushup_on_knees.jpg";

                lblExercise1.Text = "Pushups on knees";
                lblExercise2.Text = "Powerband push press";
                lblExercise3.Text = "Powerband pushup on knees";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/pushups-on-knees');
                    $('#exerciseModal2').load('/exercise/bb-strict-press');
                    $('#exerciseModal3').load('/exercise/bb-push-press');";
                imgExercise1.ImageUrl = "/media/13400/landscape_pushup_on_knees_step1.jpg";
                imgExercise2.ImageUrl = "/media/13358/landscape_bb_strict_press_step1.jpg";
                imgExercise3.ImageUrl = "/media/13357/landscape_bb_push_press_step1.jpg";
                lblExercise1.Text     = "Push ups on knees";
                lblExercise2.Text     = "BB strict press";
                lblExercise3.Text     = "BB push press";
            }
            break;

        case "Build Muscle":
            if (planArray[1] == "Home")
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/powerband-push-press');
                    $('#exerciseModal2').load('/exercise/Powerband-floor-chest-press');
                    $('#exerciseModal3').load('/exercise/Powerband-pushup-on-toes');";
                imgExercise1.ImageUrl = "/media/14686/landscape_powerband_push_press_step1.jpg";
                imgExercise2.ImageUrl = "/media/15015/landscape_powerband_floor_chest_press_step1.jpg";
                imgExercise3.ImageUrl = "/media/15049/landscape_powerband-_pushup_on_toes.jpg";
                lblExercise1.Text     = "Powerband push press";
                lblExercise2.Text     = "Powerband floor chest press";
                lblExercise3.Text     = "Powerband pushup on toes";
            }
            else
            {
                tempScript           += @"$('#exerciseModal1').load('/exercise/Pushups-on-toes');
                    $('#exerciseModal2').load('/exercise/BB-flat-bench-press');
                    $('#exerciseModal3').load('/exercise/BB-incline-bench-press');";
                imgExercise1.ImageUrl = "/media/13403/landscape_pushup_on_toes_step1.jpg";
                imgExercise2.ImageUrl = "/media/13331/landscape_bb_flat_bench_press_step1.jpg";
                imgExercise3.ImageUrl = "/media/13328/landscape_bb_incline_bench_press_step1.jpg";
                lblExercise1.Text     = "Pushups on toes";
                lblExercise2.Text     = "BB flat bench press";
                lblExercise3.Text     = "BB incline bench press";
            }
            break;

        default:
            break;
        }
        tempScript += "</script>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "modalPopup", tempScript, false);
    }
Example #30
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)";
                }
            }
        }
    }