Example #1
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));
        }
        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));
        }