Пример #1
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));
        }
Пример #2
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));
        }