public async Task <ActionResult> ListImportQueue(ImportParameters parameters)
        {
            var filter = new ImportQueueFilter()
            {
                FilterMessage = parameters.FilterMessage,
                ImportStatus  = (enums.ImportStatus)parameters.ImportStatusId.GetValueOrDefault(),
                Action        = ImportAction.ImportQueue
            };

            filter.InitialiseFromJson(parameters);

            var results = await ImportViewModel.GetModel(DataContext, filter);

            var jQueryResult = new JQueryDataTableResultModel(results.TotalRecords, results.TotalDisplayRecords);

            // Iterate through the results and put them in a format that can be used by jQuery datatables
            if (results.ImportQueue.CurrentPage.Any())
            {
                foreach (var result in results.ImportQueue.CurrentPage)
                {
                    jQueryResult.aaData.Add(result.ToJQueryDataTableResult());
                }
            }
            return(Json(jQueryResult));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> ListImportExceptions(ImportExceptionParameters parameters)
        {
            ImportExceptionParametersValidator
            .ValidateImportExceptionParameters(parameters, ImportExceptionParametersValidator.ImportQueueIdentifier);

            var filter = new ImportQueueFilter(parameters.ImportQueueId.GetValueOrDefault())
            {
                ExceptionType = parameters.ExceptionType,
                FilterMessage = parameters.FilterMessage,
                Action        = ImportAction.ImportQueueItem
            };

            filter.InitialiseFromJson(parameters);

            var results = await ImportViewModel.GetModel(DataContext, filter);

            var jQueryResult = new JQueryDataTableResultModel(results);

            // Iterate through the results and put them in a format that can be used by jQuery datatables
            if (!results.HasExceptions())
            {
                return(Json(jQueryResult));
            }
            jQueryResult.TotalSuccess = results.Exceptions.TotalSuccess;
            jQueryResult.TotalFail    = results.Exceptions.TotalFail;

            foreach (var result in results.Exceptions.CurrentPage)
            {
                jQueryResult.aaData.Add(result.ToJQueryDataTableResult());
            }
            return(Json(jQueryResult));
        }
 private async Task <ImportViewModel> GetModelFromParameters()
 {
     return(ImportViewModel.GetModel(
                DataContext,
                new ImportQueueFilter(),
                Parameters.Action).Result);
 }
Ejemplo n.º 4
0
        public async Task <ActionResult> ImportSummary(ImportExceptionParameters parameters)
        {
            var importView = await ImportViewModel.GetModel(DataContext,
                                                            new ImportQueueFilter(parameters.ImportQueueId.GetValueOrDefault())
            {
                Action = ImportAction.Summary
            });

            return(PartialView("_ImportSummary", importView));
        }
Ejemplo n.º 5
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));
        }
        public async Task <ActionResult> ContextMenu(ImportParameters parameters)
        {
            ImportParametersValidator.ValidateImportParameters(parameters, ImportParametersValidator.ImportQueueIdentifier, DataContext);

            var importView = await ImportViewModel.GetModel(
                DataContext,
                new ImportQueueFilter(parameters.ImportQueueId.Value)
            {
                Action = ImportAction.ImportQueueItem
            });

            return(PartialView("_ContextMenu", importView));
        }
Ejemplo n.º 7
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));
 }
Ejemplo n.º 8
0
        public async Task <ActionResult> ImportExceptionsPage(ImportExceptionParameters parameters)
        {
            ImportExceptionParametersValidator
            .ValidateImportExceptionParameters(parameters, ImportExceptionParametersValidator.ImportQueueIdentifier);

            var importView = await ImportViewModel.GetModel(DataContext,
                                                            new ImportQueueFilter(parameters.ImportQueueId.Value)
            {
                ExceptionType = parameters.ExceptionType,
                PageIndex     = PageIndex,
                PageSize      = PageSize,
                Action        = ImportAction.ImportQueueItem
            });

            var displayName = string.Format("Import Exceptions - {0} - {1:dd/MM/yyyy}", importView.Programme.ToShortString(), importView.CurrentImport.CreatedOn);

            ViewData["ImportName"] = displayName;

            return(View(importView));
        }
 private async Task <ImportViewModel> GetModelFromParameters(ImportParameters parameters)
 {
     if (parameters.Action == ImportAction.DeleteImport)
     {
         return(await ImportViewModel.GetModel(
                    DataContext,
                    new ImportQueueFilter(parameters.ImportQueueId.GetValueOrDefault()) { Action = parameters.Action },
                    parameters.Action));
     }
     if (parameters.Action == ImportAction.Upload)
     {
         return(await ImportViewModel.GetModel(
                    DataContext,
                    new ImportQueueFilter()
         {
             Action = parameters.Action
         },
                    parameters.Action));
     }
     return(GetModelFromParameters().Result);
 }