public Task <int> DeleteAsync(CustomerFeeSearch option, CancellationToken token = default(CancellationToken)) { var query = @" DELETE cf FROM CustomerFee cf INNER JOIN Customer cs ON cs.Id = cf.CustomerId INNER JOIN Currency cr ON cr.Id = cf.CurrencyId WHERE cf.CustomerId = cf.CustomerId"; if (option.CompanyId.HasValue) { query += @" AND cs.CompanyId = @CompanyId"; } if (option.CustomerId.HasValue) { query += @" AND cf.CustomerId = @CustomerId"; } if (option.CurrencyId.HasValue) { query += @" AND cf.CurrencyId = @CurrencyId"; } if (option.Fee.HasValue) { query += @" AND cf.Fee = @Fee"; } return(dbHelper.ExecuteAsync(query, option, token)); }
public async Task <byte[]> GetAsync(CustomerFeeSearch option, CancellationToken token = default(CancellationToken)) { var companyTask = companyQueryProcessor.GetAsync(new CompanySearch { Id = option.CompanyId, }, token); var appControlTask = applicationControlGetByCompanyQueryProcessor.GetAsync(option.CompanyId.Value, token); var masterLoadTask = customerFeeQueryProcessor.GetAsync(option, token); await Task.WhenAll(companyTask, appControlTask, masterLoadTask); var company = companyTask.Result.First(); var appCon = appControlTask.Result; var items = masterLoadTask.Result.ToList(); var precision = appCon.UseForeignCurrency == 0 ? 0 : items.Max(x => x.CurrencyPrecision); if (!items.Any()) { return(null); } var report = new CustomerFeeSectionReport(); report.Name = "登録手数料一覧" + DateTime.Now.ToString("yyyyMMdd"); report.SetBasicPageSetting(company.Code, company.Name); report.SetData(items, appCon.UseForeignCurrency); report.Precision = precision; report.Run(); return(report.Convert()); }
public Task <IEnumerable <CustomerFee> > GetAsync(CustomerFeeSearch option, CancellationToken token = default(CancellationToken)) { var query = option.ForPrint ? GetQueryForPrint() : GetQueryStandard(option); return(dbHelper.GetItemsAsync <CustomerFee>(query, option, token)); }
private string GetQueryStandard(CustomerFeeSearch option) { var query = @" SELECT cf.* , cs.CompanyId , cs.Code as CustomerCode , cr.Code as CurrencyCode , cm.Code as CompanyCode FROM CustomerFee cf INNER JOIN Customer cs ON cs.Id = cf.CustomerId INNER JOIN Currency cr ON cr.Id = cf.CurrencyId INNER JOIN Company cm ON cm.Id = cs.CompanyId WHERE cf.CustomerId = cf.CustomerId"; if (option.CompanyId.HasValue) { query += @" AND cs.CompanyId = @CompanyId"; } if (option.CustomerId.HasValue) { query += @" AND cf.CustomerId = @CustomerId"; } if (option.CurrencyId.HasValue) { query += @" AND cf.CurrencyId = @CurrencyId"; } query += @" ORDER BY cm.Code , cs.Code , cr.Code"; return(query); }
public async Task <IEnumerable <CustomerFee> > GetAsync(CustomerFeeSearch option, CancellationToken token = default(CancellationToken)) => await customerFeeQueryProcessor.GetAsync(option, token);
public async Task <IEnumerable <CustomerFee> > Get(CustomerFeeSearch option, CancellationToken token) => (await customerFeeProcessor.GetAsync(option, token)).ToArray();