public async Task <JsonResult> OnPostLlenarTabla([FromBody] RequestPagination pag) { IdUser = User.Claims.Where(x => x.Type == ClaimTypes.NameIdentifier).Select(x => x.Value).SingleOrDefault(); Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); var currency = pag.Filter.Currency_id; if (pag.Filter != null) { if ((pag.Filter.AmountRiskTo == null && pag.Filter.AmountRiskAvailableFrom == null && pag.Filter.AmountRiskAvailableTo == null && pag.Filter.AmountRiskFrom == null)) { pag.Filter.Currency_id = null; } } prospectoLimiteCredito.List = new List <Prospecto>(); var Estados = await _globalService.ConsultaIdentificationsAndCitiesTF(new ParamCountry { Id = Int32.Parse(Country) }); var listaUsuarios = await _peopleService.ConsultaDatosEjecutivoCuentasAsync(new ParamCreditLimit { Confirmant = Confirmant, Country = int.Parse(Country), User = IdUser, Filter = pag.Filter, Pagination = pag.Pagination }, token); if (listaUsuarios.Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await _aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, Participant, token, Confirmant); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } if (listaUsuarios != null) { if (listaUsuarios.List != null) { foreach (var usuario in listaUsuarios.List) { if (usuario.Identities != null) { foreach (var participante in usuario.Identities) { if (participante.Participant == "DEBTOR") { prospectoLimiteCredito.List.Add(usuario); } } } } } else { prospectoLimiteCredito = null; } } prospectoLimiteCredito.Error = listaUsuarios.Error; return(new JsonResult(new { prospecto = prospectoLimiteCredito, estados = Estados, idCurrency = currency })); }
public async Task <JsonResult> OnPostLlenarTabla([FromBody] ParamPayments pag) { if (pag == null) { pag = new ParamPayments(); } Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); List <Payments> ListPayment = new List <Payments>(); var Id_Currency = pag.Currency; pag.Currency = null; pag.Country = int.Parse(Country); pag.State = "draft"; var token = HttpContext.Session.GetString("token"); var Estados = await _globalService.ConsultaIdentificationsAndCitiesTF(new ParamCountry { Id = Int32.Parse(Country) }); VerficarPagos = await _paymentService.ConsultaConciliacionsAsync(pag, token); if (VerficarPagos.Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await _aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, Participant, token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } foreach (var pago in VerficarPagos.List) { if (pago.Currency != null) { if (pago.Currency.Id == Id_Currency) { ListPayment.Add(pago); } } } if (VerficarPagos != null) { return(new JsonResult(new { concilar = ListPayment, error = VerficarPagos.Error })); } else { return(new JsonResult(null)); } }
public async Task <IActionResult> OnPostLlenarConsultaAsync([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var Estados = await _globalService.ConsultaIdentificationsAndCitiesTF(new ParamCountry { Id = Int32.Parse(Country) }); filterInvoice currencyAccountInvoiceFilter = new filterInvoice(); if (pag.Filter != null) { currencyAccountInvoiceFilter = pag.Filter; } Prospectos ListaClientesBanco = new Prospectos(); List <ListAccountantsInvoices> listaFinanciedInvoices = new List <ListAccountantsInvoices>(); if (Estados != null) { if (Estados.Currencies != null) { if (pag.Filter.AmountRiskFrom == null) { pag.Filter.AmountRiskFrom = 0; } if (pag.Filter.Abbreviation == null) { pag.Filter.Abbreviation = "CREDIT"; } ListaClientesBanco = await _peopleService.GetConsultaFinaciamientoConfirmant(new ParamClienteOFConfirmant { Bank_id = Confirmant, Filter = pag.Filter, Pagination = pag.Pagination }, token); var ListaAccountantsInvoices = await _invoiceService.GetFinanciablesBankInvoices(new ParamAccountantsInvoices { Country = Int32.Parse(Country), Confirmant = Confirmant }, currencyAccountInvoiceFilter, token); ListaAccountantsInvoices.Currency = pag.Filter.Currency_id; listaFinanciedInvoices.Add(ListaAccountantsInvoices); } } return(new JsonResult(new { lista = ListaClientesBanco, estado = Estados, listaFinanciedInvoices = listaFinanciedInvoices })); }
public async Task <JsonResult> OnPostDetalleCliente([FromBody] Prospecto person) { Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); DetallesClientes detallesClientes = new DetallesClientes(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); ListCountry Pais = new ListCountry(); filterInvoice PeopleId = new filterInvoice(); PeopleId.Id = person.Id; person = await _peopleService.RegisterById(new ParamProspecto { Filter = PeopleId, Country = int.Parse(Country) }); if (person.Error == null) { detallesClientes.Error = person.Error; var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await _aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, Participant, token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } if (person.Addresses != null) { Pais = await _globalService.ConsultaIdentificationsAndCitiesTF(new ParamCountry { Id = int.Parse(Country), Region = person.Addresses[0].Region }); } if (Pais.Identifications != null) { foreach (var iden in Pais.Identifications) { if (person.Documents != null) { if (iden.Id == person.Documents[0].Identification && iden.Prefix == false) { detallesClientes.Document.Abbreviation = iden.Abbreviation; detallesClientes.Document.Number = person.Documents[0].Number; } else if (iden.Id == person.Documents[0].Identification && iden.Prefix == true) { foreach (var prefx in iden.Prefixes) { if (prefx.Id == person.Documents[0].Prefix) { detallesClientes.Document.Abbreviation = prefx.Abbreviation; detallesClientes.Document.Number = person.Documents[0].Number; } } } } if (person.Contacts != null) { foreach (var contacto in person.Contacts) { if (contacto.Label == "LEGAL") { detallesClientes.Representante.DocumentNumber = contacto.DocumentNumber; detallesClientes.Representante.Name = contacto.Name; detallesClientes.Representante.PhoneNumber = contacto.PhoneNumber; detallesClientes.Representante.Email = contacto.Email; if (iden.Id == contacto.Identification && iden.Prefix == false) { detallesClientes.Representante.Label = iden.Abbreviation; } else if (iden.Id == contacto.Identification && iden.Prefix == true) { foreach (var prefx in iden.Prefixes) { if (prefx.Id == contacto.Prefix) { detallesClientes.Representante.Label = prefx.Abbreviation; } } } } else if (contacto.Label == "CONTACT") { detallesClientes.Contacto.DocumentNumber = contacto.DocumentNumber; detallesClientes.Contacto.Name = contacto.Name; detallesClientes.Contacto.PhoneNumber = contacto.PhoneNumber; detallesClientes.Contacto.Email = contacto.Email; if (iden.Id == contacto.Identification && iden.Prefix == false) { detallesClientes.Contacto.Label = iden.Abbreviation; } else if (iden.Id == contacto.Identification && iden.Prefix == true) { foreach (var prefx in iden.Prefixes) { if (prefx.Id == contacto.Prefix) { detallesClientes.Contacto.Label = prefx.Abbreviation; } } } } } } } } if (Pais.Regions != null) { foreach (var city in Pais.Regions[0].Cities) { if (person.Addresses[0].City == city.Id) { detallesClientes.Address.Region = Pais.Regions[0].Name; detallesClientes.Address.City = city.Name; continue; } } } detallesClientes.Company = person.Company; if (person.Phones != null) { detallesClientes.Phone = person.Phones[0].Number; } else { detallesClientes.Phone = null; } if (person.Addresses != null) { detallesClientes.Address.Line1 = person.Addresses[0].Line1; detallesClientes.Address.Line2 = person.Addresses[0].Line2; } if (detallesClientes.Contacto.DocumentNumber == null || detallesClientes.Contacto.DocumentNumber == "") { detallesClientes.Contacto = null; } if (person.Discriminator == "PERSON") { if (person.Emails != null) { detallesClientes.Email = person.Emails[0].Address; } detallesClientes.Representante = null; detallesClientes.Contacto = null; } return(new JsonResult(detallesClientes)); }
public async Task <JsonResult> OnPostDetalleAsync([FromBody] Prospecto person) { Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault(); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); DetallesClientes detallesClientes = new DetallesClientes(); ListCountry Pais = new ListCountry(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); filterInvoice PeopleId = new filterInvoice(); PeopleId.Id = person.Id; person = await _peopleService.GetDetalleClientConfirmant(new ParamProspecto { Filter = PeopleId, Country = int.Parse(Country) }, token); if (person.Error == null) { detallesClientes.Error = person.Error; var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await _aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, Participant, token, Confirmant); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } //----------- Llenado de Country if (person.Addresses != null && person.Addresses.Count > 0) { Pais = await _globalService.ConsultaIdentificationsAndCitiesTF(new ParamCountry { Id = int.Parse(Country), Region = person.Addresses[0].Region }); } else { Pais = await _globalService.ConsultasCountryTF(new ParamCountry { Id = int.Parse(Country) }); } //----------- Llenado de Country foreach (var iden in Pais.Identifications) { if (iden.Id == person.Documents[0].Identification && iden.Prefix == false) { detallesClientes.Document.Abbreviation = iden.Abbreviation; detallesClientes.Document.Number = person.Documents[0].Number; } if (person.Contacts != null) { foreach (var contacto in person.Contacts) { if (contacto.Label == "LEGAL") { detallesClientes.Representante.DocumentNumber = contacto.DocumentNumber; detallesClientes.Representante.Name = contacto.Name; detallesClientes.Representante.PhoneNumber = contacto.PhoneNumber; detallesClientes.Representante.Email = contacto.Email; if (iden.Id == contacto.Identification && iden.Prefix == false) { detallesClientes.Representante.Label = iden.Abbreviation; } else if (iden.Id == contacto.Identification && iden.Prefix == true) { foreach (var prefx in iden.Prefixes) { if (prefx.Id == contacto.Prefix) { detallesClientes.Representante.Label = prefx.Abbreviation; } } } } else if (contacto.Label == "CONTACT") { detallesClientes.Contacto.DocumentNumber = contacto.DocumentNumber; detallesClientes.Contacto.Name = contacto.Name; detallesClientes.Contacto.PhoneNumber = contacto.PhoneNumber; detallesClientes.Contacto.Email = contacto.Email; if (iden.Id == contacto.Identification && iden.Prefix == false) { detallesClientes.Contacto.Label = iden.Abbreviation; } else if (iden.Id == contacto.Identification && iden.Prefix == true) { foreach (var prefx in iden.Prefixes) { if (prefx.Id == contacto.Prefix) { detallesClientes.Contacto.Label = prefx.Abbreviation; } } } } } } } if (Pais.Regions != null && Pais.Regions.Count > 0) { if (Pais.Regions[0].Cities != null && Pais.Regions[0].Cities.Count > 0) { foreach (var city in Pais.Regions[0].Cities) { if (person.Addresses[0].City == city.Id) { detallesClientes.Address.Region = Pais.Regions[0].Name; detallesClientes.Address.City = city.Name; continue; } } } } detallesClientes.Company = person.Company; detallesClientes.Phone = person.Phones[0].Number; detallesClientes.Address.Line1 = person.Addresses[0].Line1; detallesClientes.Address.Line2 = person.Addresses[0].Line2; if (person.Quotas != null) { if (person.Quotas.Count > 0) { person.Quotas = person.Quotas.OrderBy(x => x.Currency != Pais.Currency.Id).ToList(); } foreach (var limite in person.Quotas) { if (limite.Entity.Id == Confirmant) { if (limite.Abbreviation == "CREDIT" || limite.Abbreviation == "FINANCING") { foreach (var coin in Pais.Currencies) { if (coin.Id == limite.Currency) { detallesClientes.LimiteCredito.Currency = coin.Symbol; //detallesClientes.LimiteCredito.Abbreviation = coin.Iso_4217; var limiteCredit = new LimiteCredito() { Iso_4217 = coin.Iso_4217, Currency = coin.Symbol, Abbreviation = limite.Abbreviation, Available = limite.Available, Usage = limite.Usage }; detallesClientes.LimiteCreditoList.Add(limiteCredit); } } detallesClientes.LimiteCredito.Abbreviation = limite.Abbreviation; detallesClientes.LimiteCredito.Available = limite.Available; detallesClientes.LimiteCredito.Usage = limite.Usage; } } } } else { detallesClientes.LimiteCredito = null; } if (person.Accounts != null) { int limite = person.Accounts.Count; foreach (var moneda in Pais.Currencies) { foreach (var cuenta in person.Accounts) { if (moneda.Id == cuenta.Currency && Confirmant == cuenta.Entity.Id && cuenta.Status == true) { var a = new CuentaBancaria(); foreach (var bank in Pais.Entities) { if (bank.Id == cuenta.Entity.Id) { a.Entity = bank.Person.Name; } } a.Simbol = moneda.Iso_4217; a.AccountNumber = cuenta.AccountNumber; a.AccountType = cuenta.AccountType; detallesClientes.AccountsList.Add(a); continue; } } } } else { detallesClientes.CuentaBancaria = null; } if (detallesClientes.Contacto.DocumentNumber == null || detallesClientes.Contacto.DocumentNumber == "") { detallesClientes.Contacto = null; } if (person.Discriminator == "PERSON") { detallesClientes.Company = person.FirstName; if (person.Emails != null) { detallesClientes.Email = person.Emails[0].Address; } detallesClientes.Representante = null; detallesClientes.Contacto = null; } return(new JsonResult(detallesClientes)); }