Exemple #1
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));
        }
Exemple #2
0
        public FdpFeature FdpFeatureSave(FdpFeature feature)
        {
            FdpFeature retVal = new EmptyFdpFeature();

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@ProgrammeId", feature.ProgrammeId.GetValueOrDefault(), DbType.Int32);
                    para.Add("@Gateway", feature.Gateway, DbType.String);
                    para.Add("@FeatureCode", feature.FeatureCode, DbType.String);
                    para.Add("@FeatureGroupId", feature.FeatureGroupId, DbType.Int32);
                    para.Add("@FeatureDescription", feature.BrandDescription, DbType.String);

                    retVal = conn.Query <FdpFeature>("dbo.Fdp_Feature_Save", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
Exemple #3
0
        public async Task <ActionResult> Delete(FeatureParameters parameters)
        {
            var derivativeView = await GetModelFromParameters(parameters);

            if (derivativeView.Feature is EmptyFdpFeature)
            {
                return(JsonGetFailure(string.Format("Feature does not exist", parameters.FeatureId)));
            }

            derivativeView.Feature = await DataContext.Vehicle.DeleteFdpFeature(FdpFeature.FromParameters(parameters));

            if (derivativeView.Feature is EmptyFdpFeature)
            {
                return(JsonGetFailure(string.Format("Feature '{0}' could not be deleted", derivativeView.Feature.FeatureCode)));
            }

            return(JsonGetSuccess());
        }
Exemple #4
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));
        }
Exemple #5
0
        public FdpFeature FdpFeatureDelete(FdpFeature featureToDelete)
        {
            FdpFeature retVal = new EmptyFdpFeature();

            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = DynamicParameters.FromCDSId(CurrentCDSID);
                    para.Add("@FdpFeatureId", featureToDelete.FdpFeatureId.GetValueOrDefault(), DbType.Int32);

                    retVal = conn.Query <FdpFeature>("dbo.Fdp_Feature_Delete", para, commandType: CommandType.StoredProcedure).FirstOrDefault();
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return(retVal);
        }
        // Features and mappings

        public async Task <FdpFeature> DeleteFdpFeature(FdpFeature featureToDelete)
        {
            return(await Task.FromResult(_featureDataStore.FdpFeatureDelete(featureToDelete)));
        }
        public async Task <ImportError> AddFeature(ImportQueueFilter filter, FdpFeature featureToAdd)
        {
            var task = await Task.FromResult(_featureDataStore.FdpFeatureSave(featureToAdd));

            return(await Task.FromResult(_importDataStore.ImportErrorGet(filter)));
        }