コード例 #1
0
        public string VerTipoUsuario(string user)
        {
            string json = "";
            TipoUsuarioVistaModelo usu;

            UsuarioModelo modelo = new UsuarioModelo();

            try
            {
                user = System.Web.HttpContext.Current.Session["sessionUsuario"].ToString();
                usu  = modelo.ValidarTipoUsuarioVarios(user);
                string host = HttpContext.Request.Url.Host;
                string htt  = HttpContext.Request.Url.ToString();

                htt = htt.Substring(0, htt.IndexOf(':') + 1);
                string puerto = HttpContext.Request.Url.Port.ToString();
                usu.url = htt + "//" + host + ":" + puerto;

                json = new JavaScriptSerializer().Serialize(usu);
            }
            catch (Exception e)
            {
                BitacoraEventos.InsertaError("HomeController", "VerTipoUsuario", "Validar tipo usuario", (e.Message == null ? "" : e.Message) + " - " + (e.InnerException == null ? "" : e.InnerException.ToString()) + " - " + (e.StackTrace == null ? "" : e.StackTrace.ToString()), user);
            }


            return(json);
        }
コード例 #2
0
        public string ValidarUsuario(string usuario, string pass)
        {
            MensajeVistaModelo res;
            UsuarioModelo      um   = new UsuarioModelo();
            string             json = "";

            try
            {
                res = um.validarSeccionUsurio(usuario, pass);
                if (res.Exito == true)
                {
                    System.Web.HttpContext.Current.Session["sessionUsuario"] = usuario;
                }
                json = new JavaScriptSerializer().Serialize(res);
            }catch (Exception e)
            {
                res         = new MensajeVistaModelo();
                res.Exito   = false;
                res.Mensaje = "Error, contacte al administrador";
                BitacoraEventos.InsertaError("HomeController", "Index", "Mostrar Usuario", (e.Message == null ? "" : e.Message) + " - " + (e.InnerException == null ? "" : e.InnerException.ToString()) + " - " + (e.StackTrace == null ? "" : e.StackTrace.ToString()), "L03036903");
            }



            return(json);
        }
コード例 #3
0
        public ActionResult Index()

        {
            try
            {
                var user = System.Web.HttpContext.Current.Session["sessionUsuario"];
                if (user == null)
                {
                    return(View("~/Views/Login/Denegado.cshtml"));
                }
            }
            catch (Exception e)
            {
                BitacoraEventos.InsertaError("HomeController", "Index", "Mostrar Usuario", (e.Message == null ? "" : e.Message) + " - " + (e.InnerException == null ? "" : e.InnerException.ToString()) + " - " + (e.StackTrace == null ? "" : e.StackTrace.ToString()), "");
            }


            return(View());
        }