Esempio n. 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (btnCancel.Enabled == true)
            {
                modelo.professor     p   = (modelo.professor)bs.Current;
                controle.ProfessorDB pDb = new controle.ProfessorDB();
                pDb.inserir(p);
                MessageBox.Show("Registro adicionado", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);
                bs.MoveLast();
            }
            else
            {
                modelo.professor     p   = (modelo.professor)bs.Current;
                controle.ProfessorDB pDb = new controle.ProfessorDB();
                pDb.editar(p);
                MessageBox.Show("Registro editado", "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            btnAdd.Enabled = true;

            if (bs.Count != 0)
            {
                btnCancel.Enabled = true;
            }
            btnCancel.Enabled = false;
            btnSave.Enabled   = true;
        }
Esempio n. 2
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            if (bs.Count == 0)
            {
                MessageBox.Show("Cadastro Vazio", "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            controle.ProfessorDB lDb = new controle.ProfessorDB();
            int id = Convert.ToInt16(lbCod.Text);

            if (MessageBox.Show("Remover " + txtNome.Text,
                                "Sistema", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                lDb.excluir(id);
                bs.RemoveCurrent();
                bs.MoveFirst();

                if (bs.Count != 0)
                {
                    bs.MoveFirst();
                }
                else
                {
                    habilitarCampos(false);
                    btnDel.Enabled    = false;
                    btnSave.Enabled   = false;
                    btnCancel.Enabled = false;
                }
            }
        }
Esempio n. 3
0
        private void FormProfessor_Load(object sender, EventArgs e)
        {
            this.Cursor = Cursors.WaitCursor;

            controle.ProfessorDB pDB = new controle.ProfessorDB();
            pDB.carregarTabela(bs);

            controle.cursoBD cDB = new controle.cursoBD();
            cDB.listar(cbCurso);

            if (bs.Count != 0)
            {
                bs.MoveFirst();
                habilitarCampos(true);
                btnCancel.Enabled = false;
            }
            else
            {
                btnDel.Enabled    = false;
                btnCancel.Enabled = false;
                btnSave.Enabled   = false;

                habilitarCampos(false);
            }
            vincularCampos();
            this.Cursor = Cursors.Default;
        }
Esempio n. 4
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            habilitarCampos(true);

            btnDel.Enabled    = false;
            btnAdd.Enabled    = false;
            btnSave.Enabled   = true;
            btnCancel.Enabled = true;

            bs.AddNew();

            controle.ProfessorDB pDB = new controle.ProfessorDB();

            lbCod.Focus();
            lbCod.Text = pDB.proximoCodigo().ToString();

            cbCurso.Focus();
            cbCurso.SelectedIndex = 0;

            txtNome.Focus();
        }
Esempio n. 5
0
 private void txtNome_TextChanged(object sender, EventArgs e)
 {
     controle.ProfessorDB aDB = new controle.ProfessorDB();
     aDB.filtrar(dg, txtNome.Text);
 }