Пример #1
0
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.dgvPrincipal.SelectedRows.Count > 0)
         {
             using (var frmSubcategoriaLancamento = new SubcategoriaLancamentoPrincipalForm(new SubcategoriaLancamentoModel
             {
                 IdSubcategoria = Convert.ToInt32(this.dgvPrincipal.CurrentRow.Cells["clIdSubcategoria"].Value),
                 NomeSubcategoria = this.dgvPrincipal.CurrentRow.Cells["clNomeSubcategoria"].Value.ToString(),
                 CategoriaLancamento = new CategoriaLancamentoModel
                 {
                     IdCategoria = Convert.ToInt32(this.dgvPrincipal.CurrentRow.Cells["clIdCategoria"].Value),
                     NomeCategoria = this.dgvPrincipal.CurrentRow.Cells["clNomeCategoria"].Value.ToString()
                 }
             }))
             {
                 frmSubcategoriaLancamento.ShowDialog();
                 this.CarregarDatagrid();
             }
         }
     }
     catch (Exception exception)
     {
         Mensagens.MensagemErro(exception.Message);
     }
 }
Пример #2
0
 private void btnNovoLancamento_Click(object sender, EventArgs e)
 {
     try
     {
         using (var frmSubcategoriaLancamento = new SubcategoriaLancamentoPrincipalForm(null))
         {
             frmSubcategoriaLancamento.ShowDialog();
             this.CarregarDatagrid();
         }
     }
     catch (Exception exception)
     {
         Mensagens.MensagemErro(exception.Message);
     }
 }