private void dgList_DoubleClick(object sender, EventArgs e)
        {
            PaymentForm paymentFormVO = new PaymentForm();

            paymentFormVO.Id       = int.Parse(dgList.CurrentRow.Cells["clId"].Value.ToString());
            paymentFormVO          = PaymentFormDAO.GetByID(paymentFormVO);
            txtName.Text           = paymentFormVO.Name;
            cmbType.SelectedIndex  = paymentFormVO.Type;
            txtInitialBalance.Text = paymentFormVO.InitialBalance.ToString();
            txtId.Text             = paymentFormVO.Id.ToString();

            btnExcluir.Enabled = true;
        }
 private void btnExcluir_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Deseja mesmo este registro?", "Forma de Pagamento", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         PaymentForm paymentFormVO = new PaymentForm();
         paymentFormVO.Id = int.Parse(txtId.Text);
         paymentFormVO    = PaymentFormDAO.GetByID(paymentFormVO);
         if (!PaymentFormDAO.UpdateDisable(paymentFormVO))
         {
             MessageBox.Show("Erro: Ocorreu um erro inesperado excluir.");
         }
         else
         {
             MessageBox.Show("Excluído com sucesso.");
             this.ClearFields();
             this.showGrid();
         }
     }
 }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            PaymentForm paymentFormVO = new PaymentForm();
            int         Id;

            if (int.TryParse(txtId.Text, out Id))
            {
                paymentFormVO.Id = Id;
                paymentFormVO    = PaymentFormDAO.GetByID(paymentFormVO);
            }
            if (this.validateForm(paymentFormVO))
            {
                if (paymentFormVO.Id > 0)
                {
                    if (PaymentFormDAO.Update(paymentFormVO))
                    {
                        MessageBox.Show("Alterado com sucesso.");
                        this.ClearFields();
                        this.showGrid();
                        return;
                    }
                    MessageBox.Show("Erro: Ocorreu um erro inesperado alterar.");
                }
                else
                {
                    if (PaymentFormDAO.Insert(paymentFormVO))
                    {
                        MessageBox.Show("Cadastrado com sucesso.");
                        this.ClearFields();
                        this.showGrid();
                        return;
                    }
                    MessageBox.Show("Erro: Ocorreu um erro inesperado cadastrar.");
                }
            }
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            Finance finance = new Finance();
            int     Id;

            if (int.TryParse(txtId.Text, out Id))
            {
                finance.Id = Id;
                finance    = FinanceDAO.GetByID(finance);
            }
            FinanceCategorySub financeCategorySub = new FinanceCategorySub();

            financeCategorySub         = (FinanceCategorySub)cmbCategorySub.SelectedItem;
            financeCategorySub         = FinanceCategorySubDAO.GetByID(financeCategorySub);
            finance.FinanceCategorySub = financeCategorySub;

            PaymentForm paymentForm = new PaymentForm();

            paymentForm         = (PaymentForm)cmbPaymentForm.SelectedItem;
            paymentForm         = PaymentFormDAO.GetByID(paymentForm);
            finance.PaymentForm = paymentForm;

            finance.Date = dtDateTime.Value;
            if (rbSituationPago.Checked)
            {
                finance.Situation = FinanceU.SITUATION_PAGO;
                finance.DateClose = finance.Date;
            }
            else
            {
                finance.Situation = FinanceU.SITUATION_PENDENTE;
                finance.DateClose = DateTime.Now;
            }
            finance.Text = txtText.Text;

            if (this.validateForm(finance))
            {
                if (finance.Id > 0)
                {
                    if (FinanceDAO.Update(finance))
                    {
                        MessageBox.Show("Alterado com sucesso.");
                        this.ClearFields();
                        this.showGrid();
                        return;
                    }
                    MessageBox.Show("Erro: Ocorreu um erro inesperado alterar.");
                }
                else
                {
                    if (FinanceDAO.Insert(finance))
                    {
                        MessageBox.Show("Cadastrado com sucesso.");
                        this.ClearFields();
                        this.showGrid();
                        return;
                    }
                    MessageBox.Show("Erro: Ocorreu um erro inesperado cadastrar.");
                }
            }
        }