コード例 #1
0
        private void btn_ingresar_Click_1(object sender, EventArgs e)
        {
            if (this.txt_usuario.Text == "")
            {
                MessageBox.Show("No está cargado el usuario", "IMPORTANTE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txt_usuario.Focus();
                return;
            }
            if (this.txt_contraseña.Text == "")
            {
                MessageBox.Show("No está cargada la contraseña", "IMPORTANTE", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                txt_contraseña.Focus();
                return;
            }
            Ng_Empleados Usuario = new Ng_Empleados();

            if (Usuario.Validar_usuario(txt_usuario.Text, txt_contraseña.Text) == Ng_Empleados.Respuesta.validacion_correcta)
            {
                this.Usuario = txt_usuario.Text;
                this.Close();
            }
            else
            {
                MessageBox.Show("Este usuario y password " +
                                "no está registrado en la base de datos"
                                , "Importante", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
        }
コード例 #2
0
        private void Frm_Escritorio_Load(object sender, EventArgs e)
        {
            Frm_Login login = new Frm_Login();

            login.ShowDialog();
            if (login.Usuario == "" || login.Password == "")
            {
                MessageBox.Show("Acceso bloqueado"
                                , "Importante"
                                , MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close();
            }
            else
            {
                Ng_Empleados Usuario = new Ng_Empleados();
                id_empleado = Usuario.Recuperar_id(login.Usuario, login.Password);
                if (id_empleado == 0)
                {
                    MessageBox.Show("Acceso bloqueado, usuario y password incorrecto"
                                    , "Importante"
                                    , MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    this.Close();
                }
                else
                {
                    nombre_usuario = login.Usuario;
                    password       = login.Password;
                    MessageBox.Show("Bienvenido! " + nombre_usuario);
                }
            }
            login.Dispose();
        }
コード例 #3
0
        public void Cargar()
        {
            Ng_Empleados Empleado    = new Ng_Empleados();
            Ng_Barrios   Barrio      = new Ng_Barrios();
            DataTable    tablaBarrio = new DataTable();
            DataTable    tabla       = new DataTable();

            tabla       = Empleado.Buscar_Empleados_Usuario(usuario);
            tablaBarrio = Barrio.Buscar_Barrio_Codigo(tabla.Rows[0]["codBarrio"].ToString());

            for (int i = 0; i < tabla.Rows.Count; i++)
            {
                string tDoc = tabla.Rows[0]["tipoDoc"].ToString();
                if (tDoc == "1")
                {
                    txt_tipodoc.Text = "DNI";
                }
                txt_numdoc.Text    = tabla.Rows[0]["numDoc"].ToString();
                txt_nombre.Text    = tabla.Rows[0]["nombre"].ToString();
                txt_apellido.Text  = tabla.Rows[0]["apellido"].ToString();
                txt_direccion.Text = tabla.Rows[0]["direccion"].ToString();
                txt_barrio.Text    = tablaBarrio.Rows[0]["nombre"].ToString();
                txt_telefono.Text  = tabla.Rows[0]["telefono"].ToString();
                string jefe = tabla.Rows[0]["numDocJefe"].ToString();

                if (jefe == "")
                {
                    textRango.Text = "Jefe";
                }
                else
                {
                    textRango.Text = "Subordinado";
                }

                if (textRango.Text == "Subordinado")
                {
                    groupJefe.Visible = true;
                    DataTable tabla2 = new DataTable();
                    tabla2 = Empleado.Buscar_Empleados(tabla.Rows[0]["numDocJefe"].ToString());
                    txt_NumDocJefe.Text   = tabla.Rows[0]["numDocJefe"].ToString();
                    txt_nombreJefe.Text   = tabla2.Rows[0]["nombre"].ToString();
                    txt_apellidoJefe.Text = tabla2.Rows[0]["apellido"].ToString();
                }
            }
        }