Exemple #1
0
 private void cargarDataGridViewCarreras()
 {
     dgvCarreras.Rows.Clear();
     consulta = "SELECT carrera.id AS id, carrera.nombre AS nombre, division.nombre AS division, nivel_carrera.nombre AS nivel FROM carrera, division, nivel_carrera WHERE carrera.id_division = division.id AND carrera.id_nivel = nivel_carrera.id";
     try
     {
         resultado = conexion.ejecutarComando(consulta);
         if (resultado.HasRows)
         {
             while (resultado.Read())
             {
                 DataGridViewRow fila = new DataGridViewRow();
                 fila.CreateCells(dgvCarreras);
                 fila.Cells[0].Value = resultado["id"].ToString();
                 fila.Cells[1].Value = resultado["nombre"].ToString();
                 fila.Cells[2].Value = resultado["division"].ToString();
                 fila.Cells[3].Value = resultado["nivel"].ToString();
                 dgvCarreras.Rows.Add(fila);
             }
         }
     }
     catch (OdbcException)
     {
     }
 }
        private void btnIngresar_Click(object sender, EventArgs e)
        {
            if (txtCorreo.Text == "" || txtPassword.Text == "")
            {
                MessageBox.Show("Por favor primero llena los datos", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string         consulta  = "SELECT * FROM profesor WHERE correo = '" + txtCorreo.Text + "' AND password = md5('" + txtPassword.Text + "');";
            OdbcDataReader resultado = conexion.ejecutarComando(consulta);

            if (resultado.HasRows)
            {
                MessageBox.Show("Bienvenido", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                //conexion.cerrarConexion();
                Profesor profesor = new Profesor(resultado);
                Inicio   inicio   = new Inicio(this, profesor);
                this.Hide();
                inicio.Show();
            }
            else
            {
                MessageBox.Show("Datos incorrectos, intenta de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                conexion.cerrarConexion();
            }
        }
Exemple #3
0
 public void cargarDataGridProducciones()
 {
     dgvProducciones.Rows.Clear();
     consulta = "SELECT produccion.numero_registro, produccion.titulo, produccion.anio, produccion.fecha_publicacion AS fecha_publicacion, " +
                "tipo_produccion.descripcion AS tipo_produccion, linea_investigacion.descripcion AS linea_investigacion, " +
                "proposito.descripcion AS proposito, institucion.nombre As institucion, produccion.cuenta_curriculum " +
                "FROM produccion, tipo_produccion, linea_investigacion, proposito, institucion, profesor_colabora_produccion, profesor " +
                "WHERE produccion.id_tipo_produccion = tipo_produccion.id AND produccion.id_linea_investigacion = linea_investigacion.id " +
                "AND produccion.id_proposito = proposito.id AND produccion.id_institucion_avaladora = institucion.id " +
                "AND produccion.numero_registro = profesor_colabora_produccion.id_produccion " +
                "AND profesor.id = profesor_colabora_produccion.id_profesor " +
                "AND profesor.id = " + profesor.getID();
     resultado = conexion.ejecutarComando(consulta);
     if (resultado.HasRows)
     {
         dgvProducciones.Columns[3].DefaultCellStyle.Format = "dd/MM/yyyy";
         while (resultado.Read())
         {
             DataGridViewRow fila = new DataGridViewRow();
             fila.CreateCells(dgvProducciones);
             fila.Cells[0].Value = resultado["numero_registro"].ToString();
             fila.Cells[1].Value = resultado["titulo"].ToString();
             fila.Cells[2].Value = resultado["anio"].ToString();
             fila.Cells[3].Value = resultado["fecha_publicacion"].ToString().Substring(0, 10);
             fila.Cells[4].Value = resultado["tipo_produccion"].ToString();
             fila.Cells[5].Value = resultado["linea_investigacion"].ToString();
             fila.Cells[6].Value = resultado["proposito"].ToString();
             fila.Cells[7].Value = resultado["institucion"].ToString();
             if (resultado["cuenta_curriculum"].ToString() == "1")
             {
                 fila.Cells[8].Value = "Si";
             }
             else
             {
                 fila.Cells[8].Value = "No";
             }
             dgvProducciones.Rows.Add(fila);
         }
     }
 }
 private void Curriculum_Load(object sender, EventArgs e)
 {
     consulta  = "SELECT * FROM produccion LEFT JOIN profesor_colabora_produccion ON(produccion.numero_registro = profesor_colabora_produccion.id_produccion) LEFT JOIN profesor_elabora_produccion ON(produccion.numero_registro = profesor_elabora_produccion.id_produccion) LEFT JOIN profesor ON (profesor.id = profesor_colabora_produccion.id_profesor OR profesor.id = profesor_elabora_produccion.id_profesor) WHERE profesor.id = " + id + " AND produccion.cuenta_curriculum = 1 GROUP BY produccion.titulo";
     resultado = conexion.ejecutarComando(consulta);
     if (resultado.HasRows)
     {
         while (resultado.Read())
         {
             DataGridViewRow fila = new DataGridViewRow();
             fila.CreateCells(dgvCurriculum);
             fila.Cells[0].Value = resultado["numero_registro"].ToString();
             fila.Cells[1].Value = resultado["titulo"].ToString();
             fila.Cells[2].Value = resultado["anio"].ToString();
             fila.Cells[3].Value = resultado["fecha_publicacion"].ToString();
             dgvCurriculum.Rows.Add(fila);
         }
     }
     else
     {
         MessageBox.Show("No se encuentra al profesor o no tiene producciones que cuenten en curriculum", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         this.Close();
     }
 }
 private void cargarDataGridView()
 {
     dgvInstituciones.Rows.Clear();
     consulta = "SELECT * FROM institucion";
     try
     {
         resultado = conexion.ejecutarComando(consulta);
         if (resultado.HasRows)
         {
             while (resultado.Read())
             {
                 DataGridViewRow fila = new DataGridViewRow();
                 fila.CreateCells(dgvInstituciones);
                 fila.Cells[0].Value = resultado["id"].ToString();
                 fila.Cells[1].Value = resultado["nombre"].ToString();
                 dgvInstituciones.Rows.Add(fila);
             }
         }
     }
     catch (OdbcException ex)
     {
     }
 }
        private void cargarDataGridViewPropositos()
        {
            dgvPropositos.Rows.Clear();
            consulta = "SELECT * FROM proposito";
            try
            {
                resultado = conexion.ejecutarComando(consulta);

                if (resultado.HasRows)
                {
                    while (resultado.Read())
                    {
                        DataGridViewRow fila = new DataGridViewRow();
                        fila.CreateCells(dgvPropositos);
                        fila.Cells[0].Value = resultado["id"].ToString();
                        fila.Cells[1].Value = resultado["descripcion"].ToString();
                        dgvPropositos.Rows.Add(fila);
                    }
                }
            }
            catch (OdbcException)
            {
            }
        }
 public void cargarTiposProduccion()
 {
     consulta = "SELECT * FROM tipo_produccion";
     cargarComboBox(conexion.ejecutarComando(consulta), cmbTipoProduccion, "descripcion");
 }
        private void cargarTabProfesores()
        {
            consulta = "SELECT * FROM tipo_usuario";
            cargarComboBox(conexion.ejecutarComando(consulta), cmbTipoUsuario);

            consulta = "SELECT * FROM division";
            cargarComboBox(conexion.ejecutarComando(consulta), cmbDivision);

            consulta = "SELECT * FROM grado";
            cargarComboBox(conexion.ejecutarComando(consulta), cmbGrados);

            cargarDataGridViewProfesores();
        }