Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int      ID     = Convert.ToInt32(txtID.Text);
            Empleado existe = BD.Empleado.FirstOrDefault(em => em.IDempleado == ID && em.Contraseña == txtPass.Text);

            if (existe != null)
            {
                MessageBox.Show("Bienvenido  " + existe.Nombre_Empleado);

                /*  string Rol = cmbRol.Text.Trim();
                 * if (Rol == "Administrador")
                 * {*/

                Menu_Principal Mp = new Menu_Principal();
                Mp.ShowDialog();
            }    /*
                  * if (Rol == "Alumno")
                  * {
                  * Menu_alumnos Mp = new Menu_alumnos(BaseDatos);
                  * limpiar();
                  * Mp.Show();
                  * this.Hide();
                  * }
                  *
                  * }
                  * else
                  * MessageBox.Show("No se encontro registrese por favor");
                  */
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                int    cod        = Convert.ToInt32(txtID.Text.Trim());
                string pass       = txtPass.Text.Trim();
                bool   encontrado = false;

                encontrado = BDbase.Validar(cod, pass);
                if (encontrado)
                {
                    MessageBox.Show("Credenciales Correctas : bienvenido");
                    Menu_Principal Mn = new Menu_Principal();
                    Mn.WindowState = FormWindowState.Maximized; //Maximiza la ventada
                    Mn.Show();                                  // muestra ambas ventanas
                    this.Hide();
                    //Mn.ShowDialog();//muetra solo una ventana y la otra trabaja
                }
                else
                {
                    MessageBox.Show("Credenciales Incorrectas");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }