Exemplo n.º 1
0
        private void RenderAction()
        {
            this.ActionLink.NavigateUrl = PageUrlAttribute.Get <Action>();

            Models.User currentUser = this.Session.GetCurrentUser();
            var         latest      = Models.ActionLog.FindLatest(currentUser);
            DateTime    untilDate   = latest == null?DateTime.Now.Date.AddDays(1).AddTicks(-1) : latest.Date;

            DateTime fromDate = untilDate.Date.AddDays(-21);

            SortedList <DateTime, Int32> consumptionPerDay = new SortedList <DateTime, Int32>();

            DateTime runner = fromDate.Date;

            while (runner <= untilDate.Date)
            {
                Int32 consumption = currentUser.CalculateConsumptionOfDay(runner);

                this.ActionChart.Series["ConsumptionSeries"].Points.Add(consumption);
                this.ActionChart.Series["ConsumptionSeries"].Points[this.ActionChart.Series["ConsumptionSeries"].Points.Count - 1].AxisLabel = runner.ToShortDateString();

                runner = runner.AddDays(1);
            }
        }