コード例 #1
0
 public Task<FdpTrimMapping> CopyFdpTrimMappingToDocument(FdpTrimMapping fdpTrimMapping, int targetDocumentId)
 {
     throw new NotImplementedException();
 }
コード例 #2
0
 public async Task<ImportError> MapTrim(ImportQueueFilter filter, FdpTrimMapping trimMapping)
 {
     var task = await Task.FromResult(_trimDataStore.TrimMappingSave(trimMapping));
     return await Task.FromResult(_importDataStore.ImportErrorGet(filter));
 }
コード例 #3
0
 public async Task<FdpTrimMapping> DeleteFdpTrimMapping(FdpTrimMapping trimMappingToDelete)
 {
     return await Task.FromResult(_trimDataStore.FdpTrimMappingDelete(trimMappingToDelete));
 }
コード例 #4
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);
        }
コード例 #5
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);
        }
コード例 #6
0
        public FdpTrimMapping FdpTrimMappingCopy(FdpTrimMapping trimMappingToCopy, IEnumerable<string> gateways)
        {
            FdpTrimMapping retVal = new EmptyFdpTrimMapping();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();

                    para.Add("@FdpTrimMappingId", trimMappingToCopy.FdpTrimMappingId, DbType.Int32);
                    para.Add("@Gateways", gateways.ToCommaSeperatedList(), DbType.String);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var rows = conn.Execute("Fdp_TrimMapping_Copy", para, commandType: CommandType.StoredProcedure);

                    retVal = FdpTrimMappingGet(new TrimMappingFilter { TrimMappingId = trimMappingToCopy.FdpTrimMappingId });
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
コード例 #7
0
        public FdpTrimMapping FdpTrimMappingDelete(FdpTrimMapping trimMappingToDelete)
        {
            FdpTrimMapping retVal = new EmptyFdpTrimMapping();
            using (IDbConnection conn = DbHelper.GetDBConnection())
            {
                try
                {
                    var para = new DynamicParameters();
                    para.Add("@FdpTrimMappingId", trimMappingToDelete.FdpTrimMappingId, DbType.Int32);
                    para.Add("@CDSId", CurrentCDSID, DbType.String);

                    var results = conn.Query<FdpTrimMapping>("Fdp_TrimMapping_Delete", para, commandType: CommandType.StoredProcedure);
                    if (results.Any())
                    {
                        retVal = results.First();
                    }
                }
                catch (Exception ex)
                {
                    Log.Error(ex);
                    throw;
                }
            }
            return retVal;
        }
コード例 #8
0
 public FdpTrimMapping TrimMappingSave(FdpTrimMapping trimMapping)
 {
     FdpTrimMapping retVal = new EmptyFdpTrimMapping();
     using (var conn = DbHelper.GetDBConnection())
     {
         try
         {
             var para = DynamicParameters.FromCDSId(CurrentCDSID);
             para.Add("@ImportTrim", trimMapping.ImportTrim, DbType.String);
             para.Add("@DocumentId", trimMapping.DocumentId, DbType.Int32);
             para.Add("@ProgrammeId", trimMapping.ProgrammeId, DbType.Int32);
             para.Add("@Gateway", trimMapping.Gateway, DbType.String);
             if (trimMapping.TrimId.HasValue)
             {
                 para.Add("@TrimId", trimMapping.TrimId.Value, DbType.Int32);
             }
             if (trimMapping.FdpTrimId.HasValue)
             {
                 para.Add("@FdpTrimId", trimMapping.FdpTrimId, DbType.Int32);
             }
             
             var results = conn.Query<FdpTrimMapping>("Fdp_TrimMapping_Save", para, commandType: CommandType.StoredProcedure);
             if (results.Any())
             {
                 retVal = results.First();
             }
         }
         catch (Exception ex)
         {
             Log.Error(ex);
             throw;
         }
     }
     return retVal;
 }