public async Task <decimal> GetMaxAmountReturnableAsync(long siNumber, string insz) { ReturnMessageOfGetCertificatesResponse7nXz08R8 response = await _bobService.GetCertificatesAsync(new GetCertificatesRequest() { SiNumber = siNumber }); return(await CalcMaxAmount(siNumber, response)); }
public async Task <IActionResult> GetSpecific(long sinumber, string certificateId) { var certificates = await _service.GetCertificatesAsync(new GetCertificatesRequest { SiNumber = sinumber }); var certificate = certificates?.Value?.Certificates?.FirstOrDefault(c => c.Id == certificateId); var response = await _service.GetPaymentsAsync(new GetPaymentsRequest() { SiNumber = sinumber, ReferenceDate = certificate.From }); if (response.BusinessMessages != null && response.BusinessMessages.Length > 0) { return(BadRequest(response.BusinessMessages)); } var mappedPayments = _mapper.Map <IEnumerable <BobPayment> >(response.Value?.Payments, opt => opt.Items["Id"] = certificateId); return(Ok(mappedPayments)); }
public async Task <IActionResult> Get(long sinumber) { var response = await _service.GetCertificatesAsync(new GetCertificatesRequest() { SiNumber = sinumber }); if (response.BusinessMessages != null && response.BusinessMessages.Length > 0) { return(BadRequest(response.BusinessMessages)); } var mapped = _mapper.Map <IEnumerable <BobCertificate> >(response.Value?.Certificates); return(Ok(mapped)); }
public async Task <IActionResult> GetAll(long sinumber) { var certificates = await _service.GetCertificatesAsync(new GetCertificatesRequest { SiNumber = sinumber }); List <Letter> letters = new List <Letter>(); foreach (var certificate in certificates?.Value?.Certificates) { var response = await _service.GetLettersAsync(new GetLettersRequest() { CertificateId = certificate.Id }); if (response.BusinessMessages != null && response.BusinessMessages.Length > 0) { return(BadRequest(response.BusinessMessages)); } letters.AddRange(_mapper.Map <IEnumerable <Letter> >(response.Value?.Letters)); } return(Ok(letters)); }
private async Task WriteCSVLine(string delimiter1, string space, StreamWriter writer, Models.Person person) { var thabDataResponseTask = _thabService.GetThabDataAsync(new ThabService.GetThabDataRequest() { SiNumber = person.SiNumber, Insz = person.Insz }); var bobDataResponseTask = _bobService.GetCertificatesAsync(new BobService.GetCertificatesRequest() { SiNumber = person.SiNumber }); var zvzDataResponseTask = _zvzService.GetWarrantiesAsync(new GetWarrantiesRequest() { SiNumber = person.SiNumber }); var lineSb = new StringBuilder(); lineSb.Append(person.FederationNumber); lineSb.Append(delimiter1); lineSb.Append(person.Insz); lineSb.Append(delimiter1); lineSb.Append(person.FirstName); lineSb.Append(delimiter1); lineSb.Append(person.Name); lineSb.Append(delimiter1); lineSb.Append(person.Street); lineSb.Append(delimiter1); lineSb.Append(person.HouseNumber); lineSb.Append(delimiter1); lineSb.Append(person.NumberBox); lineSb.Append(delimiter1); lineSb.Append(person.ZipCode); lineSb.Append(delimiter1); lineSb.Append(person.Locality); lineSb.Append(delimiter1); var contactDetailSb = new StringBuilder(); var delimiter2 = " - "; try { var zvzDataResponse = await zvzDataResponseTask; if (zvzDataResponse?.Value?.Warranties?.Any() == true) { contactDetailSb.Append("ZVZ: "); contactDetailSb.Append(zvzDataResponse?.Value?.Warranties?.FirstOrDefault()?.Care); contactDetailSb.Append(delimiter2); contactDetailSb.Append(zvzDataResponse?.Value?.Warranties?.FirstOrDefault()?.State); } } catch { } try { var bobDataResponse = await bobDataResponseTask; if (bobDataResponse?.Value?.Certificates?.Any() == true) { if (contactDetailSb.Length != 0) { contactDetailSb.Append(delimiter2); } contactDetailSb.Append("BOB - "); contactDetailSb.Append(bobDataResponse?.Value?.Certificates?.FirstOrDefault()?.State); } } catch { } try { var thabDataResponse = await thabDataResponseTask; if (thabDataResponse?.Value?.ThabData?.FirstOrDefault()?.Certificate != null) { if (contactDetailSb.Length != 0) { contactDetailSb.Append(delimiter2); } contactDetailSb.Append("Thab - "); contactDetailSb.Append(thabDataResponse?.Value?.ThabData?.First()?.Certificate?.State); } } catch { } lineSb.Append(contactDetailSb.ToString()); lineSb.Append(delimiter1); StringBuilder thabDetailSb = null; try { var thabDataResponse = await thabDataResponseTask; if (thabDataResponse?.Value?.ThabData?.Any() == true) { foreach (var data in thabDataResponse.Value.ThabData) { thabDetailSb = new StringBuilder(data.Certificate.Id); thabDetailSb.Append(space); if (data.Remark != null) { thabDetailSb.Append(data.Remark.TrimEnd()); } } } } catch { } lineSb.Append(delimiter1); if (thabDetailSb != null) { lineSb.Append(thabDetailSb.ToString()); } writer.WriteLine(lineSb.ToString()); }