Esempio n. 1
0
        public BackOfficeLoginVM LoginBackOffice(BackOfficeLoginVM usuarioModel)
        {
            BackOfficeLoginVM resultado = null;

            try
            {
                using (var bdConn = new OracleConnection(cadenaConexion))
                {
                    using (var bdCmd = new OracleCommand("PKG_USUARIO.SP_VALIDAR_USUARIO", bdConn))
                    {
                        bdCmd.CommandType = CommandType.StoredProcedure;
                        bdCmd.Parameters.AddRange(ParametrosLogin(usuarioModel.Usuario, usuarioModel.Password));

                        bdConn.Open();
                        using (var bdRd = bdCmd.ExecuteReader(CommandBehavior.CloseConnection | CommandBehavior.SingleResult))
                        {
                            if (bdRd.HasRows)
                            {
                                resultado = new BackOfficeLoginVM();
                                while (bdRd.Read())
                                {
                                    if (!DBNull.Value.Equals(bdRd["ID_USARIO"]))
                                    {
                                        resultado.UsuarioCodigo = (bdRd["ID_USARIO"]).ValorEntero();
                                    }
                                    if (!DBNull.Value.Equals(bdRd["NRO_DOCUMENTO"]))
                                    {
                                        resultado.NumeroDocumento = (bdRd["NRO_DOCUMENTO"]).ValorCadena();
                                    }
                                    if (!DBNull.Value.Equals(bdRd["APELLIDO_MATERNO"]))
                                    {
                                        resultado.ApellidoMaterno = (bdRd["APELLIDO_MATERNO"]).ValorCadena();
                                    }
                                    if (!DBNull.Value.Equals(bdRd["APELLIDO_PATERNO"]))
                                    {
                                        resultado.ApellidoPaterno = (bdRd["APELLIDO_PATERNO"]).ValorCadena();
                                    }
                                    if (!DBNull.Value.Equals(bdRd["NOMBRES"]))
                                    {
                                        resultado.Nombres = (bdRd["NOMBRES"]).ValorCadena();
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(resultado);
        }
        public ActionResult LoginBackOffice(BackOfficeLoginVM request)
        {
            BackOfficeBLL backOfficeBL = new BackOfficeBLL();
            var           result       = backOfficeBL.LoginBackOffice(request);

            if (result == null)
            {
                ViewBag.ErrorMessage = "El usuario y/o clave son incorrectos";
            }
            else
            {
                var resultMenu = backOfficeBL.MenuBackOffice(result.UsuarioCodigo);
                Session["menuBackOffice"] = resultMenu;
                return(RedirectToAction("Index"));
            }
            return(View(request));
        }
        //prueba//
        public ActionResult LoginBackOffice()
        {
            BackOfficeLoginVM model = new BackOfficeLoginVM();

            return(View(model));
        }
Esempio n. 4
0
 public BackOfficeLoginVM LoginBackOffice(BackOfficeLoginVM usuarioModel)
 {
     return(backofficeDAL.LoginBackOffice(usuarioModel));
 }