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

            if (token == null || token == "" || token == "null")
            {
                return(RedirectToPage("/logout"));
            }
            Country          = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault();
            TipoParticipante = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault();
            Debtor_Options   = new List <SelectListItem>();
            Email_options    = new List <SelectListItem>();
            Currency_options = new List <SelectListItem>();
            Status_Options   = new List <SelectListItem>();
            ListStatus();
            //----------- Llenado de Country
            if (HttpContext.Session.GetString("CountryIdentifications") == null ||
                HttpContext.Session.GetString("CountryIdentifications") == "" ||
                HttpContext.Session.GetString("CountryIdentifications") == "null")
            {
                Identifications = await _globalService.ConsultasCountryTF(new ParamCountry { Id = Int32.Parse(Country) });

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

            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]));
            }

            dataJsonCurrencies    = JsonConvert.SerializeObject(Identifications.Currencies);
            listadosInicialesJson = JsonConvert.SerializeObject(Identifications);
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync(int idRegistro)
        {
            HttpContext.Session.SetInt32("idRegistro", idRegistro);
            registrarClienteTF.Registrarse = new Persons();
            registrarClienteTF.Rol         = idRegistro;
            registrarClienteTF.User        = new User();

            if (idRegistro > 0 && idRegistro < 5)
            {
                ViewData["Layout"]     = "~/Pages/Shared/_RegisterLayout.cshtml";
                ViewData["IdRegistro"] = "";
                Rol = idRegistro;
            }
            else
            {
                Participant = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault();
                Country     = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault();
                registrarClienteTF.User.Participant = Participant;
                TipoParticipante = Participant;

                ViewData["Layout"]     = "~/Pages/Shared/_Layout.cshtml";
                ViewData["IdRegistro"] = "appRegistroEmpresas";
                var token = HttpContext.Session.GetString("token");
                if (token == null || token == "" || token == "null")
                {
                    return(RedirectToPage("/logout"));
                }
            }

            string pais       = HttpContext.Session.GetString("pais");
            string paisCookie = Request.Cookies["Country"];

            try {
                if ((HttpContext.Session.GetString("CountryRegister") == null ||
                     HttpContext.Session.GetString("CountryRegister") == "" ||
                     HttpContext.Session.GetString("CountryRegister") == "null") ||
                    pais != paisCookie)
                {
                    HttpContext.Session.SetString("pais", Request.Cookies["Country"]);
                    registrarClienteTF.DataPaises = await _globalService.ConsultasCountryTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) });

                    HttpContext.Session.SetString("CountryRegister", JsonConvert.SerializeObject(registrarClienteTF.DataPaises));
                }
                else
                {
                    registrarClienteTF.DataPaises = JsonConvert.DeserializeObject <ListCountry>(HttpContext.Session.GetString("CountryRegister"));
                }
            } catch (Exception e) { return(RedirectToPage("../Index")); }
            //registrarClienteTF.DataPaises = await _globalService.ConsultasCountryTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) });
            registroJson = JsonConvert.SerializeObject(registrarClienteTF);
            return(Page());
        }
Esempio n. 3
0
        public async Task <IActionResult> OnGetAsync()
        {
            var token = HttpContext.Session.GetString("token");

            if (token == null || token == "" || token == "null")
            {
                return(RedirectToPage("/logout"));
            }

            filter = new filterInvoice()
            {
                Financied = null
            };
            dataFilter       = JsonConvert.SerializeObject(filter);
            financiedNull    = null;
            TipoParticipante = User.Claims.Where(x => x.Type == "Participant").Select(x => x.Value).SingleOrDefault();
            Debtor_Options   = new List <SelectListItem>();
            Email_options    = new List <SelectListItem>();
            Currency_options = new List <SelectListItem>();
            //----------- Llenado de Country
            if (HttpContext.Session.GetString("CountryIdentifications") == null ||
                HttpContext.Session.GetString("CountryIdentifications") == "" ||
                HttpContext.Session.GetString("CountryIdentifications") == "null")
            {
                Identifications = await _globalService.ConsultasCountryTF(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

            listadosInicialesJson = JsonConvert.SerializeObject(Identifications);
            return(Page());
        }
        public async Task <IActionResult> OnGetAsync()
        {
            var token = HttpContext.Session.GetString("token");

            Owner = User.Claims.Where(x => x.Type == "Owner").Select(x => x.Value).SingleOrDefault();
            if (token == null || token == "" || token == "null" || Owner == null)
            {
                return(RedirectToPage("/logout"));
            }
            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();
            Country       = User.Claims.Where(x => x.Type == "Country").Select(x => x.Value).SingleOrDefault();
            Discriminator = User.Claims.Where(x => x.Type == "Discriminator").Select(x => x.Value).SingleOrDefault();
            var Auth    = (await _AuthorizationService.AuthorizeAsync(User, "PolicyProfileChange")).Succeeded;
            var AuthRol = User.IsInRole("LEGAL");

            TipoParticipante = Participant;
            switch (Participant)
            {
            case "CONFIRMANT":
                NRol = 5; break;

            case "DEBTOR":
                NRol = 1; break;

            case "FACTOR":
                NRol = 3; break;

            case "SUPPLIER":
                NRol = 2; break;

            case "BACKOFFICE":
                NRol = 6; break;
            }

            registrarClienteTF.User               = new User();
            registrarClienteTF.Registrarse        = new PesonProfile();
            registrarClienteTF.User.Participant   = Participant;
            registrarClienteTF.User.Discriminator = Discriminator;

            if (HttpContext.Session.GetString("CountryPerfil") == null || HttpContext.Session.GetString("CountryPerfil") == "null" || HttpContext.Session.GetString("CountryPerfil") == "")
            {
                registrarClienteTF.DataPaises = await _globalService.ConsultasCountryTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]) });

                HttpContext.Session.SetString("CountryPerfil", JsonConvert.SerializeObject(registrarCliente.DataPaises));
            }
            else
            {
                registrarClienteTF.DataPaises = JsonConvert.DeserializeObject <ListCountry>(HttpContext.Session.GetString("CountryPerfil"));
            }

            filterInvoice PeopleId = new filterInvoice();

            PeopleId.Id = Owner;
            registrarClienteTF.Perfil = await _peopleService.RegisterById(new ParamProspecto { Participant = Participant, Filter = PeopleId, Country = int.Parse(Country) }, token);

            if (registrarClienteTF.Perfil.Addresses != null)
            {
                registrarClienteTF.Cities = await _globalService.ConsultaCitiesTF(new ParamCountry { Id = Int32.Parse(Request.Cookies["Country"]), Region = registrarClienteTF.Perfil.Addresses[0].Region });
            }

            if (registrarClienteTF.Perfil != null && registrarClienteTF.Perfil.Contacts != null && registrarClienteTF.Perfil.Contacts.Count > 0)
            {
                foreach (var legal in registrarClienteTF.Perfil.Contacts)
                {
                    if (legal.Label == "LEGAL")
                    {
                        HttpContext.Session.SetString("RepresentanteLegal", JsonConvert.SerializeObject(legal));
                    }
                }
            }
            RellenarPerfil();

            registrarClienteTF.AuthRol     = Auth;
            registrarClienteTF.ContratAuth = (await _AuthorizationService.AuthorizeAsync(User, "PolicyContracts")).Succeeded;
            registroJson = JsonConvert.SerializeObject(registrarClienteTF);
            return(Page());
        }
        public async Task <IActionResult> OnPost()
        {
            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 listaClientes = await _peopleService.GetLsitEmailClientConfirmant(Confirmant);
            //----------- Llenado de Country
            if (HttpContext.Session.GetString("CountryIdentifications") == null ||
                HttpContext.Session.GetString("CountryIdentifications") == "" ||
                HttpContext.Session.GetString("CountryIdentifications") == "null")
            {
                Identifications = await _globalService.ConsultasCountryTF(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
            listadosInicialesJson = JsonConvert.SerializeObject(Identifications);
            dataJsonCurrencies    = JsonConvert.SerializeObject(Identifications.Currencies);

            City_Options          = new List <SelectListItem>();
            Discriminator_options = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "LEGAL", Text = "Persona Legal"
                },
                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
                });
                if (state.Cities != null)
                {
                    foreach (var city in state.Cities)
                    {
                        City_Options.Add(new SelectListItem()
                        {
                            Value = city.Id.ToString(), Text = city.Name
                        });
                    }
                }
            }
            financiedNull = new List <bool?>();
            for (var i = 0; i < filter.Count; i++)
            {
                dataFilter.Add(JsonConvert.SerializeObject(filter[i]));
                financiedNull.Add(filter[i].Financied);
            }
            return(Page());
        }