Ejemplo n.º 1
0
    static public void SaveSystemErrorLog(int memberId, int?memberPlanId, PrizeConstants.SystemErrorLevel level,
                                          string sWebPage, string sEvent, Exception ex)
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            var log = new PrizeErrorLog();
            log.MemberId             = memberId;
            log.MemberExercisePlanId = memberPlanId;
            log.Page       = sWebPage;       //HttpContext.Current.Request.Url.AbsolutePath;'
            log.ErrorLevel = (int)level;
            log.LogDate    = PrizeCommonUtils.GetSystemDate();
            log.Event      = sEvent;

            // Get stack trace for the exception with source file information
            var st = new StackTrace(ex, true);
            // Get the top stack frame
            var frame = st.GetFrame(st.FrameCount - 1);
            // Get the line number from the stack frame
            var    line   = frame.GetFileLineNumber();
            string sError = ex.Message + " Line_" + frame.GetFileLineNumber() + "\r\n" + ex.StackTrace;

            log.Error      = sError;
            log.InnerError = "";
            if (ex.InnerException != null)
            {
                log.InnerError = ex.InnerException.Message + "\r\n" + ex.InnerException.StackTrace;
            }
            db.PrizeErrorLogs.Add(log);
            db.SaveChanges();
        }
    }
Ejemplo n.º 2
0
    public void PayMemberManualPayment(int weeklyPaymentId, int currentOrderId, int memberPlanId, string paymentConfirmation, string comment = "")
    {
        DIYPTEntities db = new DIYPTEntities();

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

            PrizeOrder          myCurrentOrder;
            MemberExercisePlan  myPlan;
            MemberManualPayment myManualPayment;
            DateTime            currentEndDate = PrizeCommonUtils.GetSystemDate();
            if (currentOrderId >= 0)
            {
                // Get Weekly payment.
                myManualPayment          = db.MemberManualPayments.Single(o => o.Id == weeklyPaymentId);
                myManualPayment.PaidDate = currentEndDate;
                myManualPayment.Comment  = comment;
                myManualPayment.Status   = PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_APPROVED + myManualPayment.Status[1];
                // Get the order based on order id.
                myCurrentOrder = db.PrizeOrders.Single(o => o.OrderId == currentOrderId);
                // Update the order to reflect payment has been completed.
                myCurrentOrder.PaymentTransactionId = paymentConfirmation;

                myPlan        = db.MemberExercisePlans.Single(o => o.Id == myCurrentOrder.MemberPlanId);
                myPlan.Status = PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_PAID;


                if (myPlan.StartDate < currentEndDate)
                {
                    DateTime startDate = PrizeCommonUtils.GetNextWeekStart(currentEndDate);
                    DateTime endDate   = PrizeCommonUtils.GetWeekEnd(startDate);
                    myPlan.StartDate = startDate;
                    IList <MemberExercisePlanWeek> myPlanWeeks = (from c in db.MemberExercisePlanWeeks
                                                                  where c.MemberExercisePlanId == myPlan.Id
                                                                  orderby c.StartDate
                                                                  select c).ToList();
                    foreach (MemberExercisePlanWeek myPlanWeek in myPlanWeeks)
                    {
                        myPlanWeek.StartDate = startDate;
                        myPlanWeek.EndDate   = endDate;
                        myPlanWeek.Status    = PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED;
                        myPlan.EndDate       = endDate;
                        db.SaveChanges();

                        startDate = startDate.AddDays(7);
                        endDate   = endDate.AddDays(7);
                    }
                }
                // Save to DB.
                db.SaveChanges();
            }
        }
        finally
        {
            db.Dispose();
        }
    }
Ejemplo n.º 3
0
    public int ManualPaymentMemberPlanSetup(PrizeMember member, int memberPlanId, int exercisePlanId, string sManualPaymentMode)
    {
        DIYPTEntities db = new DIYPTEntities();

        try
        {
            db.Database.Connection.Open();
            var oldOrders = db.PrizeOrders.Where(o => (o.MemberPlanId == memberPlanId && o.PaymentTransactionId == null));
            db.PrizeOrders.RemoveRange(oldOrders);
            PrizeOrder myOrder = new PrizeOrder();
            myOrder.OrderDate      = PrizeCommonUtils.GetSystemDate();
            myOrder.Username       = member.Email;
            myOrder.FirstName      = member.Firstname;
            myOrder.LastName       = member.Surname;
            myOrder.Email          = member.Email;
            myOrder.Total          = 0;
            myOrder.MemberPlanId   = memberPlanId;
            myOrder.ExercisePlanId = exercisePlanId;
            db.PrizeOrders.Add(myOrder);

            MemberExercisePlan myPlan;
            if (myOrder.OrderId >= 0)
            {
                myPlan = db.MemberExercisePlans.Single(o => o.Id == myOrder.MemberPlanId);

                myPlan.Status = PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT;
                MemberManualPayment manualPayment         = null;
                string manualPaymentStatus                = PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_NOT_APPROVED + sManualPaymentMode;
                List <MemberManualPayment> manualPayments = (from c in db.MemberManualPayments
                                                             where c.MemberId == member.UmbracoId && c.Status.StartsWith(PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_NOT_APPROVED)
                                                             select c).ToList();
                foreach (var notPaidRecord in manualPayments)
                {
                    db.MemberManualPayments.Remove(notPaidRecord);
                    db.SaveChanges();
                }

                manualPayment                      = new MemberManualPayment();
                manualPayment.MemberId             = myPlan.MemberId;
                manualPayment.MemberExercisePlanId = myPlan.Id;
                manualPayment.CreatedDate          = PrizeCommonUtils.GetSystemDate();
                manualPayment.Status               = manualPaymentStatus;
                db.MemberManualPayments.Add(manualPayment);
            }
            db.SaveChanges();
            return(myOrder.OrderId);
        }
        finally
        {
            db.Dispose();
        }
    }
Ejemplo n.º 4
0
    static public void SaveMemberLoginLog(int memberId, int?memberPlanId, string sWebPage, string sEvent, string sError = null)
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            PrizeMember member = (from table in db.PrizeMembers
                                  where table.UmbracoId == memberId
                                  select table).FirstOrDefault();

            var log = new PrizeMemberLog();
            log.MemberId             = memberId;
            log.MemberExercisePlanId = memberPlanId;
            log.Page    = sWebPage; //HttpContext.Current.Request.Url.AbsolutePath;
            log.LogDate = PrizeCommonUtils.GetSystemDate();
            log.Event   = sEvent;
            log.Error   = sError;
            db.PrizeMemberLogs.Add(log);

            //No longer needed here.

            /*
             * DateTime dtYesterdayStart = PrizeCommonUtils.GetDayStart(log.LogDate.AddDays(-1));
             * DateTime dtYesterdayEnd = PrizeCommonUtils.GetDayEnd(log.LogDate.AddDays(-1));
             * DateTime dtTodayStart = PrizeCommonUtils.GetDayStart(log.LogDate);
             * DateTime dtTodayterdayEnd = PrizeCommonUtils.GetDayEnd(log.LogDate);
             *
             * PrizeMemberLog todayLogin = (from table in db.PrizeMemberLogs
             *                           where table.MemberId == memberId && table.LogDate >= dtTodayStart && table.LogDate <= dtTodayterdayEnd
             *                           select table).FirstOrDefault();
             * if (todayLogin != null)
             *  return;
             *
             * PrizeMemberLog yesterdayLogin = (from table in db.PrizeMemberLogs
             *                               where table.MemberId == memberId && table.LogDate >= dtYesterdayStart && table.LogDate <= dtYesterdayEnd
             *                               select table).FirstOrDefault();
             * if (yesterdayLogin != null && member.ContinuousLogin < PrizeConstants.MAX_CONTINUOUS_LOGIN)
             *  member.ContinuousLogin++;
             * else
             *  member.ContinuousLogin = 1;
             *
             * if (member.ContinuousLogin >= PrizeConstants.MAX_CONTINUOUS_LOGIN)
             * {
             *  PrizeEmailWrapper.SendMemberConintuousLoginEmail(member);
             * }
             */

            db.SaveChanges();
        }
    }
Ejemplo n.º 5
0
    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();
        }
    }
Ejemplo n.º 6
0
 static public void SaveSystemErrorLog(int memberId, int?memberPlanId, PrizeConstants.SystemErrorLevel level,
                                       string sWebPage, string sEvent, string sError, string sInnerError)
 {
     using (DIYPTEntities db = new DIYPTEntities())
     {
         var log = new PrizeErrorLog();
         log.MemberExercisePlanId = memberId;
         log.MemberExercisePlanId = memberPlanId;
         log.Page       = sWebPage;       //HttpContext.Current.Request.Url.AbsolutePath;'
         log.ErrorLevel = (int)level;
         log.LogDate    = PrizeCommonUtils.GetSystemDate();
         log.Event      = sEvent;
         log.Error      = sError;
         log.InnerError = sInnerError;
         db.PrizeErrorLogs.Add(log);
         db.SaveChanges();
     }
 }
Ejemplo n.º 7
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++;
            }
        }
    }
Ejemplo n.º 8
0
    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);
    }
Ejemplo n.º 9
0
    private static void DoSendShceduledEmail()
    {
        DIYPTEntities db = new DIYPTEntities();

        try
        {
            db.Database.Connection.Open();
            IQueryable <MemberEmail> emails = (from c in db.MemberEmails
                                               where c.Status == (int)PrizeConstants.EmailStatus.Shceduled || c.Status == (int)PrizeConstants.EmailStatus.Failed
                                               select c);
            bool bSent = false;
            foreach (MemberEmail email in emails.ToList())
            {
                string        sError;
                List <string> additionalContents = new List <string>();
                additionalContents.Add(email.Content1);
                additionalContents.Add(email.Content2);
                additionalContents.Add(email.Content3);
                additionalContents.Add(email.Content4);
                additionalContents.Add(email.Content5);
                bSent = PrizeEmailServiceThread.SendEmailHandler(email, (PrizeConstants.EmailType)email.EmailType, email.Title, additionalContents);

                if (bSent)
                {
                    email.Status   = (int)PrizeConstants.EmailStatus.Succeeded;
                    email.SendDate = PrizeCommonUtils.GetSystemDate();
                    db.SaveChanges();
                }
                else
                {
                    email.SendDate = PrizeCommonUtils.GetSystemDate();
                    email.Status   = (int)PrizeConstants.EmailStatus.Failed;
                    db.SaveChanges();
                }
            }
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
Ejemplo n.º 10
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);
    }
Ejemplo n.º 11
0
    public void TerminateMemberManualPaymentPlan(int weeklyPaymentId, int memberPlanId, string comment = "")
    {
        DIYPTEntities db = new DIYPTEntities();

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

            MemberExercisePlan  myPlan;
            MemberManualPayment myManualPayment;
            DateTime            currentEndDate = PrizeCommonUtils.GetSystemDate();

            // Get Weekly payment.
            myManualPayment = db.MemberManualPayments.Single(o => o.Id == weeklyPaymentId);
            myManualPayment.TerminatedDate = currentEndDate;
            myManualPayment.Comment        = comment;
            myManualPayment.Status         = PrizeConstants.STATUS_PLAN_MANUAL_PAYMENT_TERMINATED + myManualPayment.Status[1];

            myPlan        = db.MemberExercisePlans.Single(o => o.Id == memberPlanId);
            myPlan.Status = PrizeConstants.STATUS_PLAN_TERMINATED + myPlan.Status[1];

            IList <MemberExercisePlanWeek> myPlanWeeks = (from c in db.MemberExercisePlanWeeks
                                                          where c.MemberExercisePlanId == myPlan.Id && !c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_FINISHED)
                                                          orderby c.StartDate
                                                          select c).ToList();
            foreach (MemberExercisePlanWeek myPlanWeek in myPlanWeeks)
            {
                myPlanWeek.Status = PrizeConstants.STATUS_PLAN_WEEK_TERMINATED;
                db.SaveChanges();
            }

            // Save to DB.
            db.SaveChanges();
        }
        finally
        {
            db.Dispose();
        }
    }
Ejemplo n.º 12
0
    // Log an Exception
    public static void LogException(Exception exc, string source)
    {
        // Include logic for logging exceptions
        // Get the absolute path to the log file
        string logFile = "/App_Data/ErrorLog.txt";

        logFile = HttpContext.Current.Server.MapPath(logFile);

        // Open the log file for append and write the log
        StreamWriter sw = new StreamWriter(logFile, true);

        sw.WriteLine("********** {0} **********", PrizeCommonUtils.GetSystemDate());
        if (exc.InnerException != null)
        {
            sw.Write("Inner Exception Type: ");
            sw.WriteLine(exc.InnerException.GetType().ToString());
            sw.Write("Inner Exception: ");
            sw.WriteLine(exc.InnerException.Message);
            sw.Write("Inner Source: ");
            sw.WriteLine(exc.InnerException.Source);
            if (exc.InnerException.StackTrace != null)
            {
                sw.WriteLine("Inner Stack Trace: ");
                sw.WriteLine(exc.InnerException.StackTrace);
            }
        }
        sw.Write("Exception Type: ");
        sw.WriteLine(exc.GetType().ToString());
        sw.WriteLine("Exception: " + exc.Message);
        sw.WriteLine("Source: " + source);
        sw.WriteLine("Stack Trace: ");
        if (exc.StackTrace != null)
        {
            sw.WriteLine(exc.StackTrace);
            sw.WriteLine();
        }
        sw.Close();
    }
Ejemplo n.º 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));
        }

        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];
                    }
                }
            }
        }
    }
Ejemplo n.º 14
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");
        }
    }
Ejemplo n.º 15
0
    protected void LoadDailyInfo(int iMemberId, PrizeExercisePlanWeek planWeek)
    {
        //lblExercise.Text = dbWeek.Description;
        //lblWeek.Text = dbWeek.Week.ToString();

        foreach (var lbl in labels)
        {
            lbl.Text = PrizeConstants.STR_NO_TRAINNING;
        }

        DataSet ds = dbAccess.GetMemberWeeklyInfo(planWeek.Id);

        int DayTimeTypeId1 = 0;

        //int DayTimeTypeId2 = 0;
        foreach (DataRow row in ds.Tables[0].Rows)
        {
            int iWeekDay     = (int)row[0] - 1;
            int iDayTimeType = (int)row[1]; //(int)reader.GetInt32(3);

            if (iWeekDay < labels.Count)
            {
                int iIndex = iWeekDay;
                //if (iDayTimeType == DayTimeTypeId2)
                //iIndex += 7;
                labels[iIndex].Text = (String)row[2];//reader.GetString(1);
            }

            //if (iWeekDay == (int)(PrizeCommonUtils.GetSystemDate().DayOfWeek))
            //exerciseUnitSets.Add((int)row[4]); //((int)reader.GetInt32(4));
        }

        HtmlControl temp  = (HtmlControl)FindControl("day" + (int)(PrizeCommonUtils.GetSystemDate().GetDayOfWeek()));
        HtmlControl tempe = (HtmlControl)FindControl("day" + (int)(PrizeCommonUtils.GetSystemDate().GetDayOfWeek()) + "e");

        /*if (temp != null)
         * {
         *  temp.Attributes.Add("style", "background-color: #eee");
         *  tempe.Attributes.Add("style", "background-color: #eee");
         * }
         */
        for (int i = 0; i < 7; i++)
        {
            DataSet dsDaily       = dbAccess.GetExerciseUnitsSetDetail(planWeek.Id, i + 1);
            double  dTimeDuration = 0;
            int     iTimeDuration = 0;
            for (int j = 1; j < dsDaily.Tables.Count; j++)
            {
                foreach (DataRow row in dsDaily.Tables[j].Rows)
                {
                    dTimeDuration += double.Parse(row["TimeDuration"].ToString());
                    iTimeDuration  = (int)Math.Ceiling((double)dTimeDuration / 60);
                }
            }
            if (dsDaily.Tables.Count > 1)
            {
                iTimeDuration = iTimeDuration + 10 + 5; // +10 warm up; +5 cool down
            }
            lblTimeDuration[i].Text = "" + iTimeDuration;
        }

        for (int i = 0; i < 7; i++)
        {
            switch (labels[i].Text.Trim())
            {
            case "Brisk walk":
                lblTimeDuration[i].Text = "30 mins";
                break;

            case "Own 1hr cardio":
            case "Own training":
            case "Own cardio":
                lblTimeDuration[i].Text = "60 mins";
                break;

            case "30-60min weekend physical activity":
            case "Weekend physical activity":
                lblTimeDuration[i].Text = "30-60 mins";
                break;

            case "Rest Day":
                lblTimeDuration[i].Text = "All Day";
                break;

            default:
                lblTimeDuration[i].Text += " mins";
                break;
            }
        }
    }
Ejemplo n.º 16
0
    protected void LoadWeeklyInfo(int memberID, PrizeExercisePlanWeek planWeek, MemberExercisePlanWeek memberPlanWeek)
    {
        dayNumber = PrizeCommonUtils.GetSystemDate().GetDayOfWeek();

        int memberId = PrizeMemberAuthUtils.GetMemberID();

        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();

            lblDateDuration.Text = PrizeCommonUtils.ParseDateToEnglish(memberPlanWeek.StartDate) + " - "
                                   + PrizeCommonUtils.ParseDateToEnglish(memberPlanWeek.EndDate);

            for (int i = 0; i < lblDates.Count; i++)
            {
                lblDates[i].Text = PrizeCommonUtils.ParseShortDateToEnglish(memberPlanWeek.StartDate.AddDays(i));
                HyperLink linkDay = FindControl("linkDay" + (i + 1)) as HyperLink;
                if (linkDay != null && planWeek != null)
                {
                    linkDay.NavigateUrl = (String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, planWeek.Id, memberPlanWeek.Id, i + 1));
                }
                else if (planWeek == null)
                {
                    //Orientation week
                    linkDay.NavigateUrl = "/orientation/day-" + (i + 1);
                    labels[i].Text      = "Orientation day " + (i + 1);
                }
            }
            if (planWeek == null)
            {
                lblWeekNum.Text = "Week 0";
                PrizeDataAccess dba = new PrizeDataAccess();
                if (dba.MemberInOrientation(PrizeMemberAuthUtils.GetMemberID()))
                {
                    topInfo.Visible = false;
                }
                db.Database.Connection.Close();
                return;
            }

            int iWeekNum = memberPlanWeek.Week;
            lblWeekNum.Text = "Week " + iWeekNum;

            string[] planWeekDesc      = planWeek.Description.Split('\n');
            bool     bEquipmentSession = false;
            if (strEquipments == null)
            {
                strEquipments = new List <string>();
            }
            for (int i = 0; i < planWeekDesc.Length; i++)
            {
                string[] strKeyValue = planWeekDesc[i].Split(':');
                if (strKeyValue != null && strKeyValue.Length > 1)
                {
                    if ((i == 1) && (strKeyValue[0].IndexOf("phase", StringComparison.OrdinalIgnoreCase) >= 0))
                    {
                        lblTrainingPhase.Text = strKeyValue[1];
                        continue;
                    }
                    if ((i == 2) && (strKeyValue[0].IndexOf("phase duration", StringComparison.OrdinalIgnoreCase) >= 0 || (strKeyValue[0].IndexOf("training duration", StringComparison.OrdinalIgnoreCase) >= 0)))
                    {
                        lblDuration.Text = strKeyValue[1];
                        continue;
                    }

                    if (strKeyValue[0].IndexOf("equipment", StringComparison.OrdinalIgnoreCase) >= 0)
                    {
                        bEquipmentSession = true;
                        strEquipments.Clear();
                        continue;
                    }
                }

                if (bEquipmentSession && Regex.Matches(planWeekDesc[i], @"[a-zA-Z]").Count > 0)
                {
                    strEquipments.Add(planWeekDesc[i]);
                    continue;
                }
            }

            if (strEquipments != null && strEquipments.Count > 0)
            {
                string tempLiteral = "<ul class='equipment-list'>";
                foreach (var e in strEquipments)
                {
                    if (e != " ")
                    {
                        tempLiteral += "<li>" + e + "</li>";
                    }
                }
                tempLiteral                += "</ul>";
                equipmentLiteral.Text       = tempLiteral;
                equipmentLiteralMobile.Text = tempLiteral;
                equipmentDiv.Visible        = true;
            }

            DataSet myPlan = dbAccess.GetExercisePlanInfo((int)planWeek.ExercisePlanId);
            if (myPlan.Tables[0].Rows.Count == 0)
            {
                db.Database.Connection.Close();
                return;
            }

            this.lblGoal.Text = myPlan.Tables[0].Rows[0]["ProgramName"].ToString();


            LoadDailyInfo(memberId, planWeek);

            //PrizePlanProgram myProgram = (from c in db.PrizePlanPrograms
            //                              where c.Id == planWeek.ExercisePlanId
            //                              select c).FirstOrDefault();


            db.Database.Connection.Close();
        }
    }
Ejemplo n.º 17
0
    protected void LoadWeeklyResult(List <MemberPlanWeekResult> weekResults)
    {
        if (_MemberPlanWeek == null)
        {
            return;
        }

        MemberPlanWeekResult weekResult     = weekResults[iWeekNum];
        MemberPlanWeekResult prevWeekResult = null;

        int iWeek = this.GetLatestMeasurementWeekNum(iWeekNum - 1);

        if (iWeek >= 0)
        {
            prevWeekResult = weekResults[iWeek];
        }
        if (weekResult == null)
        {
            throw new Exception();
        }

        decimal iDiff = 0;

        if (weekResult.EndWeight.HasValue)
        {
            lblWeight.Text = weekResult.EndWeight.Value.ToString("0,0.00");
            if (prevWeekResult != null && prevWeekResult.EndWeight.HasValue)
            {
                iDiff = weekResult.EndWeight.Value - prevWeekResult.EndWeight.Value;
                lblWeightDiff.Text = iDiff.ToString("0,0.00");
            }
            else
            {
                lblWeightDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
            }
        }
        else if (weekResult.StartWeight.HasValue)
        {
            lblWeight.Text = weekResult.StartWeight.Value.ToString("0,0.00");
        }
        else
        {
            lblWeight.Text     = PrizeCommonUtils.FormatExerciseNumber(0);
            lblWeightDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
        }

        if (weekResult.EndWaist.HasValue)
        {
            lblWaist.Text = weekResult.EndWaist.Value.ToString("0,0.00");
            if (prevWeekResult != null && prevWeekResult.EndWaist.HasValue)
            {
                iDiff             = weekResult.EndWaist.Value - prevWeekResult.EndWaist.Value;
                lblWaistDiff.Text = iDiff.ToString("0,0.00");
            }
            else
            {
                lblWaistDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
            }
        }
        else if (weekResult.StartWaist.HasValue)
        {
            lblWaist.Text = weekResult.StartWaist.Value.ToString("0,0.00");
        }
        else
        {
            lblWaist.Text     = PrizeCommonUtils.FormatExerciseNumber(0);
            lblWaistDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
        }

        if (weekResult.EndHip.HasValue)
        {
            lblHip.Text = weekResult.EndHip.Value.ToString("0,0.00");
            if (prevWeekResult != null && prevWeekResult.EndHip.HasValue)
            {
                iDiff           = weekResult.EndHip.Value - prevWeekResult.EndHip.Value;
                lblHipDiff.Text = iDiff.ToString("0,0.00");
            }
            else
            {
                lblHipDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
            }
        }
        else if (weekResult.StartHip.HasValue)
        {
            lblHip.Text = weekResult.StartHip.Value.ToString("0,0.00");
        }
        else
        {
            lblHip.Text     = PrizeCommonUtils.FormatExerciseNumber(0);
            lblHipDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
        }

        if (weekResult.EndChest.HasValue)
        {
            lblChest.Text = weekResult.EndChest.Value.ToString("0,0.00");
            if (prevWeekResult != null && prevWeekResult.EndChest.HasValue)
            {
                iDiff             = weekResult.EndChest.Value - prevWeekResult.EndChest.Value;
                lblChestDiff.Text = iDiff.ToString("0,0.00");
            }
            else
            {
                lblChestDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
            }
        }
        else if (weekResult.StartChest.HasValue)
        {
            lblChest.Text = weekResult.StartChest.Value.ToString("0,0.00");
        }
        else
        {
            lblChest.Text     = PrizeCommonUtils.FormatExerciseNumber(0);
            lblChestDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
        }

        if (weekResult.EndHeartRate.HasValue)
        {
            lblHeartRate.Text = weekResult.EndHeartRate.Value.ToString("0,0.00");
            if (prevWeekResult != null && prevWeekResult.EndHeartRate.HasValue)
            {
                iDiff = weekResult.EndHeartRate.Value - prevWeekResult.EndHeartRate.Value;
                lblHeartRateDiff.Text = iDiff.ToString("0,0.00");
            }
            else
            {
                lblHeartRateDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
            }
        }
        else if (weekResult.StartHeartRate.HasValue)
        {
            lblHeartRate.Text = PrizeCommonUtils.FormatExerciseNumber(weekResult.StartHeartRate.Value);
        }
        else
        {
            lblHeartRate.Text     = PrizeCommonUtils.FormatExerciseNumber(0);
            lblHeartRateDiff.Text = PrizeCommonUtils.FormatExerciseNumber(0);
        }
    }
Ejemplo n.º 18
0
    public static bool UpdateMemberPlans()
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            try
            {
                db.Database.Connection.Open();

                DateTime today = PrizeCommonUtils.GetDayStart(PrizeCommonUtils.GetSystemDate());
                MemberExercisePlanWeek startingPlanWeek;
                String availableStatus = PrizeConstants.STATUS_PLAN_STARTED + PrizeConstants.STATUS_PLAN_PAID;
                IQueryable <MemberExercisePlan> plans = (from c in db.MemberExercisePlans
                                                         where c.Status.Equals(availableStatus)
                                                         orderby c.MemberId, c.Id
                                                         select c);

                foreach (MemberExercisePlan plan in plans)
                {
                    MemberExercisePlanWeek finishingPlanWeek = (from c in db.MemberExercisePlanWeeks
                                                                where c.MemberExercisePlanId == plan.Id && c.EndDate <= today &&
                                                                c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_STARTED)
                                                                orderby c.ExercisePlanWeekId
                                                                select c).FirstOrDefault();

                    if (finishingPlanWeek != null)
                    {
                        finishingPlanWeek.Status = PrizeConstants.STATUS_PLAN_WEEK_FINISHED;
                        startingPlanWeek         = (from c in db.MemberExercisePlanWeeks
                                                    where c.StartDate >= finishingPlanWeek.EndDate && c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED) &&
                                                    c.MemberExercisePlanId == plan.Id
                                                    orderby c.StartDate
                                                    select c).FirstOrDefault();
                        if (startingPlanWeek != null)
                        {
                            MemberPlanWeekResult finishingResult = (from c in db.MemberPlanWeekResults
                                                                    where c.MemberExercisePlanWeekId == finishingPlanWeek.Id
                                                                    select c).FirstOrDefault();

                            MemberPlanWeekResult startingResult = (from c in db.MemberPlanWeekResults
                                                                   where c.MemberExercisePlanWeekId == startingPlanWeek.Id
                                                                   select c).FirstOrDefault();
                            CopyWeekResult(ref startingResult, ref finishingResult);
                            startingPlanWeek.Status = PrizeConstants.STATUS_PLAN_WEEK_STARTED;
                        }
                        else
                        {
                            plan.Status = PrizeConstants.STATUS_PLAN_FINISHED + PrizeConstants.STATUS_PLAN_PAID;
                        }
                    }
                }

                availableStatus = PrizeConstants.STATUS_PLAN_NOT_STARTED + PrizeConstants.STATUS_PLAN_PAID;
                plans           = (from c in db.MemberExercisePlans
                                   where c.Status.Equals(availableStatus)
                                   orderby c.MemberId
                                   select c);

                foreach (MemberExercisePlan plan in plans)
                {
                    startingPlanWeek = (from c in db.MemberExercisePlanWeeks
                                        where c.StartDate <= today && c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED) &&
                                        c.MemberExercisePlanId == plan.Id
                                        orderby c.StartDate
                                        select c).FirstOrDefault();
                    if (startingPlanWeek != null)
                    {
                        MemberPlanWeekResult startingResult = (from c in db.MemberPlanWeekResults
                                                               where c.MemberExercisePlanWeekId == startingPlanWeek.Id
                                                               select c).FirstOrDefault();
                        MemberExercisePlanWeek finishedWeek = (from c in db.MemberExercisePlanWeeks
                                                               where c.EndDate < startingPlanWeek.StartDate && c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_FINISHED)
                                                               select c).FirstOrDefault();
                        if (finishedWeek != null)
                        {
                            MemberPlanWeekResult finishingResult = (from c in db.MemberPlanWeekResults
                                                                    where c.MemberExercisePlanWeekId == finishedWeek.Id
                                                                    select c).FirstOrDefault();
                            CopyWeekResult(ref startingResult, ref finishingResult);
                        }

                        startingPlanWeek.Status = PrizeConstants.STATUS_PLAN_WEEK_STARTED;
                        plan.Status             = PrizeConstants.STATUS_PLAN_STARTED + PrizeConstants.STATUS_PLAN_PAID;
                    }
                }
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                PrizeLogs.SaveSystemErrorLog(0, 0, PrizeConstants.SystemErrorLevel.LevelSerious, typeof(PrizeMemberPlanManager).ToString(),
                                             "UpdateMemberPlans", e.Message, e.InnerException == null ? "" : e.InnerException.Message);
                return(false);
            }
            finally
            {
                db.Database.Connection.Close();
            }
        }
    }
Ejemplo n.º 19
0
    private void AddNewUserDetails(int newUserId)
    {
        using (DIYPTEntities db = new DIYPTEntities())
        {
            db.Database.Connection.Open();
            try
            {
                PrizeMember member = new PrizeMember();

                member.Firstname = txtFirstName.Text;
                member.Surname   = tbLastName.Text;
                member.Email     = txtEmail.Text;

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

                StringBuilder sb = new StringBuilder();
                sb.Append(Q3.InnerText);
                sb.Append("\r\n");
                sb.Append(ddlQ3.Text);
                sb.Append("\r\n");
                sb.Append(Q4.InnerText);
                sb.Append("\r\n");
                sb.Append(ddlQ4.Text);
                sb.Append("\r\n");
                sb.Append(regQ4.InnerText);
                sb.Append("\r\n");
                sb.Append(Q5.InnerText);
                sb.Append("\r\n");
                sb.Append(regQ5.InnerText);
                sb.Append("\r\n");
                sb.Append(ddlQ6.Text);
                sb.Append("\r\n");
                sb.Append(regQ6.InnerText);
                sb.Append("\r\n");
                sb.Append(ddlQ7.Text);
                sb.Append("\r\n");
                sb.Append(regQ7.InnerText);
                sb.Append("\r\n");

                member.Questions = sb.ToString();

                member.UmbracoId        = newUserId;
                member.RegisterDateTime = PrizeCommonUtils.GetSystemDate();
                char c = '1';
                if (!cbPromotionalPhoto.Checked)
                {
                    c = '0';
                }
                member.UserSettings = PrizeConstants.DEFAULT_MEMBER_SETTINGS;
                string s = string.Copy(member.UserSettings);
                PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.PromotionalPhoto, c);
                member.UserSettings = s;
                db.PrizeMembers.Add(member);
                db.SaveChanges();
            }
            finally
            {
                db.Database.Connection.Close();
            }
        }
    }
Ejemplo n.º 20
0
    protected string UpdateMemberPlanWeekPhoto(MemberExercisePlanWeek memberPlanWeek, FileUpload loader, int iType = 0)
    {
        FileUpload tempFileupload       = loader;
        string     sPhotoTypeName       = "";
        string     attachmentServerPath = "";

        if (iType == 0)
        {
            sPhotoTypeName = "front";
        }
        if (iType == 1)
        {
            sPhotoTypeName = "side";
        }
        if (iType == 2)
        {
            sPhotoTypeName = "back";
        }

        string sSuffix         = Path.GetExtension(tempFileupload.FileName);
        string sServerFileName = memberPlanWeek.MemberId + "_" + PrizeCommonUtils.ParseDateTimeSimple(memberPlanWeek.StartDate) + "_" + sPhotoTypeName + sSuffix;

        if (tempFileupload != null && !string.IsNullOrEmpty(tempFileupload.FileName))
        {
            string uploadPath = @"d:\sites\jrguico\diypt.com.au\home\member_images";
            //string uploadPath = @"C:\workspace\asp_project\diypt.club\home\member_images";
            attachmentServerPath = String.Format(@"http://{0}/member_images/{1}", HttpContext.Current.Request.Url.Authority, sServerFileName);
            decimal attachmentFileSize = Math.Round(Convert.ToDecimal(tempFileupload.PostedFile.ContentLength / 1024), 2);

            //if (attachmentFileSize + Helper.GetTrialTotalAttachmentSize(TrialId) < Convert.ToDecimal(ConfigurationManager.AppSettings["TotalAttachmentSizeLimit"]))
            if (attachmentFileSize < 15000)
            {
                string[] dirs         = Directory.GetFiles(uploadPath);
                string   folderPath   = String.Format(@"\{0}", sServerFileName);
                string   fullFilePath = uploadPath + folderPath;

                tempFileupload.SaveAs(fullFilePath);
                ImageHelper.RotateImageByExifOrientationData(fullFilePath, fullFilePath, System.Drawing.Imaging.ImageFormat.Jpeg, true);
                using (DIYPTEntities db = new DIYPTEntities())
                {
                    MemberPlanWeekResult weekResult = (from c in db.MemberPlanWeekResults
                                                       where c.MemberExercisePlanWeekId == memberPlanWeek.Id
                                                       select c).FirstOrDefault();
                    if (weekResult != null)
                    {
                        switch (iType)
                        {
                        case 0:
                            weekResult.FrontPhoto = attachmentServerPath;
                            break;

                        case 1:
                            weekResult.SidePhoto = attachmentServerPath;
                            break;

                        case 2:
                            weekResult.BackPhoto = attachmentServerPath;
                            break;

                        default:
                            break;
                        }
                        db.SaveChanges();
                    }
                }
            }
            else
            {
                Response.Write("<script>alert('You cannot attach this file. The maximum file size limit is 15mb.');</script>");
                return("");
            }
        }
        else
        {
            Response.Write("<script>alert('Please choose a file to attach.');</script>");
        }

        WeekResults = dbAccess.GetMemberPlanResults(_MemberPlanWeek.MemberExercisePlanId);

        return(attachmentServerPath);
    }
Ejemplo n.º 21
0
    public bool ResumeMemberPlan(int myPlanId)
    {
        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);
            }

            IList <MemberExercisePlanWeek> myPlanWeeks = (from c in db.MemberExercisePlanWeeks
                                                          where c.MemberExercisePlanId == myPlan.Id && c.Status.Equals(PrizeConstants.STATUS_PLAN_WEEK_SUSPENDED)
                                                          orderby c.Week
                                                          select c).ToList();
            int      idx            = 1;
            DateTime currentEndDate = PrizeCommonUtils.GetSystemDate();
            DateTime startDate      = PrizeCommonUtils.GetWeekStart(currentEndDate);
            DateTime endDate        = PrizeCommonUtils.GetWeekEnd(startDate);
            foreach (var myPlanWeek in myPlanWeeks)
            {
                if (idx == 1)
                {
                    if (myPlanWeek.StartDate <= startDate)
                    {
                        myPlanWeek.Status    = PrizeConstants.STATUS_PLAN_WEEK_STARTED;
                        myPlanWeek.StartDate = startDate;
                        myPlanWeek.EndDate   = endDate;
                    }
                    else
                    {
                        myPlanWeek.Status = PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED;
                        startDate         = myPlanWeek.StartDate;
                        endDate           = myPlanWeek.EndDate;
                    }
                }
                else
                {
                    myPlanWeek.Status    = PrizeConstants.STATUS_PLAN_WEEK_NOT_STARTED;
                    myPlanWeek.StartDate = startDate;
                    myPlanWeek.EndDate   = endDate;
                }
                myPlan.EndDate = endDate;
                startDate      = startDate.AddDays(7);
                endDate        = endDate.AddDays(7);
                idx++;
            }
            myPlan.Status = PrizeConstants.STATUS_PLAN_STARTED + myPlan.Status[1];

            db.SaveChanges();

            return(true);
        }
        catch
        {
            return(false);
        }
        finally
        {
            db.Dispose();
        }
    }
Ejemplo n.º 22
0
    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();
        }
    }
Ejemplo n.º 23
0
    public string GetCurrentDailyViewURL(int memberId)
    {
        string result = "";
        MemberExercisePlanWeek memberPlanWeek = GetCurrentMemberPlanWeek(memberId);

        if (memberPlanWeek == null)
        {
            return(result);
        }
        PrizeExercisePlanWeek planWeek = GetExercisePlanWeek(memberPlanWeek.ExercisePlanWeekId);

        if (planWeek == null)
        {
            return(result);
        }
        result = String.Format("{0}?PlanWeekId={1}&MemberPlanWeekId={2}&PlanDayNumber={3}", PrizeConstants.URL_MEMBER_DAY_VIEW, planWeek.Id, memberPlanWeek.Id, PrizeCommonUtils.GetSystemDate().GetDayOfWeek());
        return(result);
    }
Ejemplo n.º 24
0
    protected void btnSubmitProfile_Click(object sender, EventArgs e)
    {
        try
        {
            using (DIYPTEntities db = new DIYPTEntities())
            {
                try
                {
                    PrizeMember memberUpdating = (from c in db.PrizeMembers
                                                  where c.UmbracoId == member.UmbracoId
                                                  select c).FirstOrDefault();
                    memberUpdating.Firstname = tbFirstName.Text;
                    memberUpdating.Surname   = tbLastName.Text;
                    memberUpdating.WhyDIYPT  = tbWhyDiypt.Text;
                    memberUpdating.Facebook  = tbFacebook.Text;
                    memberUpdating.Instagram = tbInstagram.Text;
                    memberUpdating.Twiter    = tbTwitter.Text;

                    /*
                     * string s = null;
                     * if (memberUpdating.UserSettings != null)
                     * s = string.Copy(memberUpdating.UserSettings);
                     * if (cbShowProgram.Checked == true)
                     * PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.ShowProgram, '1');
                     * else
                     * PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.ShowProgram, '0');
                     *
                     * if (cbShowLevel.Checked == true)
                     * PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.ShowLevel, '1');
                     * else
                     * PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.ShowLevel, '0');
                     * memberUpdating.UserSettings = s;
                     */
                    // db.PrizeMembers(member);

                    //photoUpload
                    if (photoUpload != null && !string.IsNullOrEmpty(photoUpload.FileName))
                    {
                        string attachmentServerPath = "";
                        string sSuffix         = photoUpload.FileName.Substring(photoUpload.FileName.Length - 4);
                        string sServerFileName = memberUpdating.UmbracoId + "_" + PrizeCommonUtils.ParseDateTimeSimple(DateTime.Now) + "_" + sSuffix;

                        string uploadPath = HttpContext.Current.Server.MapPath("~/member_images");
                        //@"C:\workspace\asp_project\diypt.club\home\member_images";
                        attachmentServerPath = String.Format(@"http://{0}/member_images/{1}", HttpContext.Current.Request.Url.Authority, sServerFileName);
                        decimal attachmentFileSize = Math.Round(Convert.ToDecimal(photoUpload.PostedFile.ContentLength / 1024), 2);

                        //if (attachmentFileSize + Helper.GetTrialTotalAttachmentSize(TrialId) < Convert.ToDecimal(ConfigurationManager.AppSettings["TotalAttachmentSizeLimit"]))
                        if (attachmentFileSize < 15000)
                        {
                            string[] dirs         = Directory.GetFiles(uploadPath);
                            string   folderPath   = String.Format(@"\{0}", sServerFileName);
                            string   fullFilePath = uploadPath + folderPath;

                            photoUpload.SaveAs(fullFilePath);
                            memberUpdating.Photo = attachmentServerPath;
                        }
                    }
                    char cc = '1';
                    if (!cbPromotionalPhoto.Checked)
                    {
                        cc = '0';
                    }
                    string s = string.Copy(memberUpdating.UserSettings);
                    PrizeMemberAuthUtils.SetMemberSetting(ref s, PrizeConstants.MemberSettings.PromotionalPhoto, cc);
                    memberUpdating.UserSettings = s;
                    db.SaveChanges();
                }
                finally
                {
                    db.Database.Connection.Close();
                    divViewProfile.Visible = true;
                    divEditProfile.Visible = false;
                    DisableValidatorsControls();
                    member = PrizeMemberAuthUtils.GetMemberData();
                    LoadMemberDetails();
                }
            }
        }
        catch (MembershipCreateUserException me)
        {
            lblMsg.Text    = GetErrorMessage(me.StatusCode);
            lblMsgTop.Text = lblMsg.Text;
        }
        catch (HttpException httpe)
        {
            lblMsg.Text    = httpe.Message;
            lblMsgTop.Text = lblMsg.Text;
        }
    }
Ejemplo n.º 25
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();
        }
    }
 protected void refresh(object sender, EventArgs e)
 {
     tbfistname.Text = string.Empty;
     clWeeklyPaymentStart1.SelectedDate = PrizeCommonUtils.GetSystemDate();
     clWeeklyPaymentStart2.SelectedDate = PrizeCommonUtils.GetSystemDate();
 }
Ejemplo n.º 27
0
    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#?";
    }
 protected void refresh2(object sender, EventArgs e)
 {
     tbFirstName2.Text = string.Empty;
     clWeeklyPaymentStop1.SelectedDate = PrizeCommonUtils.GetSystemDate();
     clWeeklyPaymentStop2.SelectedDate = PrizeCommonUtils.GetSystemDate();
 }