Exemple #1
0
 public async Task <CountResult> SaveMemoAsync(string SessionKey, long Id, string Memo)
 {
     return(await authorizationProcessor.DoAuthorizeAsync(SessionKey, async token =>
     {
         var result = await billingMemoProcessor.SaveMemoAsync(Id, Memo, token);
         return new CountResult
         {
             ProcessResult = new ProcessResult {
                 Result = true
             },
             Count = result,
         };
     }, logger));
 }
        /// <summary>
        /// 請求データ登録用 without transaction scope
        /// </summary>
        /// <param name="billing"></param>
        /// <param name="token"></param>
        /// <returns></returns>
        private async Task <Billing> SaveInnerAsync(Billing billing, CancellationToken token = default(CancellationToken))
        {
            Billing result = null;

            if (billing.Id > 0)
            {
                var current = (await billingGetByIdsQueryProcessor.GetByIdsAsync(new long[] { billing.Id }, token)).FirstOrDefault();
                if (current == null)
                {
                    throw new Exception("請求データが存在しないため、修正できません。");
                }
                if (current.AssignmentFlag != 0 ||
                    current.OutputAt != null ||
                    current.InputType == 3 ||
                    current.ResultCode == 0)
                {
                    throw new Exception("修正不可能な請求データです。");
                }
                else
                {
                    result = await updatebillingQueryProcessor.UpdateAsync(billing, token);
                }
            }
            else
            {
                result = await addBillingQueryProcessor.AddAsync(billing, token);
            }

            if (string.IsNullOrEmpty(billing.Memo))
            {
                await billingMemoProcessor.DeleteAsync(result.Id, token);
            }
            else
            {
                await billingMemoProcessor.SaveMemoAsync(result.Id, billing.Memo, token);
            }
            return(result);
        }
Exemple #3
0
 public async Task <int> SaveMemo(BillingMemo memo, CancellationToken token)
 => await billingMemoProcessor.SaveMemoAsync(memo.BillingId, memo.Memo, token);