private void btnAdicionar_Click(object sender, EventArgs e)
        {
            if (ComboTipoPagamento.Text.Trim() == "")
            {
                MessageBox.Show("Informe uma forma de Pagamento valida!", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ComboTipoPagamento.Focus();
                return;
            }

            if (Convert.ToDecimal(edtValor.Text) <= 0)
            {
                MessageBox.Show("Informe um Valor valido!", "Informação do Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information);
                edtValor.Focus();
                return;
            }

            try
            {
                EcfFechamentoDTO Fechamento = new EcfFechamentoDTO();
                Fechamento.IdEcfMovimento = Sessao.Instance.Movimento.Id;
                Fechamento.TipoPagamento  = ComboTipoPagamento.Text;
                Fechamento.Valor          = Convert.ToDecimal(edtValor.Text);

                EcfFechamentoController.GravaEcfFechamento(Fechamento);

                TotalizaFechamento();
            }
            catch (Exception eError)
            {
                Log.write(eError.ToString());
            }
            edtValor.Clear();
            ComboTipoPagamento.Focus();
        }
 private void btnRemover_Click(object sender, EventArgs e)
 {
     if (DTFechamento.Rows.Count > 0)
     {
         DataRow          Registro = DTFechamento.Rows[GridValores.CurrentRow.Index];
         EcfFechamentoDTO EcfFechamentoParaExclusao = new EcfFechamentoDTO();
         EcfFechamentoParaExclusao.Id = Convert.ToInt32(Registro["ID"]);
         EcfFechamentoController.ExcluiEcfFechamento(EcfFechamentoParaExclusao);
         TotalizaFechamento();
     }
     ComboTipoPagamento.Focus();
 }
        public void TotalizaFechamento()
        {
            string Filtro = "IdEcfMovimento = " + Sessao.Instance.Movimento.Id;
            IList <EcfFechamentoDTO> ListaFechamento = EcfFechamentoController.ConsultaEcfFechamentoLista(Filtro);

            if (ListaFechamento != null)
            {
                if (ListaFechamento.Count > 0)
                {
                    GridValores.DataSource = EcfFechamentoController.ConsultaEcfFechamentoLista(Filtro);
                }
            }

            decimal Total = 0;

            foreach (DataRow Registro in DTFechamento.Rows)
            {
                Total = Total + Convert.ToDecimal(Registro["VALOR"]);
            }
            edtTotal.Text = Total.ToString("0.00");
        }