Exemplo n.º 1
0
        private void lCerrarSesion_Click(object sender, EventArgs e)
        {
            Autenticacion autenticacion = new Autenticacion();

            autenticacion.Show();
            this.Close();
        }
Exemplo n.º 2
0
        public void EliminarBD(int id)
        {
            Autenticacion.ConectarBD();
            OleDbCommand eliminar = new OleDbCommand();

            eliminar.Connection  = Autenticacion.con;
            eliminar.CommandText = @"DELETE FROM PERSONAL WHERE ID = " + id;
            eliminar.ExecuteNonQuery();
            Autenticacion.con.Close();
        }
Exemplo n.º 3
0
        public static void Registrar(int idG, string id, string apPaterno, string apMaterno, string nombre, string cargo, string area)
        {
            Autenticacion.ConectarBD();
            OleDbCommand guardar = new OleDbCommand();

            guardar.Connection  = Autenticacion.con;
            guardar.CommandText = @"INSERT INTO PERSONAL VALUES('" + idG + "','" + id + "','" + apPaterno + "','" + apMaterno + "','" + nombre + "','" + cargo + "','" + area + "')";
            guardar.ExecuteNonQuery();
            Autenticacion.con.Close();
        }
Exemplo n.º 4
0
        public void MostrarEmpleado(string id)
        {
            Autenticacion.ConectarBD();
            OleDbCommand coman = new OleDbCommand();

            coman.Connection = Autenticacion.con;
            string query = "SELECT ID_EMPLEADO,APELLIDO_PATERNO,APELLIDO_MATERNO,NOMBRE, CARGO, AREA FROM PERSONAL WHERE ID_EMPLEADO ='" + id + "'";

            coman.CommandText = query;
            OleDbDataAdapter da = new OleDbDataAdapter(coman);
            DataTable        dt = new DataTable();

            da.Fill(dt);
            dgvEliminar.DataSource = dt;
        }
Exemplo n.º 5
0
        public void consultarArea(string area)
        {
            Autenticacion.ConectarBD();
            OleDbCommand coman = new OleDbCommand();

            coman.Connection = Autenticacion.con;
            string query = "SELECT NUMERO_INVENTARIO,NUMERO_SERIE,MARCA,TIPO,ESTADO,EMPLEADO,AREA,OBSERVACIONES,FECHA,HORA FROM ARTICULO WHERE AREA = '" + area + "'";

            coman.CommandText = query;
            OleDbDataAdapter da = new OleDbDataAdapter(coman);
            DataTable        dt = new DataTable();

            da.Fill(dt);
            dgvAreas.DataSource = dt;
            Autenticacion.con.Close();
        }
Exemplo n.º 6
0
        public void MostrarArticulos()
        {
            Autenticacion.ConectarBD();
            OleDbCommand coman = new OleDbCommand();

            coman.Connection = Autenticacion.con;
            string query = "SELECT ARTICULO.NUMERO_INVENTARIO,ARTICULO.NUMERO_SERIE,ARTICULO.MARCA,ARTICULO.TIPO,ARTICULO.ESTADO,PERSONAL.APELLIDO_PATERNO,PERSONAL.APELLIDO_MATERNO,PERSONAL.NOMBRE,ARTICULO.AREA,ARTICULO.OBSERVACIONES,ARTICULO.FECHA,ARTICULO.HORA FROM ARTICULO, PERSONAL WHERE ARTICULO.EMPLEADO = PERSONAL.ID_EMPLEADO";

            coman.CommandText = query;
            OleDbDataAdapter da = new OleDbDataAdapter(coman);
            DataTable        dt = new DataTable();

            da.Fill(dt);
            dgvArticulos.DataSource = dt;
            dgvFechas.DataSource    = dt;
            dgvAreas.DataSource     = dt;
        }
Exemplo n.º 7
0
        private void Personal_Load(object sender, EventArgs e)
        {
            //Mostrar los cargos en el cbCargo
            Autenticacion.ConectarBD();
            datosCargo = new DataSet();
            OleDbDataAdapter adpCargo = new OleDbDataAdapter("SELECT * FROM CARGO", Autenticacion.con);

            adpCargo.Fill(datosCargo, "Cargo");
            cbCargo.DataSource     = datosCargo.Tables[0].DefaultView;
            cbCargo.Text           = null;
            cbCargo.ValueMember    = "ID_Cargo";
            cbCargo.DisplayMember  = "CARGO";
            cbNCargo.DataSource    = datosCargo.Tables[0].DefaultView;
            cbNCargo.Text          = null;
            cbNCargo.ValueMember   = "ID_Cargo";
            cbNCargo.DisplayMember = "CARGO";
            //Mostrar las áreas en el cbArea
            datosArea = new DataSet();
            OleDbDataAdapter Adaptador = new OleDbDataAdapter("SELECT * FROM AREA", Autenticacion.con);

            Adaptador.Fill(datosArea, "Area");
            cbArea.DataSource     = datosArea.Tables[0].DefaultView;
            cbArea.Text           = null;
            cbArea.ValueMember    = "ID_Area";
            cbArea.DisplayMember  = "AREA";
            cbNArea.DataSource    = datosArea.Tables[0].DefaultView;
            cbNArea.Text          = null;
            cbNArea.ValueMember   = "ID_Area";
            cbNArea.DisplayMember = "AREA";
            Autenticacion.con.Close();
            //Mostrar los datos de la tabla EMPLEADOS en el dgvEmpleados
            MostrarEmpleados();
            //Bloquear los TextBox para Actualizar
            cbMApePaterno.Enabled = false;
            cbMApeMaterno.Enabled = false;
            cbMNombre.Enabled     = false;
            cbMCargo.Enabled      = false;
            cbMArea.Enabled       = false;
            tbNApePaterno.Enabled = false;
            tbNApeMaterno.Enabled = false;
            tbNNombre.Enabled     = false;
            cbNCargo.Enabled      = false;
            cbNArea.Enabled       = false;
            btnActualizar.Enabled = false;
        }
Exemplo n.º 8
0
        public static int GenerarID()
        {
            Autenticacion.ConectarBD();
            int          ultimo = 0;
            OleDbCommand buscaU = new OleDbCommand();

            buscaU.Connection  = Autenticacion.con;
            buscaU.CommandText = @"SELECT ID FROM PERSONAL";
            OleDbDataReader reader = buscaU.ExecuteReader();

            while (reader.Read())
            {
                string algo = reader.GetValue(0).ToString();
                ultimo = Convert.ToInt16(algo);
            }
            ultimo += 1;
            Autenticacion.con.Close();
            return(ultimo);
        }
Exemplo n.º 9
0
        public void BuscarBD(string id)
        {
            Autenticacion.ConectarBD();
            OleDbCommand busqueda = new OleDbCommand();

            busqueda.Connection  = Autenticacion.con;
            busqueda.CommandText = @"SELECT * FROM PERSONAL";
            OleDbDataReader reader = busqueda.ExecuteReader();

            while (reader.Read())
            {
                if (id == reader.GetValue(1).ToString())
                {
                    lID.Text           = reader.GetValue(0).ToString();
                    LIDEliminar.Text   = reader.GetValue(0).ToString();
                    tbNApePaterno.Text = reader.GetValue(2).ToString();
                    tbNApeMaterno.Text = reader.GetValue(3).ToString();
                    tbNNombre.Text     = reader.GetValue(4).ToString();
                    cbNCargo.Text      = reader.GetValue(5).ToString();
                    cbNArea.Text       = reader.GetValue(6).ToString();
                }
            }
            MostrarEmpleado(tbBNumEmpleado.Text);
        }