Example #1
0
    protected void btnChangePlan_Click(object sender, EventArgs e)
    {
        int targetPlanId = 0;

        int.TryParse(ddlPlan.SelectedItem.Value, out targetPlanId);
        PrizeMemberPlanManager man      = new PrizeMemberPlanManager();
        PrizeDataAccess        dbAccess = new PrizeDataAccess();
        MemberExercisePlan     myPlan   = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);

        if (myPlan == null)
        {
            Response.Write("<script>alert('Can't find the user's plan.');</script>");
        }
        else
        {
            if (!man.ChangeMemberPlan(myPlan.Id, targetPlanId))
            {
                Response.Write("<script>alert('The level of the current program not in the database.');</script>");
            }
            else
            {
                Response.Write("<script>alert('The user's program has been changed to " + ddlPlan.SelectedItem.Text + ");</script>");
            }
        }
        this.BindGrid();
    }
Example #2
0
    public static DateTime GetOrientationDate(int day)
    {
        PrizeDataAccess db           = new PrizeDataAccess();
        var             exercisePlan = db.GetCurrentMemberPlanOrStartingPlan(PrizeMemberAuthUtils.GetMemberID());
        var             nextMonday   = exercisePlan.StartDate;//.Next(DayOfWeek.Monday);

        return(nextMonday.AddDays(day - 1));
    }
Example #3
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 #4
0
    protected void btnPauseResume_Click(object sender, EventArgs e)
    {
        PrizeDataAccess dbAccess = new PrizeDataAccess();

        if (this.ddlPauseResume.Text.Equals("Pause"))
        {
            MemberExercisePlan     myPlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);
            PrizeMemberPlanManager man    = new PrizeMemberPlanManager();
            if (myPlan == null)
            {
                Response.Write("<script>alert('Can't find the user's available plan.');</script>");
            }
            else
            {
                if (!man.PauseMemberPlan(myPlan.Id))
                {
                    Response.Write("<script>alert('Error happens when pausing the plan.');</script>");
                }
                else
                {
                    Response.Write("<script>alert('The plan is paused);</script>");
                }
            }
        }
        else if (this.ddlPauseResume.Text.Equals("Resume"))
        {
            MemberExercisePlan     myPlan = dbAccess.GetCurrentMemberPausedPlan(memberId);
            PrizeMemberPlanManager man    = new PrizeMemberPlanManager();
            if (myPlan == null)
            {
                Response.Write("<script>alert('Can't find the user's paused plan.');</script>");
            }
            else
            {
                if (!man.ResumeMemberPlan(myPlan.Id))
                {
                    Response.Write("<script>alert('Error happens when resuming the plan.');</script>");
                }
                else
                {
                    Response.Write("<script>alert('The plan is resumed);</script>");
                }
            }
        }
        this.BindGrid();
        return;
    }
Example #5
0
    private void FillDate()
    {
        //DateTime tempdate = new DateTime(2017, 1, 10);
        //var nextSunday = tempdate.Next(DayOfWeek.Sunday);
        PrizeDataAccess db = new PrizeDataAccess();

        var exercisePlan = db.GetCurrentMemberPlanOrStartingPlan(PrizeMemberAuthUtils.GetMemberID());

        //var nextSunday = exercisePlan.StartDate.NextDay(DayOfWeek.Monday);
        if (exercisePlan == null)
        {
            return;
        }

        //var nextSunday = exercisePlan.StartDate.NextDay(DayOfWeek.Sunday);

        var nextSunday = exercisePlan.StartDate;
        int counter    = 0;

        for (int i = 0; i < 14; i++)
        {
            Label dateLabel = this.FindControl(string.Format("week{0}Date", i)) as Label;
            if (dateLabel != null)
            {
                dateLabel.Text = nextSunday.AddDays((i - 1) * 7).Date.ToString("dd/MM") + "-" + nextSunday.AddDays((i * 7) - 1).Date.ToString("dd/MM");
            }
            for (int d = 1; d <= 7; d++)
            {
                if (nextSunday.AddDays(counter).Date == PrizeCommonUtils.GetSystemDate().Date)
                {
                    HtmlTableCell tempLabel = this.FindControl(string.Format("w{0}d{1}", i, d)) as HtmlTableCell;
                    if (tempLabel != null)
                    {
                        tempLabel.Attributes.Add("class", tempLabel.Attributes["class"] + " active");
                    }
                }
                //Label tempLabel = this.FindControl(string.Format("week{0}_{1}", i, d)) as Label;
                //if (tempLabel != null)
                //    tempLabel.Text = nextSunday.AddDays(counter).ToString("dd/M");
                counter++;
            }
        }
    }
Example #6
0
    protected void btnChangeLevel_Click(object sender, EventArgs e)
    {
        var sTargetLevel                = ddlLevel.SelectedItem.Text;
        PrizeMemberPlanManager man      = new PrizeMemberPlanManager();
        PrizeDataAccess        dbAccess = new PrizeDataAccess();
        MemberExercisePlan     myPlan   = dbAccess.GetCurrentMemberPlanOrStartingPlan(memberId);

        if (myPlan == null)
        {
            Response.Write("<script>alert('Can't find the user's plan.');</script>");
        }
        else
        {
            if (!man.ChangeMemberPlanLevel(myPlan.Id, sTargetLevel))
            {
                Response.Write("<script>alert('The level of the current program not in the database.');</script>");
            }
            else
            {
                Response.Write("<script>alert('The user's level has been changed to " + sTargetLevel + ");</script>");
            }
        }
        this.BindGrid();
    }
Example #7
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 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
         *     //Handled in BaseOrientation//
         *     if (PrizeMemberAuthUtils.CurrentUserLogin() != true)
         * return;
         */
        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));
        }
        InitLables();
        //var member = PrizeMemberAuthUtils.GetMemberData();
        //lblTest.Text = member.Questions;


        if (Request["MemberPlanWeekID"] != null)
        {
            int memberPlanWeekId;
            int.TryParse(Request["MemberPlanWeekID"], out memberPlanWeekId);

            memberPlanWeek = dbAccess.GetMemberPlanWeekById(memberPlanWeekId);

            planWeek = dbAccess.GetExercisePlanWeek(memberPlanWeek.ExercisePlanWeekId);
        }
        else
        {
            DateTime now = PrizeCommonUtils.GetSystemDate();

            memberPlanWeek = dbAccess.GetCurrentMemberPlanWeek(memberId); //(MemberExercisePlanWeek)Session["MemberPlanWeek"];
            if (memberPlanWeek == null && PrizeCommonUtils.LessThanDaysAhead(now, exercisePlan.StartDate, 1))
            {
                memberPlanWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(exercisePlan.Id, 0);
            }

            if (memberPlanWeek == null)
            {
                HideLinks();
                topInfo.Visible            = false;
                dayPre.Visible             = false;
                dayNext.Visible            = false;
                dayView.Visible            = false;
                printDay.Visible           = false;
                timesaverDiv.Visible       = false;
                timesaverDivMobile.Visible = false;
                divNotStarted.Visible      = true;
                return;
            }
            divNotStarted.Visible = false;

            planWeek = dbAccess.GetExercisePlanWeek(memberPlanWeek.ExercisePlanWeekId);
        }

        currentPlanWeekId = (int)memberPlanWeek.ExercisePlanWeekId;
        //
        dayView.HRef = dbAccess.GetCurrentDailyViewURL(memberId);
        LoadWeeklyInfo(memberId, planWeek, memberPlanWeek);

        MemberExercisePlan     myPlan   = dbAccess.GetMemberExercisePlan(memberPlanWeek.MemberExercisePlanId);
        MemberExercisePlanWeek prevWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(myPlan.Id, memberPlanWeek.Week - 1);

        if (prevWeek != null)
        {
            dayPre.NavigateUrl = "/my-account/exercise-view?MemberPlanWeekID=" + prevWeek.Id;
            dayPre.Text        = "Week " + (memberPlanWeek.Week - 1);
        }
        else
        {
            dayPre.Attributes.Add("class", "no-arrow");
        }

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

        if (nextWeek != null)
        {
            dayNext.NavigateUrl = "/my-account/exercise-view?MemberPlanWeekID=" + nextWeek.Id;
            dayNext.Text        = "Week " + (memberPlanWeek.Week + 1);
        }
        else
        {
            dayNext.Attributes.Add("class", "no-arrow");
        }
    }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        PrizeDataAccess db       = new PrizeDataAccess();
        int             memberId = PrizeMemberAuthUtils.GetMemberID();
        var             plan     = dbAccess.GetCurrentOrStartingExercisePlanInfo(memberId);

        if (plan != null && plan.IsTrialPlan == 1)
        {
            divTrial.Visible       = true;
            divOrientation.Visible = false;
            divHeader.Visible      = false;
            dayView2.Visible       = false;
            printWeek.Visible      = false;
            return;
        }
        var exercisePlan = db.GetCurrentMemberPlanOrStartingPlan(memberId);

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


        var nextMonday = exercisePlan.StartDate;
        //.Value.Next(DayOfWeek.Monday);
        int    counter   = 0;
        string weekLabel = "";

        //10 April - 17 April, 2017
        for (int d = 1; d <= 7; d++)
        {
            DateTime newDate = nextMonday.AddDays(counter);

            if (newDate.Date == DateTime.Now.Date)
            {
                dayView1.Attributes.Add("href", "/orientation/day-" + d);
                dayView2.Attributes.Add("href", "/orientation/day-" + d);
            }
            if (counter == 0)
            {
                weekLabel += newDate.ToString("d MMMM");
            }

            if (counter == 6)
            {
                weekLabel += " - " + newDate.ToString("d MMMM, yyyy");
            }

            Label tempLabel     = this.FindControl(string.Format("lblDay{0}", d)) as Label;
            Label tempLabelDate = this.FindControl(string.Format("lblDate{0}", d)) as Label;
            if (tempLabel != null)
            {
                tempLabel.Text     = newDate.ToString("d MMMM yyyy");
                tempLabelDate.Text = newDate.ToString("dddd");
            }
            counter++;
        }
        lblWeekly.Text = weekLabel;

        if (!IsPostBack)
        {
            for (int i = 1; i < 7; i++)
            {
                string result      = dbAccess.GetOrientationWeekDayResult(exercisePlan.Id, i);
                string controlName = "";
                for (int j = 1; j <= 10; j++)
                {
                    controlName = "quest" + i + j;
                    HtmlGenericControl c = FindControl(controlName) as HtmlGenericControl;
                    if (c == null)
                    {
                        break;
                    }
                    if (result[j - 1] == '0')
                    //c.Visible = false;
                    {
                        c.Attributes.Add("class", "no-tick-circle");
                        c.InnerText = "x";
                    }
                    else
                    {
                        c.Visible = true;
                    }
                }
            }
        }
    }
Example #10
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];
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        int.TryParse(Request["PlanWeekId"], out iPlanWeekId);
        int.TryParse(Request["PlanDayNumber"], out iDay);
        int.TryParse(Request["MemberPlanWeekId"], out memberPlanWeekId);

        MemberExercisePlanWeek memberPlanWeek = dbAccess.GetMemberPlanWeekById(memberPlanWeekId);

        if (memberPlanWeek != null)
        {
            lblDate.Text = PrizeCommonUtils.ParseDateToEnglish(memberPlanWeek.StartDate.AddDays(iDay - 1));
        }
        lblDayNum.Text      = "" + iDay;
        lblDayTypeName.Text = PrizeConstants.STR_NO_TRAINNING;
        DataSet ds = dbAccess.GetMemberWeeklyInfo(iPlanWeekId);

        foreach (DataRow row in ds.Tables[0].Rows)
        {
            int iWeekDay = (int)row[0];
            if (iWeekDay == iDay)
            {
                lblDayTypeName.Text = (String)row[2];
            }
        }
        if (lblDayTypeName.Text.ToLower() == PrizeConstants.STR_NO_TRAINNING.ToLower())
        {
            divWarmup.Visible = divCooldown.Visible = divLegend.Visible = false;
            divRest.Visible   = true;
        }

        lblDay.Text = PrizeCommonUtils.ParseWeekDayToEnglish(iDay);
        MemberExercisePlan myPlan = dbAccess.GetMemberExercisePlan(memberPlanWeek.MemberExercisePlanId);

        if (iDay > 1)
        {
            preDay.NavigateUrl = (String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, iPlanWeekId, memberPlanWeekId, iDay - 1));
            preDay.Text        = "Previous Day";
        }
        else
        {
            MemberExercisePlanWeek prevWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(myPlan.Id, memberPlanWeek.Week - 1);
            if (prevWeek != null)
            {
                preDay.NavigateUrl = (String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, iPlanWeekId, prevWeek.Id, 7));
                preDay.Text        = "Previous Day";
            }
            else
            {
                preDay.Attributes.Add("class", "no-arrow");
            }
        }

        if (iDay < 7)
        {
            nextDay.NavigateUrl = (String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, iPlanWeekId, memberPlanWeekId, iDay + 1));
            nextDay.Text        = "Next Day";
        }
        else
        {
            MemberExercisePlanWeek nextWeek = dbAccess.GetMemberPlanWeekByMemberPlanAndWeek(myPlan.Id, memberPlanWeek.Week + 1);
            if (nextWeek != null)
            {
                nextDay.NavigateUrl = (String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, iPlanWeekId, nextWeek.Id, 1));
                nextDay.Text        = "Next Day";
            }
            else
            {
                nextDay.Attributes.Add("class", "no-arrow");
            }
        }

        InitPageControls();

        DivAdvanceEquipment.Visible = false;
        PrizeDataAccess db = new PrizeDataAccess();
        var             memberExercisePlan = db.GetCurrentMemberPlanOrStartingPlan(PrizeMemberAuthUtils.GetMemberID());

        if (memberExercisePlan != null)
        {
            var exercisePlan = db.GetExercisePlan(memberExercisePlan.ExercisePlanId);
            if (exercisePlan != null)
            {
                if (exercisePlan.PlanName.ToLower().Contains("home") &&
                    (exercisePlan.PlanName.ToLower().Contains("intermediate")
                     ||
                     exercisePlan.PlanName.ToLower().Contains("advanced"))
                    )
                {
                    DivAdvanceEquipment.Visible = true;
                }
            }
        }
        switch (lblDayTypeName.Text.Trim())
        {
        case "Time to celebrate":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divRest.Visible             = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "30min brisk walk":
        case "Brisk walk":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divWalk.Visible             = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "30-60min weekend physical activity":
        case "Weekend physical activity":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divWeekend.Visible          = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "Own 1hr cardio":
        case "Own training":
        case "Own cardio":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divCardio.Visible           = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "Milestone workout = 20x pushups, squats, situps":
        case "Milestone workout 2":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divSquat.Visible            = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "Milestone workout = 20 pushups & make your bed":
        case "Milestone workout 1":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divPushup.Visible           = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "Measurement day and rest":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            divMeasurement.Visible      = true;
            DivAdvanceEquipment.Visible = false;
            break;

        case "Milestone workout = 20 star jumps & make your bed":
            divWarmup.Visible           = divCooldown.Visible = divLegend.Visible = false;
            DivAdvanceEquipment.Visible = false;
            //divMeasurement.Visible = true;
            break;

        default:
            break;
        }
        LoadDailyInfo(iPlanWeekId, iDay);

        // nextDay.Text = "Next day tuesday";
        // nextDay.NavigateUrl = "/tuesday#?";
    }
Example #12
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 #13
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)";
                }
            }
        }
    }
Example #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        var             planType           = "2";
        string          tempScript         = "<style>";
        PrizeDataAccess db                 = new PrizeDataAccess();
        var             memberExercisePlan = db.GetCurrentMemberPlanOrStartingPlan(PrizeMemberAuthUtils.GetMemberID());

        lblTop.Text    = "WEIGHT BEARING EXERCISES";
        lblMiddle.Text = "WHOLESOME FOODS";
        lblBottom.Text = " REDUCED DOCTOR VISITS";
        //weight
        tempScript += @"
.container-fluid-header { background-image: url('/images/login/lose-weight/hero-lose-weight.jpg');}
@media (max-width:767px) {
.container-fluid-header { background-image: url('/images/login/lose-weight/hero-lose-weight-m.jpg');}
}
";

        if (memberExercisePlan != null)
        {
            var exercisePlan = db.GetExercisePlan(memberExercisePlan.ExercisePlanId);
            if (exercisePlan != null)
            {
                if (exercisePlan.PlanName.ToLower().Contains("weight"))
                {
                    planType = "1";
                }
                if (exercisePlan.PlanName.ToLower().Contains("muscle"))
                {
                    planType = "2";
                }
                if (exercisePlan.PlanName.ToLower().Contains("tone"))
                {
                    planType = "3";
                }
            }
            switch (planType)
            {
            case "1":
                lblTop.Text    = "WEIGHT BEARING EXERCISES";
                lblMiddle.Text = "WHOLESOME FOODS";
                lblBottom.Text = " REDUCED DOCTOR VISITS";
                //weight
                tempScript += @"
.container-fluid-header { background-image: url('/images/login/lose-weight/hero-lose-weight.jpg');}
@media (max-width:767px) {
.container-fluid-header { background-image: url('/images/login/lose-weight/m-hero-lose-weight.jpg');}
}
";
                break;

            case "2":
                lblTop.Text    = "VOLUME";
                lblMiddle.Text = "A MEAL EVERY 3 HOURS";
                lblBottom.Text = " ARNIE ARMS";
                tempScript    += @"
.container-fluid-header { background-image: url('/images/login/build-strength/hero-build-strength.jpg');}
@media (max-width:767px) {
.container-fluid-header { background-image: url('/images/login/build-strength/m-hero-build-strength.jpg');}
}";
                //muscle
                break;

            case "3":
                lblTop.Text    = "MACRO TRACKING";
                lblMiddle.Text = "WEIGHTS BASED TRAINING";
                lblBottom.Text = " STRONGER BODY";
                tempScript    += @"
.container-fluid-header { background-image: url('/images/login/toneup/hero-tone-up.jpg');}

@media (max-width:767px) {
.container-fluid-header { background-image: url('/images/login/toneup/m-hero-tone-up.jpg');}
}

@media (min-width:1560px) {
.container-fluid-header { background-image: url('/images/login/toneup/hero-tone-up.jpg');}
background-size: 1400px; 
}
";
                //tone
                break;

            default:
                break;
            }
        }
        tempScript += "</style>";
        Page.ClientScript.RegisterStartupScript(this.GetType(), "sloganHeadImage", tempScript, false);
    }