public ClientReports GetClientReports() { try { using (var aimp = new Aimp(_login, _password)) { var result = new ClientReports(); result.Banks = aimp.GetBanks(); result.Items = aimp.GetBankReportClients() .GroupBy(g => g.ClientReport) .Select(x => new ClientReportListItem() { Id = x.Key.Id, BankStatusesReportClient = (from b in result.Banks join bs in x.Select(y => new { y.Bank.Id, y.BankStatus.MiddleName }) on b.Id equals bs.Id into statusDefault from bs in statusDefault.DefaultIfEmpty() select bs?.MiddleName ).ToArray(), ClientStatusReportClient = x.Key.ClientStatus?.Name, DateReportClient = x.Key.Date.ToString("dd.MM.yyyy"), FullNameReportClient = x.Key.FullName, ManagerReportClient = x.Key.User?.LastName, PriceTrancportReportClient = x.Key.Price.ToString(), ProgrammCreditReportClient = x.Key.CreditProgramm?.Name, SourceInfoReportClient = x.Key.Source, TelefonReportClient = x.Key.Telefon, TotalContributionReportClient = x.Key.TotalContribution?.ToString(), TrancportNameReportClient = x.Key.Trancport }); return(result); } } catch (Exception ex) { return(new ClientReports(ex)); } }
public ClientReport GetClientReport(int id) { try { using (var aimp = new Aimp(_login, _password)) { var response = new ClientReport(aimp.GetDocument <ClientReportDocument>(id), aimp.GetClientStatuses(), aimp.GetCreditProgramms(), aimp.GetBanks(), aimp.GetBankStatuses()); return(response); } } catch (Exception ex) { return(new ClientReport(ex)); } }
public ClientReport GetNewClientReport() { try { using (var aimp = new Aimp(_login, _password)) { return(new ClientReport(new ClientReportDocument(), aimp.GetClientStatuses(), aimp.GetCreditProgramms(), aimp.GetBanks(), aimp.GetBankStatuses())); } } catch (Exception ex) { return(new ClientReport(ex)); } }