void PopularCombos() { try { List <ComboItemDTO> Lista_Status = new List <ComboItemDTO>(); Lista_Status.Add(new ComboItemDTO() { Text = "Pendente", Value = "Pendente" }); Lista_Status.Add(new ComboItemDTO() { Text = "Atrasado", Value = "Atrasado" }); Lista_Status.Add(new ComboItemDTO() { Text = "Pago", Value = "Pago" }); cboStatusPagamento.ValueMember = "value"; cboStatusPagamento.DisplayMember = "text"; cboStatusPagamento.DataSource = Lista_Status; cboStatusPagamento.SelectedIndex = 0; //Forma pagamento List <FORMA_PAGAMENTO_DTO> Lista_FormaPagamento = new FORMA_PAGAMENTO_BLL().Lista_Forma_Pagamento(); cboForma_Pagamento.ValueMember = "ID"; cboForma_Pagamento.DisplayMember = "DESCRICAO"; cboForma_Pagamento.DataSource = Lista_FormaPagamento; cboForma_Pagamento.SelectedIndex = -1; //Forma pagamento juros List <FORMA_PAGAMENTO_DTO> NewLista_FormaPagamento = new List <FORMA_PAGAMENTO_DTO>(); NewLista_FormaPagamento.AddRange(Lista_FormaPagamento); NewLista_FormaPagamento.Insert(0, new FORMA_PAGAMENTO_DTO() { DESCRICAO = "Nenhum", ID = null }); cboFormaPagamentoJuros.ValueMember = "ID"; cboFormaPagamentoJuros.DisplayMember = "DESCRICAO"; cboFormaPagamentoJuros.DataSource = NewLista_FormaPagamento; cboForma_Pagamento.SelectedIndex = -1; } catch (Exception ex) { throw ex; } }
private void BtnExcluir_Click(object sender, EventArgs e) { try { int id = Convert.ToInt32(dtgDados.CurrentRow.Cells["ID"].Value.ToString()); bool result = new FORMA_PAGAMENTO_BLL().Excluir(id); if (result) { MessageBox.Show("Registro " + id + " excluído com sucesso!"); PopularGrid(); } else { MessageBox.Show("Não foi possível excluir este registro!"); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Nao foi possível excluir este registro.", MessageBoxButtons.OK, MessageBoxIcon.Error); } }