コード例 #1
0
        /// <summary>インポート処理 データ登録</summary>
        /// <param name="source"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        public async Task <ImportDataResult> ImportAsync(TransactionImportSource source, CancellationToken token = default(CancellationToken))
        {
            var companyTask = companyProcessor.GetAsync(new CompanySearch {
                Id = source.CompanyId,
            }, token);
            var appConTask = applicationControlProcessor.GetAsync(source.CompanyId, token);

            await Task.WhenAll(companyTask, appConTask);

            var company            = companyTask.Result.First();
            var applicationControl = appConTask.Result;

            var importDataId = source.ImportDataId ?? 0;

            var importer = new ReceiptImporterBase(applicationControl)
            {
                CompanyId           = source.CompanyId,
                CompanyCode         = company.Code,
                LoginUserId         = source.LoginUserId,
                ImporterSettingId   = source.ImporterSettingId,
                Deserialize         = bytes => serializer.UnpackSingleObject(bytes),
                LoadImportDataAsync = () => importDataProcessor.GetAsync(importDataId, objectType: 0, token: token),
                SaveInnerAsync      = items => receiptProcessor.SaveAsync(new ReceiptSaveItem {
                    Receipts = items,
                }, token),
            };

            var result = await importer.ImportAsync();

            return(new ImportDataResult {
                SaveCount = importer.SaveCount,
                SaveAmount = importer.SaveAmount,
            });
        }
コード例 #2
0
ファイル: ReceiptService.svc.cs プロジェクト: fwka1605/next
 public async Task <ReceiptInputsResult> SaveAsync(string SessionKey, ReceiptInput[] ReceiptInput, byte[] ClientKey, int ParentCustomerId)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token
                                                          => await receiptProcessor.SaveAsync(new ReceiptSaveItem {
         Receipts = ReceiptInput,
         ClientKey = ClientKey,
         ParentCustomerId = ParentCustomerId == 0 ? (int?)null : ParentCustomerId,
     }, token), logger));
 }
コード例 #3
0
 public async Task <ReceiptInputsResult> Save(ReceiptSaveItem items, CancellationToken token)
 => await receiptProcessor.SaveAsync(items, token);