Exemplo n.º 1
0
        private void BtnListar_Click(object sender, EventArgs e)
        {
            dgCargos.ColumnCount           = 2;
            dgCargos.Columns[0].HeaderText = "Codigo";
            dgCargos.Columns[1].HeaderText = "Descripcion";
            dgCargos.Rows.Clear();
            ClsNCargo objN = new ClsNCargo();

            cargos = objN.MtdListarCargo();
            foreach (DataRow fila in cargos.Rows)
            {
                dgCargos.Rows.Add(fila[0].ToString(), fila[1].ToString());
            }
        }
Exemplo n.º 2
0
        private void BtnGuardar_Click(object sender, EventArgs e)
        {
            bool      existir;
            ClsECargo objE = new ClsECargo();

            objE.Codigo      = int.Parse(txtCodigo.Text);
            objE.Descripcion = txtDescripcion.Text.ToUpper();
            ClsNCargo objN = new ClsNCargo();

            existir = objN.MtdAgregarCargo(objE);
            if (existir == true)
            {
                MessageBox.Show("Guardado exitosamente");
            }
            else
            {
                MessageBox.Show("Error, intente nuevamente");
            }
            btnNuevo.PerformClick();
            btnListar.PerformClick();
        }