예제 #1
0
        private void gridContas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                Conta itemSelecionado = (Conta)gridContas.Rows[e.RowIndex].DataBoundItem;

                if (gridContas.Columns[e.ColumnIndex].Name == "btnEditar") //Editar
                {
                    FrmManutencaoConta frm = new FrmManutencaoConta(itemSelecionado.Id);
                    frm.ShowDialog();

                    AtualizarGrid();
                }

                if (gridContas.Columns[e.ColumnIndex].Name == "btnApagar") //Apagar
                {
                    DialogResult resut = MessageBox.Show("Deseja apagar o item?", "Remover", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                    if (resut == DialogResult.Yes)
                    {
                        ContaRepository.Apagar(itemSelecionado.Id);

                        AtualizarGrid();
                    }
                }
            }
        }
예제 #2
0
        private void btnNovo_Click(object sender, EventArgs e)
        {
            FrmManutencaoConta frm = new FrmManutencaoConta(0);

            frm.ShowDialog();
        }
예제 #3
0
        private void MenuNovaConta_Click(object sender, EventArgs e)
        {
            FrmManutencaoConta frm = new FrmManutencaoConta(0);

            AbrirForm(frm);
        }