예제 #1
0
        public async Task <ActionResult> MapOxoTrim(ImportExceptionParameters parameters)
        {
            var filter = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault());

            var trim       = ModelTrim.FromIdentifier(parameters.TrimIdentifier);
            var importView = await GetModelFromParameters(parameters);

            var importTrimLevels = (IEnumerable <string>)TempData["MapOxoTrim"];

            foreach (var importTrimLevel in importTrimLevels)
            {
                var trimMapping = new FdpTrimMapping()
                {
                    ImportTrim  = importTrimLevel,
                    DocumentId  = parameters.DocumentId.GetValueOrDefault(),
                    ProgrammeId = parameters.ProgrammeId.GetValueOrDefault(),
                    Gateway     = parameters.Gateway,
                    TrimId      = trim.Id
                };

                await DataContext.Import.MapTrim(filter, trimMapping);
            }
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #2
0
        public async Task <ActionResult> MapMissingTrim(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var trimMapping = new FdpTrimMapping()
            {
                ImportTrim  = parameters.ImportTrim,
                ProgrammeId = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway     = parameters.Gateway,
                DocumentId  = parameters.DocumentId
            };

            if (!string.IsNullOrEmpty(parameters.TrimIdentifier))
            {
                if (parameters.TrimIdentifier.StartsWith("F"))
                {
                    trimMapping.FdpTrimId = int.Parse(parameters.TrimIdentifier.Substring(1));
                }
                else
                {
                    trimMapping.TrimId = int.Parse(parameters.TrimIdentifier.Substring(1));
                }
            }
            importView.CurrentException = await DataContext.Import.MapTrim(filter, trimMapping);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public async Task <ActionResult> MapOxoFeature(ImportExceptionParameters parameters)
        {
            var filter = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault());

            var feature    = FdpFeature.FromIdentifier(parameters.FeatureIdentifier);
            var importView = await GetModelFromParameters(parameters);

            var importFeatures = (IEnumerable <string>)TempData["MapOxoFeature"];

            foreach (var importFeature in importFeatures)
            {
                var featureMapping = new FdpFeatureMapping()
                {
                    ImportFeatureCode = importFeature,
                    DocumentId        = parameters.DocumentId.GetValueOrDefault(),
                    ProgrammeId       = parameters.ProgrammeId.GetValueOrDefault(),
                    Gateway           = parameters.Gateway,
                    FeatureCode       = feature.FeatureCode
                };
                if (feature.FeaturePackId.HasValue)
                {
                    featureMapping.FeaturePackId = feature.FeaturePackId;
                }
                else
                {
                    featureMapping.FeatureId = feature.FeatureId;
                }

                await DataContext.Import.MapFeature(filter, featureMapping);
            }
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #4
0
        public async Task <ActionResult> MapMissingDerivative(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault());
            var derivative = Derivative.FromIdentifier(parameters.DerivativeCode);
            var importView = await GetModelFromParameters(parameters);

            //var derivative = importView.AvailableDerivatives
            //    .First(d => d.DerivativeCode.Equals(parameters.DerivativeCode, StringComparison.InvariantCultureIgnoreCase));

            var derivativeMapping = new FdpDerivativeMapping()
            {
                ImportDerivativeCode = parameters.ImportDerivativeCode,

                DocumentId     = parameters.DocumentId.GetValueOrDefault(),
                ProgrammeId    = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway        = parameters.Gateway,
                DerivativeCode = derivative.DerivativeCode,
                BodyId         = derivative.BodyId.GetValueOrDefault(),
                EngineId       = derivative.EngineId.GetValueOrDefault(),
                TransmissionId = derivative.TransmissionId.GetValueOrDefault()
            };

            importView.CurrentException = await DataContext.Import.MapDerivative(filter, derivativeMapping);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #5
0
        public async Task <ActionResult> MapOxoDerivative(ImportExceptionParameters parameters)
        {
            var filter = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault());

            var derivative = Derivative.FromIdentifier(parameters.DerivativeCode);
            var importView = await GetModelFromParameters(parameters);

            var importDerivatives = (IEnumerable <string>)TempData["MapOxoDerivative"];

            foreach (var importDerivative in importDerivatives)
            {
                var derivativeMapping = new FdpDerivativeMapping()
                {
                    ImportDerivativeCode = importDerivative,
                    DocumentId           = parameters.DocumentId.GetValueOrDefault(),
                    ProgrammeId          = parameters.ProgrammeId.GetValueOrDefault(),
                    Gateway        = parameters.Gateway,
                    DerivativeCode = derivative.DerivativeCode,
                    BodyId         = derivative.BodyId.GetValueOrDefault(),
                    EngineId       = derivative.EngineId.GetValueOrDefault(),
                    TransmissionId = derivative.TransmissionId.GetValueOrDefault()
                };

                await DataContext.Import.MapDerivative(filter, derivativeMapping);
            }
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #6
0
        public async Task <ActionResult> AddSpecialFeature(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var importFeatures = (IEnumerable <string>)TempData["AddSpecialFeature"];

            foreach (var importFeature in importFeatures)
            {
                var specialFeature = new FdpSpecialFeature()
                {
                    DocumentId  = parameters.DocumentId.GetValueOrDefault(),
                    ProgrammeId = parameters.ProgrammeId.GetValueOrDefault(),
                    Gateway     = parameters.Gateway,
                    FeatureCode = importFeature,
                    Type        = new FdpSpecialFeatureType()
                    {
                        FdpSpecialFeatureTypeId = parameters.SpecialFeatureTypeId
                    }
                };

                await DataContext.Import.AddSpecialFeature(filter, specialFeature);
            }
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        private async Task <ImportError> DeactivateException(ImportError exception)
        {
            var filter = ImportQueueFilter.FromExceptionId(exception.FdpImportErrorId);

            filter.IsActive = false;

            return(await DataContext.Import.SaveException(filter));
        }
예제 #8
0
        public async Task <ActionResult> IgnoreException(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            importView.CurrentException = await DataContext.Import.IgnoreException(filter);

            //await DeactivateException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        public async Task <ActionResult> ContextMenu(ImportExceptionParameters parameters)
        {
            ImportExceptionParametersValidator
            .ValidateImportExceptionParameters(parameters, ImportExceptionParametersValidator.ExceptionIdentifier);

            var importView = await ImportViewModel.GetModel(
                DataContext,
                ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault()));

            return(PartialView("_ContextMenu", importView));
        }
예제 #10
0
        public async Task <ActionResult> IgnoreAll(ImportExceptionParameters parameters)
        {
            parameters.ExceptionIds = (IEnumerable <int>)TempData["IgnoreAll"];
            var exceptionIds    = parameters.ExceptionIds as IList <int> ?? parameters.ExceptionIds.ToList();
            var lastExceptionId = exceptionIds.Last();

            foreach (var exceptionId in exceptionIds)
            {
                var filter = ImportQueueFilter.FromExceptionId(exceptionId);
                await DataContext.Import.IgnoreException(filter, exceptionId == lastExceptionId);
            }
            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #11
0
 private async Task <ImportViewModel> GetModelFromParameters(ImportExceptionParameters parameters)
 {
     if (parameters.Action == ImportAction.ProcessTakeRateData)
     {
         return(await ImportViewModel.GetModel(
                    DataContext,
                    new ImportQueueFilter(parameters.ImportQueueId.GetValueOrDefault()) { Action = parameters.Action },
                    parameters.Action));
     }
     return(await ImportViewModel.GetModel(
                DataContext,
                ImportQueueFilter.FromExceptionId(parameters.ExceptionId.GetValueOrDefault()),
                parameters.Action));
 }
예제 #12
0
        public async Task <ActionResult> MapMissingMarket(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var marketMapping = new FdpMarketMapping()
            {
                ImportMarket    = parameters.ImportMarket,
                MarketId        = parameters.MarketId,
                ProgrammeId     = parameters.ProgrammeId,
                Gateway         = parameters.Gateway,
                IsGlobalMapping = parameters.IsGlobalMapping
            };

            importView.CurrentException = await DataContext.Import.MapMarket(filter, marketMapping);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #13
0
        public async Task <ActionResult> AddMissingFeature(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var feature = new FdpFeature()
            {
                ProgrammeId      = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway          = parameters.Gateway,
                FeatureCode      = parameters.ImportFeatureCode,
                BrandDescription = parameters.FeatureDescription,
                FeatureGroupId   = parameters.FeatureGroupId
            };

            importView.CurrentException = await DataContext.Import.AddFeature(filter, feature);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #14
0
        public async Task <ActionResult> AddMissingDerivative(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var derivative = new FdpDerivative()
            {
                ProgrammeId    = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway        = parameters.Gateway,
                DerivativeCode = parameters.DerivativeCode,
                BodyId         = parameters.BodyId.GetValueOrDefault(),
                EngineId       = parameters.EngineId.GetValueOrDefault(),
                TransmissionId = parameters.TransmissionId.GetValueOrDefault()
            };

            importView.CurrentException = await DataContext.Import.AddDerivative(filter, derivative);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #15
0
        public async Task <ActionResult> AddMissingTrim(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var trim = new FdpTrim()
            {
                ProgrammeId  = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway      = parameters.Gateway,
                Name         = parameters.TrimName,
                Abbreviation = parameters.TrimAbbreviation,
                Level        = parameters.TrimLevel,
                DPCK         = parameters.DPCK,
                BMC          = parameters.DerivativeCode
            };

            importView.CurrentException = await DataContext.Import.AddTrim(filter, trim);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }
예제 #16
0
        public async Task <ActionResult> MapMissingFeature(ImportExceptionParameters parameters)
        {
            var filter     = ImportQueueFilter.FromExceptionId(parameters.ExceptionId.Value);
            var importView = await GetModelFromParameters(parameters);

            var feature = importView.AvailableFeatures
                          .First(f => f.FeatureCode.Equals(parameters.FeatureCode, StringComparison.InvariantCultureIgnoreCase));

            var featureMapping = new FdpFeatureMapping()
            {
                ImportFeatureCode = parameters.ImportFeatureCode,
                ProgrammeId       = parameters.ProgrammeId.GetValueOrDefault(),
                Gateway           = parameters.Gateway,
                FeatureId         = feature.FeatureId,
                FeaturePackId     = feature.FeaturePackId
            };

            importView.CurrentException = await DataContext.Import.MapFeature(filter, featureMapping);
            await DeactivateException(importView.CurrentException);
            await ReProcessException(importView.CurrentException);

            return(Json(JsonActionResult.GetSuccess(), JsonRequestBehavior.AllowGet));
        }