private static IQueryable <GenericSizingHolder> GetFleetSizeFutureTrendData(MarsDBDataContext dc, Dictionary <string, string> parameters, int fleetPlan = 1) { var fullFleetSizeDataSet = from fsft in dc.FleetSizeFutureTrends select fsft; var restrictedData = ForecastParameterRestriction.RestrictFutureTrendDataByParameters(parameters, fullFleetSizeDataSet, dc, fleetPlan); var futureTrendData = from ftd in restrictedData //join lg in dc.CMS_LOCATION_GROUPs on ftd.LocGrpId equals lg.cms_location_group_id //Comment to include differnt country Nessesary Fleet Calculations //join pools in dc.CMS_POOLs on lg.cms_pool_id equals pools.cms_pool_id //where pools.country == ftd.Country select new GenericSizingHolder { Date = ftd.TargetDate, Country = ftd.Country, LocationGroupId = ftd.LocGrpId, CarClassId = ftd.CarGrpId, ExpectedFleet = ftd.ExpectedFleet, }; return(futureTrendData); }
internal static IQueryable <ForecastRawDataHolder> GetFrozenZoneForecastRawData(Dictionary <string, string> parameters, MarsDBDataContext dataContext) { var fullDataSet = from fc in dataContext.MARS_CMS_FORECAST_HISTORies select fc; var restrictedData = ForecastParameterRestriction.RestrictHistoricalForecastByParameters(parameters, fullDataSet, dataContext); var joinedData = from rd in restrictedData join adj in dataContext.MARS_CMS_FORECAST_ADJUSTMENTs on new { rd.REP_DATE, rd.CMS_LOCATION_GROUP_ID, rd.CAR_CLASS_ID } equals new { adj.REP_DATE, adj.CMS_LOCATION_GROUP_ID, adj.CAR_CLASS_ID } into adj from joinedAdjustment in adj.DefaultIfEmpty() select new ForecastRawDataHolder() { ReportDate = rd.REP_DATE, LocationGroupId = rd.CMS_LOCATION_GROUP_ID, CarClassId = rd.CAR_CLASS_ID, OnRent = rd.CURRENT_ONRENT ?? 0, OnRentLy = rd.ONRENT_LY ?? 0, Constrained = rd.CMS_CONSTRAINED ?? 0, Unconstrained = rd.CMS_UNCONSTRAINED ?? 0, Fleet = 0, AlreadyBooked = 0, TopDown = joinedAdjustment.ADJUSTMENT_TD ?? 0, BottomUp1 = joinedAdjustment.ADJUSTMENT_BU1 ?? 0, BottomUp2 = joinedAdjustment.ADJUSTMENT_BU2 ?? 0, Reconciliation = joinedAdjustment.ADJUSTMENT_RC ?? 0 }; return(joinedData); }
private static IQueryable <MARS_CMS_FORECAST> GetRawSizingCmsData(MarsDBDataContext dc, Dictionary <string, string> parameters) { var fullCmsDataSet = from cfv in dc.MARS_CMS_FORECASTs select cfv; var restrictedCmsData = ForecastParameterRestriction.RestrictMarsCmsForecastByParameters(parameters, fullCmsDataSet, dc); return(restrictedCmsData); }
internal static IQueryable <MARS_CMS_FORECAST_HISTORY> GetBenchmarkRawData(IDictionary <string, string> parameters, MarsDBDataContext dataContext) { var fullDataSet = from fc in dataContext.MARS_CMS_FORECAST_HISTORies select fc; var restrictedData = ForecastParameterRestriction.RestrictHistoricalForecastByParameters(parameters, fullDataSet, dataContext); return(restrictedData); }
private static IQueryable <MARS_CMS_NECESSARY_FLEET> GetRawSizingNessFleetData(MarsDBDataContext dc, Dictionary <string, string> parameters) { var fullNessesaryFleetSet = from nf in dc.MARS_CMS_NECESSARY_FLEETs select nf; var restrictedNessesaryFleetData = ForecastParameterRestriction.RestrictMarsCmsNessesaryFleetByParameters(parameters, fullNessesaryFleetSet, dc); return(restrictedNessesaryFleetData); }
internal static IQueryable <FutureTrendOrSupplyAnalysisRawDataHolder> GetRawFrozenZoneFutureTrendData(MarsDBDataContext dataContext, Dictionary <string, string> parameters, byte scenarioId) { var country = parameters.ContainsKey(ParameterNames.Country) ? parameters[ParameterNames.Country] : null; var fromDate = DateTime.Parse(parameters.ContainsKey(ParameterNames.FromDate) ? parameters[ParameterNames.FromDate] : null); var toDate = DateTime.Parse(parameters.ContainsKey(ParameterNames.ToDate) ? parameters[ParameterNames.ToDate] : null); var fullDataSet = from fc in dataContext.MARS_CMS_FORECAST_HISTORies select fc; var restrictedData = ForecastParameterRestriction.RestrictHistoricalForecastByParameters(parameters, fullDataSet, dataContext); var joinedData = from rd in restrictedData join nf in dataContext.MARS_CMS_NECESSARY_FLEETs on new { rd.CMS_LOCATION_GROUP_ID, rd.CAR_CLASS_ID } equals new { nf.CMS_LOCATION_GROUP_ID, nf.CAR_CLASS_ID } into nessearyFleetDetails from joinednessFleetDetails in nessearyFleetDetails.DefaultIfEmpty() join fps in dataContext.FleetPlanSummary(country == String.Empty ? null : country, scenarioId, fromDate, toDate) on new { date = (DateTime?)rd.REP_DATE, classId = rd.CAR_CLASS_ID, locGroupId = rd.CMS_LOCATION_GROUP_ID } equals new { date = fps.targetDate, classId = fps.CAR_CLASS_ID.Value, locGroupId = fps.LOCATION_GROUP_ID.Value } into fleetDetails from joinedFleetDetails in fleetDetails.DefaultIfEmpty() select new FutureTrendOrSupplyAnalysisRawDataHolder { ReportDate = rd.REP_DATE, Constrained = rd.CMS_CONSTRAINED_FROZEN ?? 0, Unconstrained = rd.CMS_UNCONSTRAINED_FROZEN ?? 0, Booked = 0, Utilization = joinednessFleetDetails.UTILISATION ?? 0, NonRevFleet = joinednessFleetDetails.NONREV_FLEET ?? 0, OnRent = rd.CURRENT_ONRENT ?? 0, NessesaryConstrained = joinednessFleetDetails.UTILISATION == 0 ? 0 : (rd.CMS_CONSTRAINED_FROZEN / joinednessFleetDetails.UTILISATION * HUNDRED) + (joinednessFleetDetails.NONREV_FLEET * rd.CMS_CONSTRAINED_FROZEN / HUNDRED) ?? rd.CMS_CONSTRAINED_FROZEN ?? 0, NessesaryUnconstrained = joinednessFleetDetails.UTILISATION == 0 ? 0 : (rd.CMS_UNCONSTRAINED_FROZEN / joinednessFleetDetails.UTILISATION * HUNDRED) + (joinednessFleetDetails.NONREV_FLEET * rd.CMS_UNCONSTRAINED_FROZEN / HUNDRED) ?? rd.CMS_UNCONSTRAINED_FROZEN ?? 0, NessesaryBooked = 0, Expected = rd.OPERATIONAL_FLEET ?? 0 + joinedFleetDetails.amount.GetValueOrDefault(0), LocationGroupId = rd.CMS_LOCATION_GROUP_ID, CarClassId = rd.CAR_CLASS_ID, Country = rd.COUNTRY }; return(joinedData); }
internal static IQueryable <KpiRawDataHolderOld> GetFrozenZoneRawKpiData(MarsDBDataContext dataContext, Dictionary <string, string> parameters) { var fullDataSet = from fc in dataContext.MARS_CMS_FORECAST_HISTORies select fc; var restrictedData = ForecastParameterRestriction.RestrictHistoricalForecastByParameters(parameters, fullDataSet, dataContext); var joinedData = from rd in restrictedData select new KpiRawDataHolderOld { OnRent = rd.CURRENT_ONRENT ?? 0, OperationalFleet = rd.OPERATIONAL_FLEET ?? 0 + rd.FLEET_MOVEMENT_FROZEN ?? 0, IdleFleet = (rd.TOTAL_FLEET - rd.CURRENT_ONRENT) ?? 0, TotalFleet = rd.TOTAL_FLEET ?? 0, ReportDate = rd.REP_DATE, Country = rd.COUNTRY }; return(joinedData); }