Beispiel #1
0
        public void CompareAllHistoryReports()
        {
            var parameters = new Dictionary <DictionaryParameter, string>();

            parameters[DictionaryParameter.LocationCountry] = "GE";

            parameters[DictionaryParameter.StartDate]   = DateTime.Now.AddDays(0).ToShortDateString();
            parameters[DictionaryParameter.KciGrouping] = "True";

            List <ComparisonRow> ageingData;
            List <ComparisonRow> siteCompData;
            List <ComparisonRow> fleetCompData;

            using (var dc = new ComparisonDataAccess(parameters))
            {
                fleetCompData = dc.GetComparisonEntries(false);
                siteCompData  = dc.GetComparisonEntries(true);
                ageingData    = dc.GetComparisonByStatusEntries();
            }



            var totalAgeing    = ageingData.First(d => d.Key == NonRevBaseDataAccess.TotalKeyName).FleetCount;
            var totalSiteComp  = siteCompData.First(d => d.Key == NonRevBaseDataAccess.TotalKeyName).FleetCount;
            var totalFleetComp = fleetCompData.First(d => d.Key == NonRevBaseDataAccess.TotalKeyName).FleetCount;


            Assert.IsTrue(totalAgeing == totalSiteComp);
            Assert.IsTrue(totalAgeing == totalFleetComp);
        }
Beispiel #2
0
        private void RefreshData()
        {
            List <FleetStatusRow> fleetData;
            var mergedParameters = generalParams.GetParameterDictionary();



            var type = PercentageDivisorType.Values;

            if (mergedParameters.ContainsKey(DictionaryParameter.PercentageCalculation) &&
                mergedParameters[DictionaryParameter.PercentageCalculation] != string.Empty)
            {
                type = (PercentageDivisorType)Enum.Parse(typeof(PercentageDivisorType), mergedParameters[DictionaryParameter.PercentageCalculation]);
            }

            using (var dataAccess = new ComparisonDataAccess(mergedParameters))
            {
                lblLastUpdate.Text = LastUpdatedFromFleetNow.GetLastUpdatedDateTime(dataAccess);
                fleetData          = dataAccess.GetComparisonData(true);
            }

            upnlUpdatedTime.Update();
            fleetData = fleetData.OrderBy(d => d.Key).ToList();
            ucComparisonChart.LoadChart(fleetData, type);
            ucComparisonTrendGrid.LoadGrid(fleetData, type);
        }
Beispiel #3
0
        public void CheckFigures()
        {
            //Arrange
            var parameters = new Dictionary <DictionaryParameter, string>
            {
                { DictionaryParameter.OwningCountry, "GE" }
                , { DictionaryParameter.LocationCountry, "GE" }
                , { DictionaryParameter.Pool, "71" }
                , { DictionaryParameter.LocationGroup, string.Empty }
                , { DictionaryParameter.Region, string.Empty }
                , { DictionaryParameter.Area, string.Empty }
                , { DictionaryParameter.Location, string.Empty }
                , { DictionaryParameter.CarSegment, string.Empty }
                , { DictionaryParameter.CarClass, string.Empty }
                , { DictionaryParameter.CarGroup, string.Empty }
                , { DictionaryParameter.CmsSelected, true.ToString() }
            };
            var daySelected = DateTime.Now.ToShortDateString();

            parameters.Add(DictionaryParameter.StartDate, daySelected);
            parameters.Add(DictionaryParameter.EndDate, daySelected);
            parameters.Add(DictionaryParameter.FleetTypes, "4,5,6");

            FleetStatusRow        fleetData;
            List <FleetStatusRow> siteComparisonData;
            List <FleetStatusRow> fleetComparisonData;

            List <FleetStatusRow> historicalTrendData;


            //Act

            using (var dataAccess = new FleetStatusDataAccess(parameters))
            {
                fleetData = dataAccess.GetFleetStatus();
            }

            using (var dataAccess = new ComparisonDataAccess(parameters))
            {
                siteComparisonData  = dataAccess.GetComparisonData(true);
                fleetComparisonData = dataAccess.GetComparisonData(false);
            }

            using (var dataAccess = new HistoricalTrendDataAccess(parameters))
            {
                historicalTrendData = dataAccess.GetCurrentTrend();
            }


            //Assert
            var totalSite       = siteComparisonData.Sum(s => s.TotalFleet);
            var totalFleet      = fleetComparisonData.Sum(s => s.TotalFleet);
            var totalTrendFleet = historicalTrendData.Last().TotalFleet;

            Assert.IsTrue(fleetData.TotalFleet == totalSite);
            Assert.IsTrue(fleetData.TotalFleet == totalFleet);
            Assert.IsTrue(fleetData.TotalFleet == totalTrendFleet);
        }
Beispiel #4
0
        public void CheckNonRevComparison()
        {
            var parameters = new Dictionary <DictionaryParameter, string>();

            parameters[DictionaryParameter.LocationCountry] = "GE";
            parameters[DictionaryParameter.StartDate]       = DateTime.Now.AddDays(-4).ToShortDateString();
            parameters[DictionaryParameter.EndDate]         = DateTime.Now.ToShortDateString();
            parameters[DictionaryParameter.DayOfWeek]       = DayOfWeek.Friday.ToString();
            using (var dc = new ComparisonDataAccess(parameters))
            {
                var data = dc.GetComparisonEntries();
            }
            Assert.IsTrue(true);
        }
Beispiel #5
0
        private IEnumerable <LocationSummaryRow> GetAvailabilitySummaryData(Dictionary <DictionaryParameter, string> parameters)
        {
            var fleetStatusDataAccess = new ComparisonDataAccess(parameters, DataContext);

            var vehicles = BaseVehicleDataAccess.GetVehicleQueryable(parameters, DataContext, true, true);


            var carClassGroupedData = GroupByCarClass(vehicles);

            var extractedData    = fleetStatusDataAccess.ExtractVehicleColumns(carClassGroupedData);
            var availabilityRows = BuildLocationSummaryAvailabilityRows(extractedData);

            return(availabilityRows);
        }
Beispiel #6
0
        private IEnumerable <LocationSummaryForeignRow> GetForeignVehicleSummaryData(Dictionary <DictionaryParameter, string> parameters)
        {
            var fleetStatusDataAccess = new ComparisonDataAccess(parameters, DataContext);

            var vehicles = BaseVehicleDataAccess.GetVehicleQueryable(parameters, DataContext, true, true);


            vehicles = from v in vehicles
                       where v.LastLocationCode.Substring(0, 2) != v.OwningCountry
                       select v;

            var carClassGroupedData = GroupByCarSegmentName(vehicles);

            var extractedData    = fleetStatusDataAccess.ExtractVehicleColumns(carClassGroupedData);
            var availabilityRows = BuildLocationSummaryForeignRows(extractedData);

            return(availabilityRows);
        }