protected void Page_PreRender(object sender, EventArgs e) { GraphInformation.HasReportTypeChanged = GeneralParams.ReportTypeControl.HasReportTypeChanged; DataType selectedTimeZoneType; FutureTrendDataType futureTrendDataType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedValue, out selectedTimeZoneType); Enum.TryParse(GeneralParams.ReportTypeControl.SelectedForecastType.SelectedValue, out futureTrendDataType); var scenarioId = int.Parse(GeneralParams.ReportTypeControl.SelectedScenario.SelectedValue); var frozenZoneSelected = selectedTimeZoneType == DataType.FrozenZone; GeneralParams.DynamicReportParametersControl.DateRangePickerControl.ShowThisWeekAndNextWeekInDropdown = frozenZoneSelected; GeneralParams.DynamicReportParametersControl.DateRangePickerControl.SetDates(frozenZoneSelected); if (GraphInformation.RefreshData) { GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); GraphInformation.TitleAdditional = string.Format("{0} - {1} - {2}", GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedItem.Text, GeneralParams.ReportTypeControl.SelectedForecastType.SelectedItem.Text, GeneralParams.ReportTypeControl.SelectedScenario.SelectedItem.Text); GraphInformation.SeriesData = FutureTrendDataAccess.GetFutureTrendGraphingData(GeneralParams.SelectedParameters, futureTrendDataType, scenarioId, selectedTimeZoneType); GraphInformation.CalculateYEntriesCount(); GraphInformation.RefreshData = false; } }
protected void Page_PreRender(object sender, EventArgs e) { GraphInformation.HasReportTypeChanged = GeneralParams.ReportTypeControl.HasReportTypeChanged; DataType selectedTimeZoneType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedValue, out selectedTimeZoneType); GeneralParams.DynamicReportParametersControl.DateRangePickerControl.SetDates(selectedTimeZoneType == DataType.FrozenZone ? true : false); if (GraphInformation.RefreshData) { var fromDate = DateTime.Parse(GeneralParams.SelectedParameters.ContainsKey(ParameterNames.FromDate) ? GeneralParams.SelectedParameters[ParameterNames.FromDate] : null); var toDate = DateTime.Parse(GeneralParams.SelectedParameters.ContainsKey(ParameterNames.ToDate) ? GeneralParams.SelectedParameters[ParameterNames.ToDate] : null); var doesDateRangeSpanToday = fromDate.Date <DateTime.Now.Date && toDate.Date> DateTime.Now.Date; if (doesDateRangeSpanToday) { var selectedParameters = GeneralParams.SelectedParameters; selectedParameters[ParameterNames.ToDate] = DateTime.Now.AddDays(-1).Date.ToString(); var pastSeriesData = ForecastDataAccess.GetForecastGraphingData(selectedParameters, DataType.FrozenZone); selectedParameters[ParameterNames.FromDate] = DateTime.Now.Date.ToString(); selectedParameters[ParameterNames.ToDate] = toDate.ToString(); var futureSeriesData = ForecastDataAccess.GetForecastGraphingData(selectedParameters, DataType.DailyChanging); var count = 0; pastSeriesData[0].Xvalue.AddRange(futureSeriesData[0].Xvalue); foreach (var sd in futureSeriesData) { pastSeriesData[count].Yvalue.AddRange(sd.Yvalue); count++; } selectedParameters[ParameterNames.FromDate] = fromDate.ToString(); selectedParameters[ParameterNames.ToDate] = toDate.ToString(); GraphInformation.SeriesData = pastSeriesData; GraphInformation.TitleAdditional = GeneralParams.ReportTypeControl.SelectedTimeZone.Items[0].Text + " & " + GeneralParams.ReportTypeControl.SelectedTimeZone.Items[1].Text; } else { var seriesData = ForecastDataAccess.GetForecastGraphingData(GeneralParams.SelectedParameters, selectedTimeZoneType); if (selectedTimeZoneType == DataType.FrozenZone) { seriesData = seriesData.Where(s => s.SeriesName != "Already Booked").ToList(); } GraphInformation.SeriesData = seriesData; GraphInformation.TitleAdditional = GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedItem.Text; } GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); GraphInformation.CalculateYEntriesCount(); GraphInformation.RefreshData = false; } }
protected void Page_PreRender(object sender, EventArgs e) { DataType selectedTimeZoneType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedValue, out selectedTimeZoneType); var frozenZoneSelected = selectedTimeZoneType == DataType.FrozenZone; GeneralParams.DynamicReportParametersControl.DateRangePickerControl.ShowThisWeekAndNextWeekInDropdown = frozenZoneSelected; GeneralParams.DynamicReportParametersControl.DateRangePickerControl.SetDates(frozenZoneSelected); if (GraphInformation.RefreshData) { var scenarioId = int.Parse(GeneralParams.ReportTypeControl.SelectedScenario.SelectedValue); FutureTrendDataType futureTrendDataType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedForecastType.SelectedValue, out futureTrendDataType); var seriesData = SupplyAnalysisDataAccess.GetSupplyAnalysisData(GeneralParams.SelectedParameters, futureTrendDataType, scenarioId, selectedTimeZoneType); GraphInformation.WeeklySeriesData = seriesData.Where(d => d.SeriesName == "Weekly Minimum Supply").ToList(); seriesData.RemoveAll(d => d.SeriesName == "Weekly Minimum Supply"); GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); GraphInformation.TitleAdditional = string.Format("{0} - {1} - {2}", GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedItem.Text, GeneralParams.ReportTypeControl.SelectedForecastType.SelectedItem.Text, GeneralParams.ReportTypeControl.SelectedScenario.SelectedItem.Text); GraphInformation.SeriesData = seriesData; GraphInformation.CalculateYEntriesCount(); GraphInformation.RefreshData = false; } var intervalType = ccSuplyAnalysis.GetIntervalType(); GraphInformation.UseWeeklyData = intervalType == DateTimeIntervalType.Weeks; GraphInformation.IsXValueDate = !GraphInformation.UseWeeklyData; }
protected void Page_PreRender(object sender, EventArgs e) { DataType selectedTimeZoneType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedValue, out selectedTimeZoneType); FutureTrendDataType futureTrendDataType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedForecastType.SelectedValue, out futureTrendDataType); GeneralParams.DynamicReportParametersControl.DateRangePickerControl.SetDates(selectedTimeZoneType == DataType.FrozenZone); if (GraphInformation.RefreshData) { var fromDate = DateTime.Parse(GeneralParams.SelectedParameters.ContainsKey(ParameterNames.FromDate) ? GeneralParams.SelectedParameters[ParameterNames.FromDate] : null); var toDate = DateTime.Parse(GeneralParams.SelectedParameters.ContainsKey(ParameterNames.ToDate) ? GeneralParams.SelectedParameters[ParameterNames.ToDate] : null); var kpiTypeSelection = int.Parse(GeneralParams.ReportTypeControl.SelectedKpi.Value); var kpiShowPercentage = GeneralParams.ReportTypeControl.ShowKpiAsPercentage; var kpiType = kpiTypeSelection == 1 ? KpiCalculationType.OperationalUtilization : kpiTypeSelection == 2 && kpiShowPercentage ? KpiCalculationType.IdleFleetPercentage : KpiCalculationType.IdleFleet; if (!kpiShowPercentage && kpiTypeSelection == 2) { GraphInformation.LabelFormat = "#,##0"; GraphInformation.DataPointsYAxisTooltip = "#VALY{0}"; GraphInformation.YAxisNumberFormat = "#,##0"; } else { GraphInformation.LabelFormat = "0%"; GraphInformation.DataPointsYAxisTooltip = "#VALY{0%}"; GraphInformation.YAxisNumberFormat = "0%"; } var doesDateRangeSpanToday = fromDate.Date <DateTime.Now.Date && toDate.Date> DateTime.Now.Date; string timeZoneTitle; if (doesDateRangeSpanToday) { var selectedParameters = GeneralParams.SelectedParameters; selectedParameters[ParameterNames.ToDate] = DateTime.Now.AddDays(-1).Date.ToString(); var pastSeriesData = KpiDataAccess.GetHistoricalKpiData(selectedParameters, kpiType); selectedParameters[ParameterNames.FromDate] = DateTime.Now.Date.ToString(); selectedParameters[ParameterNames.ToDate] = toDate.ToString(); var futureSeriesData = KpiDataAccess.GetKpiDataNew(selectedParameters, kpiType, futureTrendDataType); var count = 0; pastSeriesData[0].Xvalue.AddRange(futureSeriesData[0].Xvalue); foreach (var sd in futureSeriesData) { pastSeriesData[count].Yvalue.AddRange(sd.Yvalue); count++; } selectedParameters[ParameterNames.FromDate] = fromDate.ToString(); selectedParameters[ParameterNames.ToDate] = toDate.ToString(); GraphInformation.SeriesData = pastSeriesData; timeZoneTitle = string.Format("{0} ({2}) & {1} ", GeneralParams.ReportTypeControl.SelectedTimeZone.Items[0].Text, GeneralParams.ReportTypeControl.SelectedTimeZone.Items[1].Text, GeneralParams.ReportTypeControl.SelectedForecastType.SelectedItem.Text); } else { GraphInformation.SeriesData = selectedTimeZoneType == DataType.FrozenZone ? KpiDataAccess.GetHistoricalKpiData(GeneralParams.SelectedParameters, kpiType) : KpiDataAccess.GetKpiDataNew(GeneralParams.SelectedParameters, kpiType, futureTrendDataType); timeZoneTitle = GeneralParams.ReportTypeControl.SelectedTimeZone.SelectedItem.Text; } KpiDataAccess.RecalculateTrendMinMaxLines(GraphInformation.SeriesData); GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); GraphInformation.TitleAdditional = string.Format("{0} - {1} {2}", timeZoneTitle, GeneralParams.ReportTypeControl.SelectedKpi.Text, kpiShowPercentage ? "%" : ""); GraphInformation.CalculateYEntriesCount(); GraphInformation.RefreshData = false; } }
protected void Page_PreRender(object sender, EventArgs e) { GraphInformation.HasReportTypeChanged = GeneralParams.ReportTypeControl.HasReportTypeChanged; if (GraphInformation.RefreshData || GraphInformation.UsingCachedGraphingData) { FutureTrendDataType futureTrendDataType; Enum.TryParse(GeneralParams.ReportTypeControl.SelectedForecastType.SelectedValue, out futureTrendDataType); var constrained = futureTrendDataType == FutureTrendDataType.Constrained ? true : false; var refreshDataFromDatabase = false; if (constrained && SavedConstrainedSeriesData == null) { refreshDataFromDatabase = true; } if (!constrained && SavedUnconstrainedSeriesData == null) { refreshDataFromDatabase = true; } if (GraphInformation.HaveDatesChanged || GraphInformation.HaveDynamicParametersChanged) { refreshDataFromDatabase = true; SavedConstrainedSeriesData = null; SavedUnconstrainedSeriesData = null; } if (refreshDataFromDatabase || GraphInformation.RefreshData) { var seriesData = BenchMarkDataAccess.GetBenchMarkGraphingData(GeneralParams.SelectedParameters, constrained); if (constrained) { SavedConstrainedSeriesData = seriesData; } else { SavedUnconstrainedSeriesData = seriesData; } GraphInformation.SeriesData = seriesData; GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); GraphInformation.UsingCachedGraphingData = false; } else { GraphInformation.UsingCachedGraphingData = true; GraphInformation.SeriesData = constrained ? SavedConstrainedSeriesData : SavedUnconstrainedSeriesData; } GraphInformation.TitleAdditional = string.Format("{0}", GeneralParams.ReportTypeControl.SelectedForecastType.SelectedItem.Text); GraphInformation.CalculateYEntriesCount(); GraphInformation.RefreshData = false; this.SetPreviousDates(GeneralParams); GraphInformation.HaveDynamicParametersChanged = false; } }
protected void Page_PreRender(object sender, EventArgs e) { //If this page is being being loaded but we have parameters from a previous visit if (!IsPostBack && GraphInformation.SelectedParameters[ParameterNames.Country].Length != 0) { SetQuickNavigationMenu(); } //Don't allow drilldown past Pool if (GraphInformation.ReportParameters.First(p => p.Name == ParameterNames.Pool).SelectedValue != "") { GraphInformation.AllowDrillDown = false; } if (GraphInformation.RefreshData || GraphInformation.CheckIfCachedDataCanBeUsed) { SetQuickNavigationMenu(); var topicId = int.Parse(GeneralParams.ReportTypeControl.SelectedTopic.Value); var scenarioId = int.Parse(GeneralParams.ReportTypeControl.SelectedScenario.SelectedValue); if (topicId > 2) { GraphInformation.LabelFormat = "0%"; GraphInformation.DataPointsYAxisTooltip = "#VALY{0%}"; GraphInformation.YAxisNumberFormat = "0%"; } else { GraphInformation.LabelFormat = "#,##0"; GraphInformation.DataPointsYAxisTooltip = "#VALY{0,0}"; GraphInformation.YAxisNumberFormat = "#,##0"; } if (SiteComparisonGraphData[CurrentKey] == null || GraphInformation.RefreshData) { //SiteComparisonGraphData[CurrentKey] = new SiteComparisonLogic(new SiteComparisonRepository()).GetData(GeneralParams.SelectedParameters, topicId, scenarioId); SiteComparisonGraphData[CurrentKey] = SiteComparisonDataAccess.GetSiteComparisonData(GeneralParams.SelectedParameters, topicId, scenarioId); GraphInformation.DataDate = ParameterDataAccess.GetLastDateFromCmsForecast(); } else { GraphInformation.UsingCachedGraphingData = true; } GraphInformation.SeriesData = SiteComparisonGraphData[CurrentKey]; if (string.IsNullOrEmpty(GraphInformation.TitleDate)) { GraphInformation.ShowLabelSeriesNames.Add(GraphInformation.SeriesData.First().SeriesName); } GraphInformation.TitleDate = string.Format("{0} - {1}", GeneralParams.SelectedParameters[ParameterNames.FromDate], GeneralParams.SelectedParameters[ParameterNames.ToDate]); GraphInformation.TitleAdditional = string.Format("{0}", GeneralParams.ReportTypeControl.SelectedTopic.Text); GraphInformation.CalculateYEntriesCount(); this.SetPreviousDates(GeneralParams); GraphInformation.RefreshData = false; } }