public async Task <IActionResult> OnPostCandidates([FromBody] RequestPagination pag) { List <Publications> reviewables = new List <Publications>(); var token = HttpContext.Session.GetString("token"); var w = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); //var data = await this._iS.GetCandidates(w, pag.Filter, pag.Pagination, token); var data = await this._iS.GetCandidatesReview(w, pag.Filter, pag.Pagination, token); if (data.Count == 0 || data[0].Errors == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "CONFIRMANT", token, w); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } for (int x = 0; x < data.Count; x++) { if (data[x].Invoice.Term_days >= 30) { reviewables.Add(data[x]); } } return(new JsonResult(reviewables)); }
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> OnPostPostulates([FromBody] RequestPagination pag) { List <Invoices> postulables = new List <Invoices>(); var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var data = await this._iS.GetPostulatesSupplier(c, pag.Filter, pag.Pagination, token); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } for (int x = 0; x < data.Count; x++) { if (data[x].Term_days >= 30) { postulables.Add(data[x]); } } return(new JsonResult(postulables)); }
public async Task <JsonResult> OnPostInvoices([FromBody] RequestPagination pag) { ParametersDebtorEdition Parameters = new ParametersDebtorEdition(); var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var o = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); Parameters.Id = c; Parameters.Country = Int32.Parse(o); pag.Filter.Participant = "DEBTOR"; pag.Order = @" invoices.participant, invoices.created_at desc, invoices.expiration_date desc "; pag.Group = "invoices.id, countries.id, programs.id"; var data = await this._iS.GetInvoicesForDebtorEdition(Parameters, "Carga Manual", pag.Filter, pag.Pagination, token, pag.Order, pag.Group); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "DEBTOR", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(data)); }
public async Task <JsonResult> OnPostPayedInvoices([FromBody] RequestPagination pag) { 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(); 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(); var token = HttpContext.Session.GetString("token"); var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, State = "paid", Country = Country }, pag.Filter, pag.Pagination, token); if (paymentsQuery.Count == 0 || paymentsQuery[0].Errors == 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); } } return(new JsonResult(paymentsQuery)); }
public async Task <JsonResult> OnPostLlenarConsultaAsync([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); pag.Order = @" invoices.participant, case when countries.currency_id = invoices.currency_id then 0 else invoices.currency_id end asc, supplier.name, invoices.expiration_date desc"; pag.Group = "invoices.id, countries.currency_id, supplier.id, programs.id"; var data = await _invoiceService.GetConsultaInvoices(Country, "BACKOFFICE", pag.Filter, pag.Pagination, token, pag.Order, pag.Group, true); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "BACKOFFICE", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(data)); }
public async Task <JsonResult> OnPostInvoices([FromBody] RequestPagination pagination) { var token = HttpContext.Session.GetString("token"); var o = Int32.Parse(User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault()); var data = await this._aS.GetPublications(o, "FACTOR", null, pagination.Filter, token, pagination.Pagination); var ordenedDataFactura = data; if (data.Count > 0 && String.IsNullOrEmpty(data[0].Errors)) { ordenedDataFactura = data.OrderByDescending(x => x.isOffered).ThenBy(x => x.Invoice.Supplier.Name).ToList(); } if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._authS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "FACTOR", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(ordenedDataFactura)); }
public async Task <JsonResult> OnPostLlenarConsultaAsync([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); Confirmant = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); pag.Order = @" invoices.participant, case when countries.currency_id = invoices.currency_id then 0 else invoices.currency_id end asc,people.name, invoices.expiration_date desc"; pag.Group = "invoices.id, countries.currency_id,people.id"; var data = await _invoiceService.GetConsultaInvoices(Confirmant, "SUPPLIER", pag.Filter, pag.Pagination, token, pag.Order, pag.Group, true); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } if (Utils.filterIsEmpty(pag.Filter) && data.Count > 0) { data = data.FindAll(x => x.Term_days > 0); } return(new JsonResult(data)); }
public static CouponCodesExportRequest GetCouponCodesExportRequest(string sample_CompanyKey, string sample_couponExportKey) { var couponCodesExportRequest = new CouponCodesExportRequest() { CompanyKey = sample_CompanyKey, CouponKey = sample_couponExportKey }; RequestPagination pagination = new RequestPagination() { Page = "1", PageSize = 500 }; couponCodesExportRequest.Pagination = pagination; couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Active); couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Created); couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Expired); couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Issued); couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Redeemed); couponCodesExportRequest.AddStatus(Qixol.Promo.Integration.Lib.Coupon.CouponCodeStatus.Withdrawn); return(couponCodesExportRequest); }
public async Task <JsonResult> OnPostUnpayedInvoices([FromBody] RequestPagination pag) { 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(); 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(); var token = HttpContext.Session.GetString("token"); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var unpaymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Entity = Confirmant, State = "unpaid", Abbreviation = "RECONCILED", Country = Country, Method = "TRANSFER", StateInvoiceNot = "overdue" }, pag.Filter, pag.Pagination, token); if (unpaymentsQuery.Count == 0 || unpaymentsQuery[0].Errors == 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); } } return(new JsonResult(new List <Receipts>())); }
public async Task <JsonResult> OnPostPayedInvoices([FromBody] RequestPagination pag) { Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); 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(); var principalCurrency = JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Currency; //var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Receiver = Owner, State = "paid", Abbreviation = "RECONCILED", Country = Country, Method = "TRANSFER" }, pag.Filter, pag.Pagination, token); var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Entity = Confirmant, State = "paid", Abbreviation = "RECONCILED", Country = Country }, pag.Filter, pag.Pagination, token); if (paymentsQuery.Count == 0 || paymentsQuery[0].Errors == 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 (principalCurrency != null) { paymentsQuery = paymentsQuery.OrderBy(x => x.Currency.Id != principalCurrency.Id).ThenByDescending(y => y.Receipt_date).ThenBy(z => z.Receiver.Name).ToList(); } return(new JsonResult(paymentsQuery)); }
public PaginationViewModel <BookViewModel> GetAllBookByCondition([FromQuery] RequestPagination requestPagination) { List <BookViewModel> bookViewModels = new List <BookViewModel>(); //var bookList = _context.BookAuthors.Where(p => p.User.Id == authorID).ToList(); var bookList = _iBookService.GetAll(); foreach (var item in bookList) { BookViewModel bookViewModel = new BookViewModel(item); bookViewModels.Add(bookViewModel); } //get all if (requestPagination.Page == -1) { PaginationViewModel <BookViewModel> notPagi = new PaginationViewModel <BookViewModel>(); notPagi.Amount = bookViewModels.Count(); notPagi.Data = bookViewModels; notPagi.TotalCount = bookViewModels.Count(); notPagi.TotalPage = 1; return(notPagi); } //============= var entries = _iBookService.GetByCondition(requestPagination, bookViewModels); return(_iBookService.GetPagination(requestPagination, entries)); }
public async Task <JsonResult> 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(); List <Invoices> ConsultaGeneral = new List <Invoices>(); if (Participant == "CONFIRMANT") { ConsultaGeneral = await _invoiceService.GetConsultaInvoices(Confirmant, Participant, pag.Filter, pag.Pagination, token); } else if (Participant == "BACKOFFICE") { ConsultaGeneral = await _invoiceService.GetConsultaInvoices(Country, Participant, pag.Filter, pag.Pagination, token); } else { ConsultaGeneral = await _invoiceService.GetConsultaInvoices(Owner, Participant, pag.Filter, pag.Pagination, token); } rol = (string)JsonConvert.SerializeObject(Participant); //dataJsonFactura = (string)JsonConvert.SerializeObject(ConsultaGeneral); return(new JsonResult(ConsultaGeneral)); }
public async Task <JsonResult> OnPostLlenarTabla([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(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); prospectoValidar = await _peopleService.ConsultaDatosParaVerificarAsync(Confirmant, pag.Filter, pag.Pagination, token); if (prospectoValidar.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 (prospectoValidar != null) { prospectoValidar.List.Sort((b, a) => a.CreatedAt.Date.CompareTo(b.CreatedAt.Date)); } var Estados = await _globalService.ConsultaEstatesTF(new ParamCountry { Id = Int32.Parse(Country) }); return(new JsonResult(new { prospecto = prospectoValidar, estados = Estados })); }
public async Task <JsonResult> OnPostPostponed([FromBody] RequestPagination pagination) { List <Invoices> dataResponse = new List <Invoices>(); var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var data = await this._iS.GetPostponed(c, pagination.Filter, pagination.Pagination, token); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } for (int x = 0; x < data.Count; x++) { if (data[x].Publications[0].State != "paid") { dataResponse.Add(data[x]); } } return(new JsonResult(dataResponse)); }
public async Task <JsonResult> OnPostReleasable([FromBody] RequestPagination pag) { List <Publications> bankOfferts = new List <Publications>(); var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var dataFacturas = await this._aS.GetPublishable(c, pag.Type, pag.Filter, pag.Pagination, token); if (dataFacturas.Count == 0 || dataFacturas[0].Error == null || dataFacturas[0].Errors == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._auS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } for (int x = 0; x < dataFacturas.Count; x++) { if (dataFacturas[x].Invoice.Term_days >= 30 && dataFacturas[x].Program.Abbreviation == "DIRECT" || dataFacturas[x].Program.Abbreviation == "CONFIRMING") { bankOfferts.Add(dataFacturas[x]); } } return(new JsonResult(bankOfferts)); }
public async Task <JsonResult> OnPostDetalleAsync([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); Confirmant = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); //pag.Filter.Debtor_id = null; var ConsultaGeneral = await _invoiceService.GetConsultaInvoices(Confirmant, "CONFIRMANT", pag.Filter, pag.Pagination, token); return(new JsonResult(ConsultaGeneral)); }
public async Task <JsonResult> OnPostUnpayedInvoices([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var unpaymentsQuery = await _paymentService.ReceiptsQueryBackoffice("unpaid", Country, pag.Filter, pag.Pagination, token); return(new JsonResult(unpaymentsQuery)); }
public async Task <IActionResult> OnGetAsync([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); if (token == null) { return(RedirectToPage("/logout", "session expired", new { returnUrl = "~/index?error=sessionExpired" })); } dataFilter = JsonConvert.SerializeObject(filter); Owner = User.Claims.Where(x => x.Type == "Owner").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(); if (HttpContext.Session.GetString("CountryInvoices") == null || JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Id != Int32.Parse(Country)) { var data = await _globalService.GetDataCountryInvoices(Int32.Parse(Country), token); if (data.Errors == this.__notAuthorized) { return(RedirectToPage("/logout", "session expired", new { returnUrl = "~/index?error=sessionExpired" })); } HttpContext.Session.SetString("CountryInvoices", JsonConvert.SerializeObject(data)); } List <Invoices> facturaCheck = new List <Invoices>(); Currency_options = new List <SelectListItem>(); Status_Options = new List <SelectListItem>(); Programs_Options = new List <SelectListItem>(); foreach (var program in JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Program) { if (!Programs_Options.Exists(x => x.Text == program.Abbreviation)) { Programs_Options.Add(new SelectListItem() { Value = "" + program.Abbreviation, Text = program.Abbreviation }); } } foreach (var currency in JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Currencies) { Currency_options.Add(new SelectListItem() { Value = "" + currency.Id.Value, Text = currency.Name }); } return(Page()); }
public async Task <IActionResult> GetListAsync([FromQuery] RequestPagination request) { var dtos = await this.superheroService.ListPaginatedAsync(request.PageNumber, request.PageSize); if (dtos == null) { return(NotFound()); } var count = await this.superheroService.CountAllAsync(); return(Ok(CreateResponsePaginated(dtos, count, request.PageSize, request.PageNumber))); }
public async Task <JsonResult> OnPostPayedInvoices([FromBody] RequestPagination pag) { Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); 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(); var principalCurrency = JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Currency; string filtroBanco = null; //var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(Owner, "paid", Country, null, null, pag.Filter, pag.Pagination, token); if (pag.Filter != null) { if (pag.Filter.Confirmant_id != null && pag.Filter.Confirmant_id != "" && pag.Filter.Confirmant_id != "selecione") { filtroBanco = pag.Filter.Confirmant_id; } } var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, Entity = filtroBanco, State = "paid,unpaid", Country = Country }, pag.Filter, pag.Pagination, token); //var unpaymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, Entity = filtroBanco, State = "unpaid", Country = Country }, pag.Filter, pag.Pagination, token); var unpaymentsQuery = new List <Receipts>(); if (paymentsQuery.Count == 0 || paymentsQuery[0].Errors == null || unpaymentsQuery.Count == 0 || unpaymentsQuery[0].Errors == 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 (unpaymentsQuery != null && unpaymentsQuery.Count > 0) { foreach (var receipt in unpaymentsQuery) { paymentsQuery.Add(receipt); } } if (principalCurrency != null) { paymentsQuery = paymentsQuery.OrderBy(x => x.Currency.Id != principalCurrency.Id).ThenByDescending(y => y.Receipt_date).ThenBy(z => z.Receiver.Name).ToList(); } return(new JsonResult(paymentsQuery)); }
public async Task <JsonResult> OnPostLlenarConsultaAsync([FromBody] RequestPagination pag) { List <Publications> dataResponse = new List <Publications>(); Country = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var principalCurrency = JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Currency; var token = HttpContext.Session.GetString("token"); var w = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); var owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var o = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault(); var data = await _invoiceService.GetPublicationsSessionsFactor(owner, Int32.Parse(o), pag.Filter, pag.Pagination, token); if (data.Count == 0 || data[0].Errors == null || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "CONFIRMANT", token, w); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } for (int x = 0; x < data.Count; x++) { if (data[x].State != "processing") { dataResponse.Add(data[x]); } } if (principalCurrency != null) { dataResponse = dataResponse.OrderBy(x => x.currency.Id != principalCurrency.Id).ThenBy(y => y.Invoice.Supplier.Name).ThenBy(z => z.Invoice.Debtor.Name).ToList(); } return(new JsonResult(dataResponse)); }
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 })); }
PaginationViewModel <BookViewModel> IBookService.GetPagination(RequestPagination requestPagination, List <BookViewModel> entries) { var count = entries.Count(); var page = requestPagination.Page.GetValueOrDefault(); var pageSize = requestPagination.PageSize.GetValueOrDefault(); entries = entries.Skip((page - 1) * pageSize).Take(pageSize).ToList(); PaginationViewModel <BookViewModel> pagi = new PaginationViewModel <BookViewModel>(); pagi.Amount = pageSize; pagi.Data = entries; pagi.TotalCount = count; pagi.TotalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; return(pagi); }
public async Task <IActionResult> OnPostCandidates([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); var w = User.Claims.Where(x => x.Type == "Confirmant").Select(x => x.Value).SingleOrDefault(); var data = await this._iS.GetCandidates(w, pag.Filter, pag.Pagination, token); if (data.Count == 0 || data[0].Errors == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._aS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "CONFIRMANT", token, w); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(data)); }
public async Task <JsonResult> OnPostReleasable([FromBody] RequestPagination pag) { var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var dataFacturas = await this._aS.GetPublishable(c, pag.Type, pag.Filter, pag.Pagination, token); if (dataFacturas.Count == 0 || dataFacturas[0].Error == null || dataFacturas[0].Errors == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._auS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(dataFacturas)); }
public async Task <JsonResult> OnPostInvoices([FromBody] RequestPagination pagination) { var token = HttpContext.Session.GetString("token"); var c = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var o = Int32.Parse(User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault()); var data = await this._aS.GetPublications(o, "SUPPLIER", c, pagination.Filter, token, pagination.Pagination); if (data.Count == 0 || data[0].Error == null) { var id = User.Claims.Where(x => x.Type == "Id").Select(x => x.Value).SingleOrDefault(); var l = await this._authS.RefreshToken(id, CultureInfo.CurrentCulture.Name, "SUPPLIER", token); if (l.Error == null) { HttpContext.Session.SetString("token", l.Token); } } return(new JsonResult(data)); }
public async Task <JsonResult> OnPostPayedInvoices([FromBody] RequestPagination pag) { Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault(); var token = HttpContext.Session.GetString("token"); 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(); var principalCurrency = JsonConvert.DeserializeObject <Country>(HttpContext.Session.GetString("CountryInvoices")).Currency; //var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, State = "paid", Country = Country, Method= "DIRECT", StateInvoiceNot= "overdue" }, pag.Filter, pag.Pagination, token); var paymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, State = "paid,unpaid", Consult = true, Country = Country, Method = "DIRECT", Abbreviation = "SALE" }, pag.Filter, pag.Pagination, token); //var unpaymentsQuery = await _paymentService.ReceiptsQueryConfirmant(new ParamConsultaPeyments() { Payer = Owner, State = "unpaid", Consult = true, Country = Country, Method = "DIRECT", Abbreviation = "SALE" }, pag.Filter, pag.Pagination, token); var unpaymentsQuery = new List <Receipts>(); if (paymentsQuery.Count == 0 || paymentsQuery[0].Errors == null || unpaymentsQuery.Count == 0 || unpaymentsQuery[0].Errors == 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 (unpaymentsQuery != null && unpaymentsQuery.Count > 0) { foreach (var receipt in unpaymentsQuery) { paymentsQuery.Add(receipt); } } //if(principalCurrency != null) paymentsQuery = paymentsQuery.OrderBy(x => x.Currency.Id != principalCurrency.Id).ThenBy(j => j.Program.Abbreviation != "CONFIRMING").ThenByDescending(y => y.Receipt_date).ThenBy(z => z.Receiver.Name).ToList(); return(new JsonResult(paymentsQuery)); }
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 ListaClientesBanco = await _peopleService.GetConsultaUsersBackOffice(new ParamProspecto { Country = int.Parse(Country), Filter = pag.Filter, Pagination = pag.Pagination }, token); if (ListaClientesBanco.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); } } return(new JsonResult(ListaClientesBanco)); }
public List <BookViewModel> GetByCondition(RequestPagination requestPagination, List <BookViewModel> entries) { //sort if (!string.IsNullOrEmpty(requestPagination.SortBy)) { if (requestPagination.SortBy.Equals(ObjectFields.BOOK_NAME_INC)) { entries = entries.OrderBy(o => o.Title).ToList(); } if (requestPagination.SortBy.Equals(ObjectFields.BOOK_NAME_DESC)) { entries = entries.OrderByDescending(o => o.Title).ToList(); } } //search if (!string.IsNullOrEmpty(requestPagination.SearchKey)) { var searchKey = requestPagination.SearchKey; entries = entries.Where(s => s.Title.ToUpper().Contains(searchKey.ToUpper()) || s.Authors.Contains(searchKey) || s.Catergory.ToUpper().Contains(searchKey) || s.Publisher.ToUpper().Contains(searchKey.ToUpper())).ToList(); } //fileter if (!string.IsNullOrEmpty(requestPagination.FileterKey)) { var fileterKey = requestPagination.FileterKey; entries = entries.Where(s => s.Catergory.Equals(fileterKey) || s.Publisher.Equals(fileterKey) || s.Authors.Equals(fileterKey)).ToList(); } return(entries); }