Пример #1
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            try
            {
                Banco banco = (Banco)bancoBindingSource.Current;

                if (estado.Equals(EstadoFormulario.INSERIR))
                {
                    int codBanco = (int)GerenciadorBanco.GetInstace().inserir(banco);
                    codBancoTextBox.Text = codBanco.ToString();
                }
                else
                {
                    GerenciadorBanco.GetInstace().atualizar(banco);
                }
                bancoBindingSource.EndEdit();
            }
            catch (DadosException de)
            {
                bancoBindingSource.CancelEdit();
                throw de;
            }
            finally
            {
                bancoBindingSource.ResumeBinding();
                habilitaBotoes(true);
                btnBuscar.Focus();
            }
        }
Пример #2
0
 private void FrmContaBanco_Load(object sender, EventArgs e)
 {
     GerenciadorSeguranca.getInstance().verificaPermissao(this, Global.CONTAS_BANCO_CAIXA, Principal.Autenticacao.CodUsuario);
     bancoBindingSource.DataSource      = GerenciadorBanco.GetInstace().ObterTodos();
     contaBancoBindingSource.DataSource = GerenciadorContaBanco.GetInstance().ObterTodos();
     habilitaBotoes(true);
 }
Пример #3
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Confirma exclusão?", "Confirmar Exclusão", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         GerenciadorBanco.GetInstace().remover(int.Parse(codBancoTextBox.Text));
         bancoBindingSource.RemoveCurrent();
     }
     btnBuscar.Focus();
 }
 private void txtTexto_TextChanged(object sender, EventArgs e)
 {
     if ((cmbBusca.SelectedIndex == 1) && !txtTexto.Text.Equals(""))
     {
         bancoBindingSource.DataSource = GerenciadorBanco.GetInstace().Obter(int.Parse(txtTexto.Text));
     }
     else
     {
         bancoBindingSource.DataSource = GerenciadorBanco.GetInstace().ObterPorNome(txtTexto.Text);
     }
 }
 private void FrmBancoPesquisa_Load(object sender, EventArgs e)
 {
     bancoBindingSource.DataSource = GerenciadorBanco.GetInstace().ObterTodos();
     cmbBusca.SelectedIndex        = 0;
 }