protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName != "Start" && e.CommandName != "Terminate") { return; } GridView grid = sender as GridView; GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer); int RowIndex = row.RowIndex; if (e.CommandName == "Start") { string[] args = e.CommandArgument.ToString().Split(new char[] { ',' }); int weeklyPaymentId = Convert.ToInt32(args[0]); int memberPlanId = Convert.ToInt32(args[1]); int orderId = Convert.ToInt32(args[2]); string transaction = (row.FindControl("txtTransactionId") as TextBox).Text; string comment = (row.FindControl("txtComment") as TextBox).Text; PrizeMemberPlanManager man = new PrizeMemberPlanManager(); man.PayMemberManualPayment(weeklyPaymentId, orderId, memberPlanId, transaction, comment); this.BindGridWeeklyPayStart(); } else if (e.CommandName == "Terminate") { string[] args = e.CommandArgument.ToString().Split(new char[] { ',' }); int weeklyPaymentId = Convert.ToInt32(args[0]); int memberPlanId = Convert.ToInt32(args[1]); int orderId = Convert.ToInt32(args[2]); string comment = (row.FindControl("txtComment2") as TextBox).Text; PrizeMemberPlanManager man = new PrizeMemberPlanManager(); man.TerminateMemberManualPaymentPlan(weeklyPaymentId, memberPlanId, comment); this.BindGridWeeklyPayStart(); } }
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(); }
private void DoWeeklyPaymentPlan(string mode) { int memberPlanId = Int32.Parse(Session["buying_my_plan_id"].ToString()); int exercisePlanId = Int32.Parse(Session["buying_plan_id"].ToString()); if (Request.QueryString["Trial"] != null && Request.QueryString["Trial"].Equals("1")) { IsTrial = true; } PrizeMemberPlanManager planManager = new PrizeMemberPlanManager(); planManager.ManualPaymentMemberPlanSetup(PrizeMemberAuthUtils.GetMemberData(), memberPlanId, exercisePlanId, mode); if (mode.Equals(PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_WEEKLY)) { Response.Redirect(PrizeConstants.URL_EZIDEBIT_LOGIN_WEEKLY); } else { if (IsTrial) { Response.Redirect(PrizeConstants.URL_EZIDEBIT_LOGIN_TRIAL); } else { Response.Redirect(PrizeConstants.URL_EZIDEBIT_LOGIN_FULLY); } } }
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."; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // Verify user has completed the checkout process. if ((string)Session["userCheckoutCompleted"] != "true") { Session["userCheckoutCompleted"] = string.Empty; Response.Redirect(PrizeConstants.URL_CHECKOUT_ERROR + "?" + "Desc=Unvalidated%20Checkout."); } NVPAPICaller payPalCaller = new NVPAPICaller(); payPalCaller.SetCredentials(PrizeConstants.WALLET_USER_NAME, PrizeConstants.WALLET_PASSWORD, PrizeConstants.WALLET_SIGNATURE); string retMsg = ""; string token = ""; string finalPaymentAmount = ""; string PayerID = ""; NVPCodec decoder = new NVPCodec(); token = Session["token"].ToString(); PayerID = Session["payerId"].ToString(); finalPaymentAmount = Session["payment_amt"].ToString(); bool ret = payPalCaller.DoCheckoutPayment(finalPaymentAmount, token, PayerID, ref decoder, ref retMsg); if (ret) { // Retrieve PayPal confirmation value. string PaymentConfirmation = decoder["PAYMENTINFO_0_TRANSACTIONID"].ToString(); TransactionId.Text = PaymentConfirmation; int currentOrderId = -1; if (Session["currentOrderId"] != string.Empty) { currentOrderId = Convert.ToInt32(Session["currentOrderID"]); } PrizeMemberPlanManager planManager = new PrizeMemberPlanManager(); planManager.PayMemberPlans(currentOrderId, PaymentConfirmation); // Clear order id. Session["currentOrderId"] = string.Empty; } else { Response.Redirect(PrizeConstants.URL_CHECKOUT_ERROR + "?" + retMsg); } } }
private static void DailyTasks() { DIYPTEntities db = new DIYPTEntities(); try { PrizeEmailWrapper.ExercisePlan2DaysPriorToStartEmailTask(); db.Database.Connection.Open(); DateTime today = PrizeCommonUtils.GetDayStart(PrizeCommonUtils.GetSystemDate()); PrizePollingTask task = (from c in db.PrizePollingTasks where c.TaskDate >= today && c.TaskType == (int)PrizeConstants.TasksType.DailyRedoAble select c).FirstOrDefault(); if (task == null || task.Count < 2) { PrizeMemberPlanManager.UpdateMemberPlans(); PrizeEmailWrapper.DailyEmailTask(); if (task == null) { task = new PrizePollingTask(); task.Status = "1"; task.TaskDate = PrizeCommonUtils.GetSystemDate(); task.TaskType = (int)PrizeConstants.TasksType.DailyRedoAble; task.Count = 1; db.PrizePollingTasks.Add(task); } else { task.Count++; } db.SaveChanges(); } } catch (Exception e) { PrizeLogs.SaveSystemErrorLog(0, 0, PrizeConstants.SystemErrorLevel.LevelSerious, typeof(RegisteredEvents).ToString(), "DailyTasks", e.Message, e.InnerException == null ? "" : e.InnerException.Message); return; } finally { db.Database.Connection.Close(); } }
protected void btnTaskDone_Click(object sender, EventArgs e) { var sTargetLevel = result.Text; PrizeMemberPlanManager man = new PrizeMemberPlanManager(); MemberExercisePlan myPlan = dbAccess.GetCurrentMemberPlan(PrizeMemberAuthUtils.GetMemberID()); if (myPlan == null) { Response.Write(PrizeConstants.CONST_JS_WARNING_PLAN_NOT_START); return; } man.ChangeMemberPlanLevel(myPlan.Id, sTargetLevel); dbAccess.UpdateOrientationWeekDayResult(myPlan.Id, 2, 2, true); Response.Redirect("/orientation/day-2/get-familiar-with-the-deadlift"); }
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; }
protected void Page_Load(object sender, EventArgs e) { member = PrizeMemberAuthUtils.GetMemberData(); var exercisePlan = dbAccess.GetCurrentMemberPlanOrStartingPlan(member.UmbracoId); if (exercisePlan == null) { PrizeMemberPlanManager planMan = new PrizeMemberPlanManager(); Response.Redirect(planMan.GetEmptyPlanJumpURL(member)); } lblMsg.Text = ""; LoadMemberDetails(); if (!Page.IsPostBack) { DisableValidatorsControls(); } }
private void doNoPaymentPlan() { PrizeOrder myOrder = new PrizeOrder(); myOrder.OrderDate = PrizeCommonUtils.GetSystemDate(); myOrder.Username = PrizeMemberAuthUtils.GetMemberName(); myOrder.FirstName = ""; myOrder.LastName = ""; myOrder.Email = PrizeMemberAuthUtils.GetMemberEmail(); myOrder.Total = 0; myOrder.MemberPlanId = Int32.Parse(Session["buying_my_plan_id"].ToString()); myOrder.ExercisePlanId = Int32.Parse(Session["buying_plan_id"].ToString()); // Get DB context. DIYPTEntities _db = new DIYPTEntities(); try { // Add order to DB. _db.Database.Connection.Open(); _db.PrizeOrders.Add(myOrder); _db.SaveChanges(); Session["currentOrderId"] = myOrder.OrderId; } finally { _db.Database.Connection.Close(); } int currentOrderId = -1; if (Session["currentOrderId"] != string.Empty) { currentOrderId = Convert.ToInt32(Session["currentOrderID"]); } PrizeMemberPlanManager planManager = new PrizeMemberPlanManager(); planManager.PayMemberPlans(currentOrderId, ""); Response.Redirect(PrizeConstants.URL_MEMBER_LANDING); }
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(); }
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; } }
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"); } }
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; } } } } }
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 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)"; } } } }