示例#1
0
        private void PopulateDashboard()
        {
            var series = chtLastXDays.Series["LastXDays_Series"];

            series.XValueType = ChartValueType.Date;

            using (QueriesTableAdapters.sp_GetDataForLastXDaysTableAdapter ta = new QueriesTableAdapters.sp_GetDataForLastXDaysTableAdapter())
            {
                using (Queries.sp_GetDataForLastXDaysDataTable dt = new Queries.sp_GetDataForLastXDaysDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id, Convert.ToInt32(ddDateRange.SelectedValue));

                    MainGraph(dt);

                    GridOfValues(dt);

                    MinMaxValues(dt);

                    PieCharts(dt);

                    GetHbA1c();

                    RefreshUpdatePanels();
                }
            }
        }
示例#2
0
        private void CalculatePieChart(DataTable dt, DateTime start, DateTime stop)
        {
            Queries.sp_GetDataForLastXDaysDataTable castDT = (Queries.sp_GetDataForLastXDaysDataTable)dt;
            if (start.TimeOfDay < stop.TimeOfDay)
            {
                PercentLow = 100 * Convert.ToDouble(castDT.Where(i => i.Glucose <= Statics.LowThreshold &&
                                                                 i.TimeStamp.TimeOfDay >= start.TimeOfDay &&
                                                                 i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);

                PercentHigh = 100 * Convert.ToDouble(castDT.Where(i => i.Glucose >= Statics.HighThreshold &&
                                                                  i.TimeStamp.TimeOfDay >= start.TimeOfDay &&
                                                                  i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);

                PercentNormal = 100 * Convert.ToDouble(castDT.Where(i => i.Glucose > Statics.LowThreshold &&
                                                                    i.Glucose < Statics.HighThreshold &&
                                                                    i.TimeStamp.TimeOfDay >= start.TimeOfDay &&
                                                                    i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);
            }
            else
            {
                PercentLow = 100 * Convert.ToDouble(castDT.Where(i => i.Glucose <= Statics.LowThreshold &&
                                                                 i.TimeStamp.TimeOfDay >= start.TimeOfDay ||
                                                                 i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);

                PercentHigh = 100 * Convert.ToDouble(castDT.Where(i => i.Glucose >= Statics.HighThreshold &&
                                                                  i.TimeStamp.TimeOfDay >= start.TimeOfDay ||
                                                                  i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);

                PercentNormal = 100 * Convert.ToDouble(castDT.Where(i => (i.Glucose > Statics.LowThreshold &&
                                                                          i.Glucose < Statics.HighThreshold) &&
                                                                    i.TimeStamp.TimeOfDay >= start.TimeOfDay ||
                                                                    i.TimeStamp.TimeOfDay <= stop.TimeOfDay).Count()) / Convert.ToDouble(dt.Rows.Count);
            }

            BindingSource = new DataTable("Pie");
            BindingSource.Columns.Add("Label");
            BindingSource.Columns.Add("Value");
            BindingSource.Rows.Add(new object[] { "", AllAreBlank() ? 1 : PercentLow });
            BindingSource.Rows.Add(new object[] { "", AllAreBlank() ? 98 : PercentNormal });
            BindingSource.Rows.Add(new object[] { "", AllAreBlank() ? 1 : PercentHigh });
        }
示例#3
0
        private void PopulateDashboard()
        {
            var series = chtLastXDays.Series["LastXDays_Series"];
            series.XValueType = ChartValueType.Date;

            using (QueriesTableAdapters.sp_GetDataForLastXDaysTableAdapter ta = new QueriesTableAdapters.sp_GetDataForLastXDaysTableAdapter())
            {
                using (Queries.sp_GetDataForLastXDaysDataTable dt = new Queries.sp_GetDataForLastXDaysDataTable())
                {
                    ta.Fill(dt, LoginRow.user_id, Convert.ToInt32(ddDateRange.SelectedValue));

                    MainGraph(dt);

                    GridOfValues(dt);

                    MinMaxValues(dt);

                    PieCharts(dt);

                    GetHbA1c();

                    RefreshUpdatePanels();
                }
            }
        }