Example #1
0
        public async Task <int> DeleteAsync(BillingDeleteSource source, CancellationToken token = default(CancellationToken))
        {
            var result = 0;
            var app    = await getApplicationControlByCompanyQueryProcessor.GetAsync(source.CompanyId, token);

            using (var scope = transactionScopeBuilder.Create())
            {
                foreach (var id in source.Ids)
                {
                    if (app.RegisterContractInAdvance == 1)
                    {
                        await updateBillingDivisionContractQueryProcessor.UpdateWithBillingIdAsync(id, source.LoginUserId, token);
                    }
                    else
                    {
                        await deleteBillingDivisionContractQueryProcessor.DeleteWithBillingIdAsync(id, token);
                    }

                    if (app.UseDiscount == 1)
                    {
                        await deleteBillingDiscountQueryProcessor.DeleteAsync(id, token);
                    }

                    result += await DeleteInnerAsync(id, token);
                }
                scope.Complete();
            }
            return(result);
        }
Example #2
0
 public async Task <int> UpdateAsync(long BillingId, int UpdateBy, CancellationToken token = default(CancellationToken))
 => await updateBillingDivisionContractQueryProcessor.UpdateWithBillingIdAsync(BillingId, UpdateBy);