public async Task <IActionResult> OnGetAsync()
        {
            var token = HttpContext.Session.GetString("token");

            if (token == null || token == "" || token == "null")
            {
                return(RedirectToPage("/logout"));
            }
            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();
            //----------- Llenado de Country

            /*
             * if (HttpContext.Session.GetString("CountryIdentifications") == null ||
             *  HttpContext.Session.GetString("CountryIdentifications") == "" ||
             *  HttpContext.Session.GetString("CountryIdentifications") == "null")
             * {
             *  Identifications = await _globalService.ConsultaRegiosAndCitiesTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) });
             *  HttpContext.Session.SetString("CountryIdentifications", JsonConvert.SerializeObject(Identifications));
             * }
             * else Identifications = JsonConvert.DeserializeObject<ListCountry>(HttpContext.Session.GetString("CountryIdentifications"));
             */
            //----------- Llenado de Country

            Identifications = await _globalService.ConsultaRegiosAndCitiesTF(new ParamCountry { Id = Int32.Parse(Country) });

            City_Options   = new List <SelectListItem>();
            Status_Options = new List <SelectListItem>();
            Status_Options.Add(new SelectListItem()
            {
                Value = "0", Text = "Activo"
            });
            Status_Options.Add(new SelectListItem()
            {
                Value = "1", Text = "Bloqueado"
            });

            Discriminator_options = new List <SelectListItem>();
            Discriminator_options.Add(new SelectListItem()
            {
                Value = "LEGAL", Text = "Persona Legal"
            });
            Discriminator_options.Add(new SelectListItem()
            {
                Value = "PERSON", Text = "Persona Natural"
            });

            Participant_options = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "DEBTOR", Text = "EMPRESAS"
                },
                new SelectListItem()
                {
                    Value = "SUPPLIER", Text = "PROVEEDORES"
                },
                new SelectListItem()
                {
                    Value = "CONFIRMANT", Text = "BANCOS"
                },
                new SelectListItem()
                {
                    Value = "FACTOR", Text = "INVERSIONISTAS"
                }
            };

            //Para llenar El filtro de Estados
            State_Options = new List <SelectListItem>();
            foreach (var state in Identifications.Regions)
            {
                State_Options.Add(new SelectListItem()
                {
                    Value = state.id.ToString(), Text = state.Name
                });
            }

            filter        = new List <filterInvoice>();
            financiedNull = new List <bool?>();
            dataFilter    = new List <string>();

            for (var i = 0; i < Identifications.Currencies.Count; i++)
            {
                filter.Add(new filterInvoice()
                {
                    Financied = null
                });
                financiedNull.Add(null);
                dataFilter.Add(JsonConvert.SerializeObject(filter[i]));
            }
            //filter = new filterInvoice() { Financied = false };

            dataJsonCurrencies    = JsonConvert.SerializeObject(Identifications.Currencies);
            listadosInicialesJson = JsonConvert.SerializeObject(Identifications);
            return(Page());
        }
Пример #2
0
        public async Task <IActionResult> OnGetAsync()
        {
            var token = HttpContext.Session.GetString("token");

            if (token == null || token == "" || token == "null")
            {
                return(RedirectToPage("/logout", "session expired", new { returnUrl = "~/index?error=sessionExpired" }));
            }

            filter = new filterInvoice()
            {
                Financied = false
            };
            dataFilter    = JsonConvert.SerializeObject(filter);
            financiedNull = null;
            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();

            //----------- Llenado de Country
            if (HttpContext.Session.GetString("CountryIdentifications") == null ||
                HttpContext.Session.GetString("CountryIdentifications") == "" ||
                HttpContext.Session.GetString("CountryIdentifications") == "null")
            {
                Identifications = await _globalService.ConsultaRegiosAndCitiesTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) });

                HttpContext.Session.SetString("CountryIdentifications", JsonConvert.SerializeObject(Identifications));
            }
            else
            {
                Identifications = JsonConvert.DeserializeObject <ListCountry>(HttpContext.Session.GetString("CountryIdentifications"));
            }
            //----------- Llenado de Country

            City_Options   = new List <SelectListItem>();
            Status_Options = new List <SelectListItem>();
            Status_Options.Add(new SelectListItem()
            {
                Value = "0", Text = "Activo"
            });
            Status_Options.Add(new SelectListItem()
            {
                Value = "1", Text = "Bloqueado"
            });

            Discriminator_options = new List <SelectListItem>();
            Discriminator_options.Add(new SelectListItem()
            {
                Value = "LEGAL", Text = "Persona Legal"
            });
            Discriminator_options.Add(new SelectListItem()
            {
                Value = "PERSON", Text = "Persona Natural"
            });

            Participant_options = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "DEBTOR", Text = "EMPRESAS"
                },
                new SelectListItem()
                {
                    Value = "SUPPLIER", Text = "PROVEEDORES"
                },
                new SelectListItem()
                {
                    Value = "FACTOR", Text = "INVERSIONISTAS"
                }
            };

            //Para llenar El filtro de Estados
            State_Options = new List <SelectListItem>();
            foreach (var state in Identifications.Regions)
            {
                State_Options.Add(new SelectListItem()
                {
                    Value = state.id.ToString(), Text = state.Name
                });
            }
            State_Options.Sort((a, b) => a.Text.CompareTo(b.Text));
            listadosInicialesJson = JsonConvert.SerializeObject(Identifications);

            return(Page());
        }