private void frmAgregarAulas_Load(object sender, EventArgs e)
        {
            jefe            = ManejaUsuario.GetJefe(Usuario);
            txtUsuario.Text = jefe.Usuario;
            List <String> lista = manejadoraAulas.ObtenerAulasDisponibles();

            if (lista.Count == 0)
            {
                MessageBox.Show("NO HAY AULAS DISPONIBLES", "ERROR AL ASIGNAR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                return;
            }
            foreach (var item in lista)
            {
                cmbAulas.Items.Add(item);
            }
            cmbAulas.SelectedIndex = 0;
        }
Esempio n. 2
0
        private void frmUpdateJefe_Load(object sender, EventArgs e)
        {
            jefe            = ManejaUsuario.GetJefe(Usuario);
            txtUsuario.Text = jefe.Usuario;
            List <String> departamentos = ManejaDepartamento.ObtenerDepartamentoJefe();

            cmbDepartamento.Items.Clear();
            txtUsuario.Enabled = false;

            foreach (var dep in departamentos)
            {
                cmbDepartamento.Items.Add(dep);
                if (dep == jefe.Departamento)
                {
                    cmbDepartamento.SelectedItem = dep;
                }
            }
        }
Esempio n. 3
0
        public static Jefe GetJefe(String nombre)
        {
            Jefe          jefe       = null;
            SqlConnection connection = UsoBD.ConectaBD(Utileria.GetConnectionString());

            if (connection == null)
            {
                foreach (SqlError item in UsoBD.ESalida.Errors)
                {
                    MessageBox.Show(item.Message);
                }
                return(jefe);
            }

            SqlDataReader lector     = null;
            String        comando    = "SELECT USUARIO, PASSWORD, D.NOMBRE FROM JEFE_DEPARTAMENTO J INNER JOIN DEPARTAMENTO D ON J.DEPARTAMENTO = D.ID  WHERE J.USUARIO = '" + nombre + "'";
            SqlCommand    sqlCommand = new SqlCommand(comando, connection);

            try
            {
                lector = sqlCommand.ExecuteReader();
            }
            catch (SqlException ex)
            {
                foreach (SqlError item in ex.Errors)
                {
                    MessageBox.Show(item.Message.ToString());
                }
                connection.Close();
                return(jefe);
            }
            if (lector.Read())
            {
                String usuario      = lector.GetValue(0).ToString();
                String password     = lector.GetValue(1).ToString();
                String departamento = lector.GetValue(2).ToString();
                jefe = new Jefe(usuario, password, departamento);
            }
            connection.Close();
            return(jefe);
        }