コード例 #1
0
        private List <ComparisonRow> GetCurrentComparisonData()
        {
            var comparisonType = _siteComparison ? ComparisonLevelLookup.GetSiteComparisonTypeFromParameters(Parameters)
                                    : ComparisonLevelLookup.GetFleetComparisonTypeFromParameters(Parameters);
            var returned = GetCurrentComparisonData(comparisonType);

            return(returned);
        }
コード例 #2
0
        private List <FleetStatusRow> GetCurrentFleetComparison(bool siteComparison)
        {
            var comparisonType = siteComparison ? ComparisonLevelLookup.GetSiteComparisonTypeFromParameters(Parameters)
                : ComparisonLevelLookup.GetFleetComparisonTypeFromParameters(Parameters);


            var groupedData = GetSingleKeyGroupedVehicle(comparisonType);

            var extractedData = ExtractVehicleColumns(groupedData);


            var returned = extractedData.ToList();

            return(returned);
        }
コード例 #3
0
        private List <FleetStatusRow> GetHistoricalComparison(bool siteComparison)
        {
            var comparisonType = siteComparison ? ComparisonLevelLookup.GetSiteComparisonTypeFromParameters(Parameters)
                : ComparisonLevelLookup.GetFleetComparisonTypeFromParameters(Parameters);

            var groupedQueryable = GetTwoKeyGroupedAvailabilityHistory(comparisonType);


            var availabilityKeyGrouping = BaseVehicleDataAccess.GetAvailabilityGroupingFromParameters(Parameters);

            var fleetDayKeyGrouping = ExtractFleetHistoryColumns(availabilityKeyGrouping, groupedQueryable);
            var fleetKeyGrouping    = GroupByKey(fleetDayKeyGrouping);


            var returned = fleetKeyGrouping.ToList();

            return(returned);
        }
コード例 #4
0
        private List <AgeingRow> GetTodayAgeRowData()
        {
            var vehicles = BaseVehicleDataAccess.GetVehicleQueryable(Parameters, DataContext, true, true);

            vehicles = VehicleFieldRestrictions.RestrictByIdleInForeignCountry(vehicles);



            var comparisonType = ComparisonLevelLookup.GetSiteComparisonTypeFromParameters(Parameters);

            IQueryable <IGrouping <string, Vehicle> > groupedData = null;

            switch (comparisonType)
            {
            case DictionaryParameter.LocationCountry:
                groupedData = from v in vehicles
                              group v by v.LOCATION.COUNTRy1.country_description
                              into gd
                              select gd;
                break;

            case DictionaryParameter.Pool:
                groupedData = from v in vehicles
                              group v by v.LOCATION.CMS_LOCATION_GROUP.CMS_POOL.cms_pool1
                              into gd
                              select gd;
                break;

            case DictionaryParameter.LocationGroup:
                groupedData = from v in vehicles
                              group v by v.LOCATION.CMS_LOCATION_GROUP.cms_location_group1
                              into gd
                              select gd;
                break;

            case DictionaryParameter.Area:
                groupedData = from v in vehicles
                              group v by v.LOCATION.OPS_AREA.ops_area1
                              into gd
                              select gd;
                break;

            case DictionaryParameter.Region:
                groupedData = from v in vehicles
                              group v by v.LOCATION.OPS_AREA.OPS_REGION.ops_region1
                              into gd
                              select gd;
                break;

            case DictionaryParameter.Location:
                groupedData = from v in vehicles
                              group v by v.LOCATION.location1
                              into gd
                              select gd;
                break;
            }

            if (groupedData == null)
            {
                return(null);
            }


            var compData = from gd in groupedData
                           select new AgeingRow
            {
                Key        = gd.Key,
                FleetCount = gd.Count(),
                Ages       = gd.Select(d => d.DaysInCountry).ToList()
            };
            var returned = compData.ToList();

            return(returned);
        }
コード例 #5
0
        public List <HistoricalTrendRow> GetHistoricAgeRowData()
        {
            var vehicleHistories = BaseVehicleDataAccess.GetVehicleHistoryQueryable(Parameters, DataContext, true, true);

            if (vehicleHistories == null)
            {
                return(new List <HistoricalTrendRow>());
            }

            var startDate = Parameters.GetDateFromDictionary(DictionaryParameter.StartDate);
            var endDate   = Parameters.GetDateFromDictionary(DictionaryParameter.EndDate);

            var daysInCountry = 0;

            if (Parameters.ContainsValueAndIsntEmpty(DictionaryParameter.MinDaysInCountry))
            {
                daysInCountry = int.Parse(Parameters[DictionaryParameter.MinDaysInCountry]);
            }

            vehicleHistories = from vh in vehicleHistories
                               where vh.TimeStamp >= startDate &&
                               vh.TimeStamp <= endDate &&
                               vh.IsFleet &&
                               vh.DaysInCountry >= daysInCountry
                               select vh;

            vehicleHistories = VehicleFieldRestrictions.RestrictVehicleHistoryByIdleInForeignCountry(vehicleHistories);


            var comparisonType = ComparisonLevelLookup.GetSiteComparisonTypeFromParameters(Parameters);

            IQueryable <HistoricalTrendRow> historicalTrendData = null;

            switch (comparisonType)
            {
            case DictionaryParameter.LocationCountry:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.COUNTRy1.country_description }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.country_description,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };
                break;

            case DictionaryParameter.Pool:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.CMS_LOCATION_GROUP.CMS_POOL.cms_pool1 }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.cms_pool1,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };

                break;

            case DictionaryParameter.LocationGroup:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.CMS_LOCATION_GROUP.cms_location_group1 }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.cms_location_group1,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };
                break;

            case DictionaryParameter.Area:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.OPS_AREA.ops_area1 }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.ops_area1,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };
                break;

            case DictionaryParameter.Region:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.OPS_AREA.OPS_REGION.ops_region1 }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.ops_region1,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };
                break;

            case DictionaryParameter.Location:
                historicalTrendData = from v in vehicleHistories
                                      group v by new { v.TimeStamp.Date, v.LOCATION.location1 }
                into gd
                    select new HistoricalTrendRow
                {
                    ColumnCode = gd.Key.location1,
                    CodeCount  = gd.Count(),
                    Date       = gd.Key.Date
                };
                break;
            }


            if (historicalTrendData == null)
            {
                return(new List <HistoricalTrendRow>());
            }

            var returned = historicalTrendData.ToList();

            return(returned);
        }