public List <string> SearchCarGroup(string prefixText, int count, string contextKey) { if (_carGroupData == null) { _carGroupData = ParameterDataAccess.GetCarGroups(); } List <string> returned; if (contextKey.Contains(",")) { var splitCountries = contextKey.Split(','); returned = (from lg in _carGroupData where lg.CarGroup.ToLower().StartsWith(prefixText.ToLower()) && splitCountries.Contains(lg.Country) select lg.Country + "-" + lg.CarGroup).Take(count).ToList(); } else { //Only return those that begin with the prefixText passed in returned = (from lg in _carGroupData where lg.CarGroup.ToLower().StartsWith(prefixText.ToLower()) && lg.Country == contextKey select lg.CarGroup).Take(count).ToList(); } return(returned); }
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; } }
internal static List <BranchHolder> GetAllBranches() { var cacheKey = MarsV2Cache.MarsBranchList; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = ParameterDataAccess.GetAllBranches(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <BranchHolder>)cacheItem); }
/// <summary> /// Retrieves the List of Location Groups either from the Cache or Database /// </summary> /// <returns>Location Pool Ids and Names</returns> internal static List <LocationGroupHolder> GetAllLocationGroups() { var cacheKey = MarsV2Cache.MarsLocationGroupList; var cacheItem = MarsV2Cache.GetCacheObject(cacheKey); if ((ConfigAccess.ByPassCache()) || (cacheItem == null)) { cacheItem = ParameterDataAccess.GetAllLocationPools(); MarsV2Cache.AddObjectToCache(cacheKey, cacheItem); } return((List <LocationGroupHolder>)cacheItem); }
public List <string> GetBranchList(string prefixText, int count) { if (_branchData == null) { _branchData = ParameterDataAccess.GetAllBranches(); } //Only return those that begin with the prefixText passed in var res = (from lg in _branchData where lg.BranchCode.ToLower().StartsWith(prefixText.ToLower()) select lg.BranchCode); return(res.Take(count).ToList()); }
public List <string> GetLocationPoolList(string prefixText, int count) { if (_locationData == null) { _locationData = ParameterDataAccess.GetAllLocationPools(); } //Only return those that begin with the prefixText passed in var res = (from lg in _locationData where lg.LocationGroupName.ToLower().StartsWith(prefixText.ToLower()) select lg.LocationGroupName); return(res.Take(count).ToList()); }
public List <string> GetCountryNames(string prefixText, int count) { if (_ctryData == null) { _ctryData = ParameterDataAccess.GetAllCountries(); } //Only return those that begin with the prefixText passed in var res = (from cp in _ctryData where cp.CountryDesc.ToLower().StartsWith(prefixText.ToLower()) select cp.CountryDesc); return(res.Take(count).ToList()); }
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; }
private void PopulateDropDowns() { ddlReportingTimeZone.DataTextField = "ZoneDescription"; ddlReportingTimeZone.DataValueField = "ZoneID"; var cmsReportingTimeZone = _bll.CMSReportingTimeZoneGetAll(); ddlReportingTimeZone.DataSource = cmsReportingTimeZone; ddlReportingTimeZone.DataBind(); ddlReportingTimeZone.SelectedIndex = 0; ddlForecastType.DataTextField = "FCType"; ddlForecastType.DataValueField = "FCTypeID"; ddlFleetPlan.DataTextField = "PlanDescription"; ddlFleetPlan.DataValueField = "PlanID"; ddlTopic.Items.AddRange(ParameterDataAccess.GetComparisonTopics().ToArray()); ddlKpiCalculation.Items.AddRange(ParameterDataAccess.GetKpiCalculationTypes().ToArray()); }
protected void ButtonSave_Click(object sender, System.EventArgs e) { if (Page.IsValid) { int car_group_id = -1; string car_group = this.TextBoxCarGroup.Text; string car_group_gold = this.TextBoxCarGroupGold.Text; string car_group_fiveStar = this.TextBoxCarGroupFiveStar.Text; string car_group_PresidentCircle = this.TextBoxCarGroupPresidentCircle.Text; string car_group_Platinum = this.TextBoxCarGroupPlatinum.Text; int sort_car_group = Convert.ToInt32(TextBoxSortOrder.Text.Trim()); int car_class_id = Convert.ToInt32(this.DropDownListCarClass.SelectedValue); int result = -1; switch (SessionHandler.MappingCarGroupDefaultMode) { case (int)App.BLL.Mappings.Mode.Insert: result = MappingsCarGroup.InsertCarGroup(car_group, car_group_gold , car_group_fiveStar , car_group_PresidentCircle , car_group_Platinum , car_class_id , sort_car_group); break; case (int)App.BLL.Mappings.Mode.Edit: var validCarGroups = ParameterDataAccess.GetCarGroups().Where(d => d.Country == SessionHandler.MappingSelectedCountry).Select(d => d.CarGroup).ToList(); if (!validCarGroups.Contains(TextBoxCarGroup.Text.Trim())) { tbCarGroupError.Text = "Invalid Car Group"; ModalPopupExtenderMappingDetails.Show(); return; } if (!validCarGroups.Contains(TextBoxCarGroupGold.Text.Trim())) { tbCarGroupGoldError.Text = "Invalid Car Group"; ModalPopupExtenderMappingDetails.Show(); return; } if (!validCarGroups.Contains(TextBoxCarGroupFiveStar.Text.Trim())) { tbCarGroupFiveStarError.Text = "Invalid Car Group"; ModalPopupExtenderMappingDetails.Show(); return; } if (!validCarGroups.Contains(TextBoxCarGroupPresidentCircle.Text.Trim())) { tbCarGroupPresidentCircleError.Text = "Invalid Car Group"; ModalPopupExtenderMappingDetails.Show(); return; } if (!validCarGroups.Contains(TextBoxCarGroupPlatinum.Text.Trim())) { tbCarGroupPlatinumError.Text = "Invalid Car Group"; ModalPopupExtenderMappingDetails.Show(); return; } car_group_id = Convert.ToInt32(this.LabelCarGroupId.Text); result = MappingsCarGroup.UpdateCarGroup(car_group_id, car_group, car_group_gold , car_group_fiveStar , car_group_PresidentCircle , car_group_Platinum , car_class_id, sort_car_group); break; } _errorMessage = result == 0 ? Resources.lang.MessageCarGroupSaved : Resources.lang.ErrorMessageAdministrator; //Raise custom event from parent page if (SaveMappingDetails != null) { SaveMappingDetails(this, EventArgs.Empty); } } else { //Keep the modal popup form show ModalPopupExtenderMappingDetails.Show(); } }
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; } }