示例#1
0
 protected void cargarUsuario()
 {
     System.Web.Security.MembershipUser logUser = System.Web.Security.Membership.GetUser(User.Identity.Name);
     objNOrientador = objDOrientador.obtenerDatosOrientadorCompleto(logUser.UserName.ToString());
     txtPass.Text   = objNOrientador.pass;
     txtId.Text     = objNOrientador.IDOrientador1.ToString();
 }
示例#2
0
        public List <clsOrientador> consultaDatosOrientador(int IDPROCESODUPLICADO)
        {
            string sql = "SELECT ORIENTADOR.NOMBREORIENTADOR, ORIENTADOR.IDORIENTADOR FROM  PROCESO INNER JOIN ORIENTADOR ON PROCESO.IDORIENTADOR = ORIENTADOR.IDORIENTADOR WHERE (PROCESO.IDPROCESODUPLICADO = " + IDPROCESODUPLICADO + ")";

            SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);

            List <clsOrientador> listaOrientador = new List <clsOrientador>();

            clsConexion.abrirConexion();

            // el lectorProductos consigue todo el contenido dentro de la tabla Producto
            SqlDataReader lectorJovenes = comando.ExecuteReader();

            //ciclo para guardar todos los datos de lectorProductos a la lista en forma de objeto
            while (lectorJovenes.Read())
            {
                clsOrientador objOrientador = new clsOrientador();
                // cada indice significa el lugar dentro de la tabla Producto
                // Es importante conocer la estructura de la tabla, sino genera error

                //
                objOrientador.IDOrientador1    = lectorJovenes.GetInt32(1);
                objOrientador.NombreOrientador = lectorJovenes.GetString(0);


                listaOrientador.Add(objOrientador);
            }
            lectorJovenes.Close();
            clsConexion.cerrarConexion();
            return(listaOrientador);
        }
示例#3
0
        static clsOrientador transformar(ORIENTADOR newOrientador)
        {
            clsOrientador orientador = new clsOrientador();

            orientador.IDOrientador1      = newOrientador.IDORIENTADOR;
            orientador.NombreOrientador   = newOrientador.NOMBREORIENTADOR;
            orientador.apellidoOrientador = newOrientador.APELLIDOORIENTADOR;
            orientador.generoOrientador   = newOrientador.GENEROORIENTADOR.ToString();
            orientador.estadoOrientador   = newOrientador.ESTADOORIENTADOR;
            return(orientador);
        }
 protected void cargarUsuario()
 {
     try
     {
         if (int.Parse(ddlTipoUsuario.SelectedValue) < 3)
         {
             objNUsuario             = objDUsuario.obtenerDatosUsuarioID(int.Parse(ddlUsuario.SelectedValue.ToString()));
             txtNombreUsuario.Text   = objNUsuario.nombre;
             txtApellidoUsuario.Text = objNUsuario.appellido;
             txtIdUsuario.Text       = objNUsuario.idUser.ToString();
             if (objNUsuario.genero == "M")
             {
                 ddlGeneroUsuario.SelectedValue = "2";
             }
             else if (objNUsuario.genero == "F")
             {
                 ddlGeneroUsuario.SelectedValue = "1";
             }
             else
             {
                 ddlGeneroUsuario.SelectedValue = "0";
             }
             ddlEstado.SelectedValue = objNUsuario.estado.ToString();
         }
         if (int.Parse(ddlTipoUsuario.SelectedValue) == 3)
         {
             objNOrientador          = objDOrientador.D_consultarOrientadores(int.Parse(ddlUsuario.SelectedValue.ToString()));
             txtNombreUsuario.Text   = objNOrientador.NombreOrientador;
             txtApellidoUsuario.Text = objNOrientador.apellidoOrientador;
             txtIdUsuario.Text       = objNOrientador.IDOrientador1.ToString();
             if (objNOrientador.generoOrientador == "M")
             {
                 ddlGeneroUsuario.SelectedValue = "2";
             }
             else if (objNOrientador.generoOrientador == "F")
             {
                 ddlGeneroUsuario.SelectedValue = "1";
             }
             else
             {
                 ddlGeneroUsuario.SelectedValue = "0";
             }
             ddlEstado.SelectedValue = objNOrientador.estadoOrientador.ToString();
         }
     }
     catch (Exception)
     {
     }
 }
示例#5
0
 public bool actualizarPass(clsOrientador usuario)
 {
     try
     {
         clsConexion.abrirConexion();
         string     sql     = "EXECUTE ActualizarPassOrientador " + usuario.IDOrientador1 + ",'" + usuario.pass + "';";
         SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);
         comando.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         clsConexion.cerrarConexion();
     }
 }
示例#6
0
        public clsOrientador obtenerDatosOrientadorCompleto(string logUser)
        {
            try
            {
                clsConexion clsConexion = new clsConexion();

                string sql = "SELECT * FROM ORIENTADOR,aspnet_Users,aspnet_Membership WHERE ORIENTADOR.USERIDASP = aspnet_Users.UserId " +
                             "AND aspnet_Membership.UserId = aspnet_Users.UserId  AND aspnet_Users.UserName ='******'";
                SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);

                clsConexion.abrirConexion();

                SqlDataReader lector = comando.ExecuteReader();

                clsOrientador usuario = new clsOrientador();

                while (lector.Read())
                {
                    usuario.IDOrientador1    = lector.GetInt32(0);
                    usuario.NombreOrientador = lector.GetString(2);
                    usuario.estadoOrientador = lector.GetBoolean(5);
                    usuario.pass             = lector.GetString(15);
                    try
                    {
                        usuario.apellidoOrientador = lector.GetString(3);
                        usuario.generoOrientador   = lector.GetString(4);
                    }
                    catch (Exception ex)
                    {
                        usuario.apellidoOrientador = "";
                        usuario.generoOrientador   = "";
                    }
                }

                clsConexion.cerrarConexion();
                return(usuario);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#7
0
 public bool D_actualizarUsuario(clsOrientador usuario, clsNMembership userM)
 {
     try
     {
         clsConexion.abrirConexion();
         string sql = "EXECUTE ActualizaOrientadorMembership " + usuario.IDOrientador1 + ",'" + usuario.NombreOrientador + "', '" + usuario.apellidoOrientador + "'," +
                      "'" + usuario.generoOrientador + "', '" + usuario.estadoOrientador + "', '" + userM.username + "', '" + userM.lowUsername + "', '" + userM.email + "','" + userM.lowEmail + "';";
         SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);
         comando.ExecuteNonQuery();
         return(true);
     }
     catch (Exception ex)
     {
         return(false);
     }
     finally
     {
         clsConexion.cerrarConexion();
     }
 }
示例#8
0
 private void Cargar()
 {
     System.Web.Security.MembershipUser logUser = System.Web.Security.Membership.GetUser(User.Identity.Name);
     LogUsuario              = objDUsuario.obtenerDatosOrientadorCompleto(logUser.UserName.ToString());
     txtNombreUsuario.Text   = LogUsuario.NombreOrientador;
     txtApellidoUsuario.Text = LogUsuario.apellidoOrientador;
     txtIdUsuario.Text       = LogUsuario.IDOrientador1.ToString();
     if (LogUsuario.generoOrientador == "M")
     {
         ddlGeneroUsuario.SelectedValue = "2";
     }
     else if (LogUsuario.generoOrientador == "F")
     {
         ddlGeneroUsuario.SelectedValue = "1";
     }
     else
     {
         ddlGeneroUsuario.SelectedValue = "0";
     }
 }
示例#9
0
        public clsOrientador D_consultarOrientadores(int id)
        {
            try
            {
                clsConexion clsConexion = new clsConexion();

                string     sql     = "SELECT * FROM ORIENTADOR,aspnet_Users WHERE ORIENTADOR.USERIDASP = aspnet_Users.UserId AND ORIENTADOR.IDORIENTADOR =" + id;
                SqlCommand comando = new SqlCommand(sql, clsConexion.conexion);

                clsConexion.abrirConexion();

                SqlDataReader lector = comando.ExecuteReader();

                clsOrientador usuario = new clsOrientador();

                while (lector.Read())
                {
                    usuario.IDOrientador1    = lector.GetInt32(0);
                    usuario.NombreOrientador = lector.GetString(2);
                    usuario.estadoOrientador = lector.GetBoolean(5);
                    try
                    {
                        usuario.apellidoOrientador = lector.GetString(3);
                        usuario.generoOrientador   = lector.GetString(4);
                    }
                    catch (Exception ex)
                    {
                        usuario.apellidoOrientador = "";
                        usuario.generoOrientador   = "";
                    }
                }

                clsConexion.cerrarConexion();
                return(usuario);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
示例#10
0
        protected void btnActualizarUsuario_Click(object sender, EventArgs e)
        {
            if (ddlGeneroUsuario.SelectedValue == "0")
            {
                Response.Write("<script>window.alert('Resultado Actualización: INCORRECTO');</script>");
            }
            else
            {
                clsOrientador usuario = new clsOrientador();
                usuario.IDOrientador1      = int.Parse(txtIdUsuario.Text);
                usuario.NombreOrientador   = txtNombreUsuario.Text;
                usuario.apellidoOrientador = txtApellidoUsuario.Text;
                if (ddlGeneroUsuario.SelectedValue == "1")
                {
                    usuario.generoOrientador = "F";
                }
                if (ddlGeneroUsuario.SelectedValue == "2")
                {
                    usuario.generoOrientador = "M";
                }

                clsNMembership userM = new clsNMembership();
                userM.email       = txtEmail.Text;
                userM.lowEmail    = txtEmail.Text.ToLower();
                userM.username    = txtUserName.Text;
                userM.lowUsername = txtUserName.Text.ToLower();
                userM.id          = int.Parse(txtIdUsuario.Text);
                if (objDUsuario.D_actualizarUsuario(usuario, userM))
                {
                    Response.Write("<script>window.alert('Resultado Actualización: CORRECTO');</script>");
                }
                else
                {
                    Response.Write("<script>window.alert('Resultado Actualización: INCORRECTO, Vuelva a intentarlo');</script>");
                    Cargar();
                    cargarMemberhsip();
                }
            }
        }
示例#11
0
        public bool ingresarOrientador(clsOrientador orientador, string username)
        {
            try
            {
                clsConexion.abrirConexion();

                string cadena = " DECLARE @aspUserId uniqueidentifier " +
                                "SET @aspUserId = (SELECT UserId FROM aspnet_Users WHERE UserName = '******')" +
                                "INSERT INTO ORIENTADOR(USERIDASP, NOMBREORIENTADOR,APELLIDOORIENTADOR,GENEROORIENTADOR,ESTADOORIENTADOR)" +
                                "VALUES(@aspUserId, '" + orientador.NombreOrientador + "','" + orientador.apellidoOrientador + "','" + orientador.generoOrientador + "','" + orientador.estadoOrientador + "')";

                SqlCommand comando = new SqlCommand(cadena, clsConexion.Conexion);
                comando.ExecuteNonQuery();                      // Ejecutamos el comando
                return(true);
            }
            catch (Exception)
            {
                return(false);
            }
            finally                                                     // Si no entra ni en try ni en catch
            {
                clsConexion.cerrarConexion();                           // Siempre en finally se cierra la conexión con la base de datos
            }
        }