private void DoPrint() { try { var serverPath = ""; ReceiptImporterSectionReport report = null; ProgressDialog.Start(ParentForm, Task.Run(() => { serverPath = Util.GetGeneralSettingServerPathAsync(Login).Result; serverPath = Util.GetDirectoryName(serverPath); var isPossible = rdoPossible.Checked; var reportSource = Importer.GetReportSource(isPossible); report = new ReceiptImporterSectionReport(); report.SetBasicPageSetting(Login.CompanyCode, Login.CompanyName); report.Name = $"入金フリーインポーター 取込{(isPossible ? "可能" : "不可能")}データ一覧{DateTime.Today:yyyyMMdd}"; report.SetData(reportSource, isPossible, ApplicationControl.UseForeignCurrency, Note1); report.Run(false); }), false, SessionKey); ShowDialogPreview(ParentForm, report, serverPath); } catch (Exception ex) { Debug.Fail(ex.ToString()); NLogHandler.WriteErrorLog(this, ex, SessionKey); ShowWarningDialog(MsgErrCreateReportError); } }
public async Task <byte[]> GetAsync(TransactionImportSource source, CancellationToken token = default(CancellationToken)) { var companyId = source.CompanyId; var importDataId = source.ImportDataId.Value; var objectType = source.IsValidData ? 0 : 1; var companyTask = companyQueryProcessor.GetAsync(new CompanySearch { Id = companyId }, token); var appConTask = applicationControlGetByCompanyQueryProcessor.GetAsync(companyId, token); var nameTask = columnNameSettingQueryProcessor.GetAsync(new ColumnNameSetting { CompanyId = companyId, TableName = nameof(Receipt), ColumnName = nameof(Receipt.Note1), }, token); var itemsTask = importDataDetailQueryProcessor.GetAsync(importDataId, objectType, token); await Task.WhenAll(companyTask, appConTask, nameTask, itemsTask); var company = companyTask.Result.First(); var appCon = appConTask.Result; var note1 = nameTask.Result.FirstOrDefault()?.DisplayColumnName ?? "備考"; var items = itemsTask.Result.Select(x => serializer.UnpackSingleObject(x.RecordItem)).ToList(); if (!items.Any()) { return(null); } var report = new ReceiptImporterSectionReport(); report.SetBasicPageSetting(company.Code, company.Name); report.Name = $"入金フリーインポーター 取込{(source.IsValidData ? "可能" : "不可能")}データ一覧{DateTime.Today:yyyyMMdd}"; report.SetData(items, source.IsValidData, appCon.UseForeignCurrency, note1); report.Run(); return(report.Convert()); }