Esempio n. 1
0
        public USER_INFO Login(string usu, string pass)
        {
            DaoCliente dao = new DaoCliente();
            USER_INFO  log = dao.Login(usu, pass);

            return(log);
        }
        public ActionResult LoginPost(FormCollection fc)
        {
            ViewBag.error = null;
            string nombre = fc["usu"];

            Session["usu"] = nombre;
            string pass = fc["pass"];

            //Session["pass"] = pass;
            //string Rol = fc["Rol"];
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            DaoCliente dao    = new DaoCliente();
            USER_INFO  result = dao.Login(nombre, pass);

            if (result != null)
            {
                Session["nombre"]     = result.NOMBRE;
                Session["apellido"]   = result.APELLIDO;
                Session["rut"]        = result.RUT;
                Session["rutempresa"] = result.RUT_EMPRESA;
                Session["perfil"]     = result.PERFIL;
                Session["nombreemp"]  = result.NOMBRE_EMPRESA;
                Session["nombreper"]  = result.NOMBRE_PERFIL;
                return(RedirectToAction("Dashboard"));
            }
            else
            {
                ViewBag.error = "Usuario o contraseña incorrecto(s)";
                return(View("LoginProcess"));
            }


            /*
             * if (result.Equals("Administrador"))
             * {
             *  return RedirectToAction("Dashboard");
             * }
             * else if (result.Equals("Funcionario"))
             * {
             *
             *  return RedirectToAction("Tareas");
             * }
             * else if (result.Equals("Diseñador"))
             * {
             *  return RedirectToAction("Flujos");
             * }
             * else
             * {
             *  Response.Cache.SetCacheability(HttpCacheability.NoCache);
             *
             *  return View("LoginProcess");// deberia redirigir a una mantenedor
             * }
             */
        }