public BulkUploadJob(BulkImportService bulkImportService, IBackgroundJobClient backgroundJobClient, IHubContext <BulkUploadHub> bulkUploadHubContext)
            : base(backgroundJobClient, WorkflowJobName, bulkUploadHubContext)
        {
            _bulkImportService = bulkImportService;

            _bulkImportService.StatusUpdated += OperationStatusUpdated;
        }
        public BulkUploadJob(BulkImportService bulkImportService, IBackgroundJobClient backgroundJobClient, BulkUploadHub bulkUploadHub)
            : base(backgroundJobClient, bulkUploadHub, WorkflowJobName)
        {
            _bulkImportService = bulkImportService;

            _bulkImportService.StatusUpdated += OperationStatusUpdated;
        }
Ejemplo n.º 3
0
        protected async Task InitTestDataAsync()
        {
            var tgFile = "Resources/sample-talkgroups.csv";

            using (var bulkImportService = new BulkImportService(DbContext))
            {
                var result = await bulkImportService.ImportTalkGroupsCsvAsync(tgFile);

                if (!result.IsSuccessful)
                {
                    throw new Exception("Failed to initialize test data.");
                }
            }
        }
Ejemplo n.º 4
0
        public async Task <TalkGroupImportResults> ImportTalkGroupsAsync()
        {
            var tempFilePath = Path.GetTempFileName();

            try
            {
                using (var fs = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.Read, 2048, true))
                {
                    await HttpContext.Request.Body.CopyToAsync(fs);

                    using (var bulkImportService = new BulkImportService(DbContext))
                        return(await bulkImportService.ImportTalkGroupsCsvAsync(tempFilePath));
                }
            }
            finally
            {
                if (System.IO.File.Exists(tempFilePath))
                {
                    System.IO.File.Delete(tempFilePath);
                }
            }
        }
Ejemplo n.º 5
0
 public BulkImportController() : base()
 {
     this.bulkImportService = new BulkImportService();
 }