/// <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, }); }
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)); }
public async Task <ReceiptInputsResult> Save(ReceiptSaveItem items, CancellationToken token) => await receiptProcessor.SaveAsync(items, token);