private static async Task <MarketMappingViewModel> GetFullAndPartialViewModelForMarketMapping
        (
            IDataContext context,
            MarketMappingFilter filter
        )
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new MarketMappingViewModel()
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };
            var marketMapping = await context.Market.GetFdpMarketMapping(filter);

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = marketMapping.ProgrammeId,
                Gateway     = marketMapping.Gateway,
                Code        = model.MarketMapping.Programme.VehicleName // In order to filter the gateways specific to the programme
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);
            model.Gateways = context.Vehicle.ListGateways(programmeFilter);

            if (!(marketMapping is EmptyFdpMarketMapping))
            {
                marketMapping.Programme = model.Programmes.FirstOrDefault(p => p.Id == marketMapping.ProgrammeId.GetValueOrDefault());
            }
            model.MarketMapping = marketMapping;

            return(model);
        }
        private static async Task <FeatureViewModel> GetFullAndPartialViewModelForFeatures(IDataContext context,
                                                                                           FeatureFilter filter)
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new FeatureViewModel()
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = filter.ProgrammeId,
                Gateway     = filter.Gateway
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);

            model.Features = await context.Vehicle.ListFdpFeatures(filter);

            model.TotalPages          = model.Features.TotalPages;
            model.TotalRecords        = model.Features.TotalRecords;
            model.TotalDisplayRecords = model.Features.TotalDisplayRecords;

            foreach (var feature in model.Features.CurrentPage)
            {
                feature.Programme = model.Programmes.FirstOrDefault(p => p.Id == feature.ProgrammeId.GetValueOrDefault());
            }

            return(model);
        }
        private static DerivativeMappingViewModel GetFullAndPartialViewModel(IDataContext context,
                                                                             DerivativeMappingFilter filter)
        {
            var model = new DerivativeMappingViewModel(SharedModelBase.GetBaseModel(context))
            {
                Configuration = context.ConfigurationSettings,
            };

            HydrateModelWithCommonProperties(model, context);

            return(model);
        }
Exemplo n.º 4
0
        private static async Task <ForecastComparisonViewModel> GetFullAndPartialViewModelForForecasts(IDataContext context,
                                                                                                       ForecastFilter filter)
        {
            var modelBase = SharedModelBase.GetBaseModel(context);
            var model     = new ForecastComparisonViewModel(modelBase)
            {
                PageIndex     = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize      = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration = context.ConfigurationSettings
            };

            model.Forecasts = await context.Forecast.ListForecasts(filter);

            return(model);
        }
        private static async Task <DerivativeMappingViewModel> GetFullAndPartialViewModelForDerivativeMapping
        (
            IDataContext context,
            DerivativeMappingFilter filter
        )
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new DerivativeMappingViewModel()
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };
            var derivativeMapping = await context.Vehicle.GetFdpDerivativeMapping(filter);

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = derivativeMapping.ProgrammeId,
                Gateway     = derivativeMapping.Gateway,
                Code        = model.DerivativeMapping.Programme.VehicleName // In order to filter the gateways specific to the programme
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);
            model.Gateways = context.Vehicle.ListGateways(programmeFilter);

            // If we are copying to another gateway, we need to remove the source gateway from the list of available gateways
            if (filter.Action == DerivativeMappingAction.Copy)
            {
                model.Gateways = model.Gateways.Where(g => !(g.Name.Equals(derivativeMapping.Gateway, StringComparison.InvariantCultureIgnoreCase)));
            }

            if (!(derivativeMapping is EmptyFdpDerivativeMapping))
            {
                derivativeMapping.Programme    = model.Programmes.FirstOrDefault(p => p.Id == derivativeMapping.ProgrammeId.GetValueOrDefault());
                derivativeMapping.Body         = model.Bodies.FirstOrDefault(b => b.Id == derivativeMapping.BodyId);
                derivativeMapping.Engine       = model.Engines.FirstOrDefault(e => e.Id == derivativeMapping.EngineId);
                derivativeMapping.Transmission = model.Transmissions.FirstOrDefault(t => t.Id == derivativeMapping.TransmissionId);
            }
            model.DerivativeMapping = derivativeMapping;

            return(model);
        }
        private static async Task <IgnoredExceptionViewModel> GetFullAndPartialViewModelForIgnoredExceptions
        (
            IDataContext context,
            IgnoredExceptionFilter filter
        )
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new IgnoredExceptionViewModel(baseModel)
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = filter.ProgrammeId,
                Gateway     = filter.Gateway
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);

            model.IgnoredExceptions = await context.Import.ListFdpIgnoredExceptions(filter);

            model.TotalPages          = model.IgnoredExceptions.TotalPages;
            model.TotalRecords        = model.IgnoredExceptions.TotalRecords;
            model.TotalDisplayRecords = model.IgnoredExceptions.TotalDisplayRecords;

            foreach (var ignoredException in model.IgnoredExceptions.CurrentPage)
            {
                ignoredException.Programme = model.Programmes.FirstOrDefault(p => p.Id == ignoredException.ProgrammeId.GetValueOrDefault());
                ignoredException.Document  =
                    model.Documents.FirstOrDefault(d => d.Id == ignoredException.DocumentId.GetValueOrDefault());
            }

            return(model);
        }
        private static async Task <DerivativeViewModel> GetFullAndPartialViewModelForDerivatives(IDataContext context,
                                                                                                 DerivativeFilter filter)
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new DerivativeViewModel()
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = filter.ProgrammeId,
                Gateway     = filter.Gateway
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);

            model.Derivatives = await context.Vehicle.ListFdpDerivatives(filter);

            model.TotalPages          = model.Derivatives.TotalPages;
            model.TotalRecords        = model.Derivatives.TotalRecords;
            model.TotalDisplayRecords = model.Derivatives.TotalDisplayRecords;

            foreach (var derivative in model.Derivatives.CurrentPage)
            {
                derivative.Programme    = model.Programmes.FirstOrDefault(p => p.Id == derivative.ProgrammeId.GetValueOrDefault());
                derivative.Body         = model.Bodies.FirstOrDefault(b => b.Id == derivative.BodyId);
                derivative.Engine       = model.Engines.FirstOrDefault(e => e.Id == derivative.EngineId);
                derivative.Transmission = model.Transmissions.FirstOrDefault(t => t.Id == derivative.TransmissionId);
            }

            return(model);
        }
        private static async Task <IgnoredExceptionViewModel> GetFullAndPartialViewModelForIgnoredException
        (
            IDataContext context,
            IgnoredExceptionFilter filter
        )
        {
            var baseModel = SharedModelBase.GetBaseModel(context);
            var model     = new IgnoredExceptionViewModel()
            {
                PageIndex      = filter.PageIndex.HasValue ? filter.PageIndex.Value : 1,
                PageSize       = filter.PageSize.HasValue ? filter.PageSize.Value : Int32.MaxValue,
                Configuration  = context.ConfigurationSettings,
                CurrentUser    = baseModel.CurrentUser,
                CurrentVersion = baseModel.CurrentVersion
            };
            var ignoredException = await context.Import.GetFdpImportErrorExclusion(filter);

            var programmeFilter = new ProgrammeFilter()
            {
                ProgrammeId = ignoredException.ProgrammeId,
                Gateway     = ignoredException.Gateway,
                Code        = model.IgnoredException.Programme.VehicleName // In order to filter the gateways specific to the programme
            };

            HydrateModelWithCommonProperties(model, context, programmeFilter);
            model.Gateways = context.Vehicle.ListGateways(programmeFilter);

            if (!(ignoredException is EmptyFdpImportErrorExclusion))
            {
                ignoredException.Programme = model.Programmes.FirstOrDefault(p => p.Id == ignoredException.ProgrammeId.GetValueOrDefault());
                ignoredException.Document  =
                    model.Documents.FirstOrDefault(d => d.Id == ignoredException.DocumentId.GetValueOrDefault());
            }
            model.IgnoredException = ignoredException;

            return(model);
        }
 public NewsViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     
 }
 public FeatureMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public ImportViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
Exemplo n.º 12
0
 public ForecastComparisonViewModel(SharedModelBase modelBase) : base(modelBase)
 {
     InitialiseMembers();
 }
 public IgnoredExceptionViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public IgnoredExceptionViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public MarketReviewViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
Exemplo n.º 16
0
 public NewsViewModel(SharedModelBase baseModel) : base(baseModel)
 {
 }
 public MarketMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public TakeRateViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public DerivativeMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
Exemplo n.º 20
0
 public FdpOxoVolumeViewModel(SharedModelBase modelBase) : base(modelBase)
 {
     InitialiseMembers();
 }
 public DerivativeMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public MarketMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
Exemplo n.º 23
0
 public HomeViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
 public ForecastComparisonViewModel(SharedModelBase modelBase) : base(modelBase)
 {
     InitialiseMembers();
 }
 public FeatureMappingViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }
Exemplo n.º 26
0
 public AdminViewModel(SharedModelBase baseModel) : base(baseModel)
 {
 }
        public AdminViewModel(SharedModelBase baseModel) : base(baseModel)
        {

        }
 public MarketReviewViewModel(SharedModelBase baseModel) : base(baseModel)
 {
     InitialiseMembers();
 }