예제 #1
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);
        }
    }