Exemplo n.º 1
0
        private void BtnIngresar_Click(object sender, EventArgs e)
        {
            //Administrador
            //ID : 76514314
            //CONTRA: 123456

            //Cargo 2
            //ID: : 45871231
            //CONTRA: 211030

            //bool ingresar = false;

            if (txtDNI.Text.Equals(""))      //para el usuario
            {
                MessageBox.Show("Ingrese Codigo");
                return;
            }

            if (txtClave.Text.Equals(""))        //para la clave
            {
                MessageBox.Show("Ingrese Clave");
                return;
            }
            Cls_N_Ingreso objN = new Cls_N_Ingreso();
            Cls_E_Ingreso objE = new Cls_E_Ingreso();

            objE.Dni   = txtDNI.Text;
            objE.Clave = txtClave.Text;
            empleado   = objN.MtdListarEmpleado(objE);
            if (empleado.Rows.Count == 0)
            {
                MessageBox.Show("ERROR");
                MTdLimpiar();
            }
            else if (empleado.Rows[0][4].ToString() is "0")
            {
                MessageBox.Show("Usuario inhabilitado");
                MTdLimpiar();
            }
            else
            {
                MessageBox.Show("Bienvenido " + empleado.Rows[0][1].ToString());
                Form_Panel f = new Form_Panel();
                this.Hide();
                f.ShowDialog();


                this.Show();
                MTdLimpiar();
            }
        }
Exemplo n.º 2
0
        public DataTable MtdListarEmpleado(Cls_E_Ingreso objE)
        {
            DataTable      empleado    = new DataTable();
            ClsConexionSQL objConexion = new ClsConexionSQL();
            SqlCommand     objComando  = new SqlCommand();
            SqlDataAdapter adapter     = new SqlDataAdapter();

            objComando.Connection  = objConexion.conectar();
            objComando.CommandText = "USP_S_VALIDARLOGIN";
            objComando.CommandType = CommandType.StoredProcedure;
            objComando.Parameters.Add(new SqlParameter("documento", SqlDbType.VarChar));
            objComando.Parameters.Add(new SqlParameter("cla", SqlDbType.VarChar));
            objComando.Parameters["documento"].Value = objE.Dni;
            objComando.Parameters["cla"].Value       = objE.Clave;
            objComando.Connection = objConexion.conectar();
            objComando.ExecuteNonQuery();
            adapter.SelectCommand = objComando;
            adapter.Fill(empleado);
            foreach (DataRow fila in empleado.Rows)
            {
                acceso = fila[5].ToString();
            }
            return(empleado);
        }