Example #1
0
        public ActionResult Logueo(Usuario user)
        {
            using (SistemaDBContext db = new SistemaDBContext())
            {
                //Filtro solamente por la clave primaria (Username)
                //var usr = db.SISUsuarios.Where(u => u.Username == user.Username && u.Password == user.Password).FirstOrDefault();
                var usr = db.Usuarios.Where(u => u.CodUsr == user.CodUsr.ToUpper()).FirstOrDefault();
                if (usr != null)
                {
                    string pwddecript = "";
                    if (usr.PwdUsr.Trim() != null)
                    {
                        //llamo a función para desencriptar password
                        pwddecript = DecryptPwd(usr.PwdUsr);
                    }

                    if ((string.IsNullOrEmpty(user.PwdUsr)) || (user.PwdUsr.Trim() == pwddecript))
                    {
                        //CREO VARIABLES DE SESIÓN
                        Session["Codusr"] = usr.CodUsr.ToString();
                        Session["Nomusr"] = usr.NomUsr.ToString();
                        return(RedirectToAction("Resumen", "ComisionesBP", null));
                    }
                    else
                    {
                        ModelState.AddModelError("", "Usuario o Contraseña Incorrecta");
                    }
                }
                else
                {
                    ModelState.AddModelError("", "Usuario o Contraseña Incorrecta");
                }
            }
            return(View());
        }
Example #2
0
 public CrimesController(SistemaDBContext context)
 {
     _context = context;
 }
Example #3
0
 public UsersController(SistemaDBContext context)
 {
     _context = context;
 }
Example #4
0
 public StatusController(SistemaDBContext context)
 {
     _context = context;
 }