private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForTakeRateDataPageExcludingData(IDataContext context, TakeRateFilter filter)
        {
            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document           = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration      = context.ConfigurationSettings,
                MarketReviewStatus = filter.MarketReviewStatus,
                Filter             = filter.Filter
            };

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateFdpVolumeHeader(context, takeRateModel);

            //await HydrateFdpVolumeHeadersFromOxoDocument(context, takeRateModel);
            await HydrateVehicle(context, takeRateModel);
            await HydrateMarket(context, takeRateModel);
            await HydrateMarketGroup(context, takeRateModel);
            await HydrateMarketGroups(context, takeRateModel);
            await HydrateModelsByMarket(context, takeRateModel);
            await HydrateMarketReview(context, takeRateModel);
            await HydratePublish(context, takeRateModel);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetPartialViewModelForTakeRateDataPage(IDataContext context, TakeRateFilter filter)
        {
            var watch = Stopwatch.StartNew();

            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document = (TakeRateDocument)TakeRateDocument.FromFilter(filter), Configuration = context.ConfigurationSettings
            };

            takeRateModel.Document.PageIndex = filter.PageIndex;
            takeRateModel.Document.PageSize  = filter.PageSize;
            if (takeRateModel.Document.PageSize == -1)
            {
                takeRateModel.Document.PageSize = int.MaxValue;
            }

            if (!takeRateModel.Document.PageIndex.HasValue)
            {
                takeRateModel.Document.PageIndex = 1;
            }
            if (!takeRateModel.Document.PageSize.HasValue)
            {
                var configuredPageSize = context.ConfigurationSettings.GetInteger("TakeRateDataPageSize");
                if (configuredPageSize == -1)
                {
                    configuredPageSize = int.MaxValue;
                }
                takeRateModel.Document.PageSize = configuredPageSize;
            }
            takeRateModel.Document.ShowCombinedPackOptions  = filter.ShowCombinedPackOptions;
            takeRateModel.Document.ExcludeOptionalPackItems = filter.ExcludeOptionalPackItems;

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateFdpVolumeHeader(context, takeRateModel);

            //await HydrateFdpVolumeHeadersFromOxoDocument(context, takeRateModel);
            await HydrateVehicle(context, takeRateModel);
            await HydrateMarket(context, takeRateModel);
            await HydrateMarketGroup(context, takeRateModel);
            await HydrateMarketGroups(context, takeRateModel);
            await HydrateModelsByMarket(context, takeRateModel);
            await HydrateData(context, takeRateModel);

            //await HydrateDataFeatures(context, takeRateModel);
            await HydrateMarketReview(context, takeRateModel);
            await HydratePublish(context, takeRateModel);

            watch.Stop();
            Log.Debug("GetFullAndPartialViewModelForTakeRateDataPage : " + watch.ElapsedMilliseconds);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForPowertrain(IDataContext context, TakeRateFilter filter)
        {
            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document      = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration = context.ConfigurationSettings
            };

            await HydrateFdpVolumeHeader(context, takeRateModel);
            await HydratePowertrain(context, takeRateModel);
            await HydratePublish(context, takeRateModel);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForFilter(IDataContext context,
                                                                                          TakeRateFilter filter)
        {
            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document           = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration      = context.ConfigurationSettings,
                MarketReviewStatus = filter.MarketReviewStatus,
                Filter             = filter.Filter
            };

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateFdpVolumeHeader(context, takeRateModel);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetViewModelForTakeRateDataPage(IDataContext context,
                                                                                      TakeRateFilter filter)
        {
            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document      = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration = context.ConfigurationSettings
            };

            takeRateModel.Document.PageIndex = filter.PageIndex;
            takeRateModel.Document.PageSize  = filter.PageSize;
            if (takeRateModel.Document.PageSize == -1)
            {
                takeRateModel.Document.PageSize = int.MaxValue;
            }

            if (!takeRateModel.Document.PageIndex.HasValue)
            {
                takeRateModel.Document.PageIndex = 1;
            }
            if (!takeRateModel.Document.PageSize.HasValue)
            {
                var configuredPageSize = context.ConfigurationSettings.GetInteger("TakeRateDataPageSize");
                if (configuredPageSize == -1)
                {
                    configuredPageSize = int.MaxValue;
                }
                takeRateModel.Document.PageSize = configuredPageSize;
            }

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateFdpVolumeHeader(context, takeRateModel);

            await HydrateVehicle(context, takeRateModel);
            await HydrateMarket(context, takeRateModel);
            await HydrateMarketGroups(context, takeRateModel);

            await HydrateModels(context, takeRateModel);
            await HydrateFeatures(context, takeRateModel);

            await HydrateMarketReview(context, takeRateModel);
            await HydratePublish(context, takeRateModel);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForValidation(IDataContext context, TakeRateFilter filter)
        {
            var watch = Stopwatch.StartNew();

            var modelBase     = GetBaseModel(context);
            var takeRateModel = new TakeRateViewModel(modelBase)
            {
                Document      = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration = context.ConfigurationSettings
            };

            await HydrateFdpVolumeHeader(context, takeRateModel);
            await HydrateRawData(context, takeRateModel);

            watch.Stop();
            Log.Debug("GetFullAndPartialViewModelForTakeRateDataPage : " + watch.ElapsedMilliseconds);

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForClone(IDataContext context,
                                                                                         TakeRateFilter filter)
        {
            var takeRateModel = new TakeRateViewModel(GetBaseModel(context))
            {
                Document      = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration = context.ConfigurationSettings,
            };

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateFdpVolumeHeader(context, takeRateModel);
            await HydrateVehicle(context, takeRateModel);

            takeRateModel.AvailableProgrammes = await
                                                Task.FromResult(context.Vehicle.ListProgrammes(new ProgrammeFilter()));

            takeRateModel.AvailableDocuments = await
                                               Task.FromResult(context.Vehicle.ListPublishedDocuments(new ProgrammeFilter()));

            return(takeRateModel);
        }
        private static async Task <TakeRateViewModel> GetFullAndPartialViewModelForTakeRateDataItem(IDataContext context, TakeRateFilter filter)
        {
            var takeRateModel = new TakeRateViewModel(GetBaseModel(context))
            {
                Document                = (TakeRateDocument)TakeRateDocument.FromFilter(filter),
                Configuration           = context.ConfigurationSettings,
                CurrentTakeRateDataItem = await context.TakeRate.GetDataItem(filter)
            };

            await HydrateOxoDocument(context, takeRateModel);
            await HydrateVehicle(context, takeRateModel);
            await HydrateMarket(context, takeRateModel);
            await HydrateMarketGroup(context, takeRateModel);
            await HydrateModelsByMarket(context, takeRateModel);
            await HydrateFeatures(context, takeRateModel);
            await HydrateCurrentModel(context, takeRateModel);
            await HydrateCurrentFeature(context, takeRateModel);
            await HydratePublish(context, takeRateModel);

            return(takeRateModel);
        }
예제 #9
0
 public async Task <ITakeRateDocument> GetTakeRateDocument(TakeRateFilter filter)
 {
     return(await Task.FromResult(TakeRateDocument.FromFilter(filter)));
 }