Пример #1
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            CE_Area objce_area = new CE_Area();
            CN_Area objcn_area = new CN_Area();

            objce_area.nombrearea = txtArea.Text;

            if (objcn_area.VerificarExisteArea(objce_area) == true)
            {

                MessageBox.Show("El area ya existe", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            }
            else
            {

                int filasafectadas = objcn_area.NuevaArea(objce_area);

                if (filasafectadas > 0)
                {
                    MessageBox.Show("La actualizacion se realizo con Exito!!", "Guardado", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("No se pudo actualizar", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }

                this.dgvArea.DataSource = objcn_area.Listar_Areas();

            }
        }
Пример #2
0
        private void cargarelementosbasicos()
        {
            CN_Area objcn_area = new CN_Area();

            cbArea.DataSource = objcn_area.Listar_Areas();
            cbArea.ValueMember = "idarea";
            cbArea.DisplayMember = "nombrearea";

            CN_Cargo objcn_cargo = new CN_Cargo();

            cbCargo.DataSource = objcn_cargo.Listar_Cargos();
            cbCargo.ValueMember = "idcargo";
            cbCargo.DisplayMember = "nombrecargo";
            txtDNI.Select();
            txtDNI.Focus();
        }