/// <summary> /// 用户信息 /// </summary> /// <param name="request">请求实体</param> /// <returns></returns> public AccountListResponse List(AccountListRequest request) { string postData = JsonHelper.GetJson(request); AccountListResponse response = client.Execute(request, list, postData); return(response); }
public async Task <object> Accounts() { var response = new AccountListResponse(); await using var ctx = new UchuContext(); response.Success = true; response.Accounts = await ctx.Users.Select(u => u.Id).ToListAsync(); return(response); }
public Task <AccountListResponse> GetAccount(AccountListRequest request) { var response = new AccountListResponse(); TryCatch(() => { var data = accountService.GetAccounts(request.Keyword, request.Name, request.Type, request.Actives); var responseData = data .Select(m => { var model = AutoMapper.Mapper.Map <Account, AccountView>(m); if (model.Type == (int)AccountTypeConfig.Credit) { model.TypeDisplay = "Ghi nợ"; } else if (model.Type == (int)AccountTypeConfig.Debit) { model.TypeDisplay = "Ghi có"; } else if (model.Type == (int)AccountTypeConfig.Duality) { model.TypeDisplay = "Lưỡng tính"; } else if (model.Type == (int)AccountTypeConfig.Nobalance) { model.TypeDisplay = "Không có số dư"; } else { model.TypeDisplay = ""; } var lstChildrenAccount = GetListParentAccountView(model.Id); model.subChildren = lstChildrenAccount; return(model); }) .ToList(); response.SetData(responseData).Successful(); }, response); return(Task.FromResult(response)); }
static void Main(string[] args) { // Configure API key authorization: clientId // Configuration.Default.ApiKey.Add("X-IBM-Client-Id", "YOUR_API_KEY"); Configuration.Default.ApiKey.Add("X-IBM-Client-Id", "YOUR_API_KEY"); // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed // Configuration.Default.ApiKeyPrefix.Add("X-IBM-Client-Id", "Bearer"); // Configure API key authorization: client secret Configuration.Default.ApiKey.Add("X-IBM-Client-Secret", "YOUR_CLIENT_SECRET"); // Configure OAuth2 access token for authorization: oauth2 Configuration.Default.AccessToken = "AUTH_TOKEN"; var apiInstance = new AccountsV3Api(); var id = "FI7473834510057469-EUR"; // string | Internal, technical account identifier try { // Get account details by account id // AccountDetailsResponse result = apiInstance.AccountDetailsUsingGET1(id); // Debug.WriteLine(result); // Get account list AccountListResponse result = apiInstance.AccountListUsingGET1WithHttpInfo().Data; foreach (var account in result.Response.Accounts) { Debug.WriteLine(account); } } catch (Exception e) { Debug.Print("Exception when calling AccountsV2Api.AccountDetailsUsingGET: " + e.Message); } }
/// <summary> /// The list. /// </summary> /// <param name="owner">The owner.</param> /// <param name="input">The input.</param> /// <returns>The <see cref="Task"/>.</returns> public async Task <AccountListResponse> List(Guid owner, AccountListRequest input) { IQueryable <AccountEntity> listQuery = this.context.Accounts.Where(o => o.Owner == owner && ((!input.Filter.BringArchived && !o.IsArchived) || input.Filter.BringArchived)); if (!string.IsNullOrEmpty(input.Filter.Description)) { listQuery = input.Filter.DescriptionExact ? listQuery.Where(x => x.Description == input.Filter.Description) : listQuery.Where(x => x.Description.Contains(input.Filter.Description)); } if (input.Filter.FilterByBank) { listQuery = listQuery.Where(x => x.Bank == input.Filter.Bank); } if (input.Filter.FilterByCurrency && !string.IsNullOrEmpty(input.Filter.Currency)) { listQuery = listQuery.Where(x => x.Currency == input.Filter.Currency); } if (input.Filter.FilterByHolder && !input.Filter.BringOnlyMine) { listQuery = listQuery.Where(x => x.Holder == input.Filter.Holder); } if (input.Filter.BringOnlyMine) { listQuery = listQuery.Where(x => x.Holder == owner); } if (!string.IsNullOrEmpty(input.Filter.Number)) { listQuery = listQuery.Where(x => x.Number.Contains(input.Filter.Number)); } listQuery = listQuery.Where(x => (input.Filter.Types.Contains(AccountType.CurrentAccount) && x is CurrentAccountEntity) || (input.Filter.Types.Contains(AccountType.LoanAccount) && x is LoanAccountEntity) || (input.Filter.Types.Contains(AccountType.SavingAccount) && x is SavingAccountEntity)); var queryResult = await listQuery.CountAsync(); var orderType = input.Order.IsDesc ? SortOrder.Descending : SortOrder.Ascending; var list = await listQuery .OrderByFieldAccount(orderType, input.Order.Field) .Skip((input.Page - 1) * input.ItemsPerPage) .Take(input.ItemsPerPage) .Select(order => new { order.Code, order.StartDate, order.Number, order.Description, order.Currency, order.Amount, order.Holder, order.Bank, order.ChangeAt, order.CreatedAt, order.IsArchived, Type = order is CurrentAccountEntity ? AccountType.CurrentAccount : order is LoanAccountEntity ? AccountType.LoanAccount : AccountType.SavingAccount }).ToListAsync(); var lisOfGuids = list.GroupBy(o => o.Holder).Select(g => g.Key).ToList(); var listOfHolders = await this.humanRepository.GetList(owner, lisOfGuids); var result = new AccountListResponse { NumberOfItems = queryResult, Data = list.Select(order => new Account { Code = order.Code, StartDate = order.StartDate, Number = order.Number, Description = order.Description, Currency = this.cacheProvider.Currencies.FirstOrDefault(o => o.Code == order.Currency), Amount = order.Amount, Holder = listOfHolders.FirstOrDefault(i => i.Code == order.Holder), Bank = this.cacheProvider.Banks.FirstOrDefault(o => o.Code == order.Bank), ChangeAt = order.ChangeAt, CreatedAt = order.CreatedAt, IsArchived = order.IsArchived, Type = order.Type }).ToList() }; return(result); }