public void AtualizarBoletoGerado(IBoletosGerados boletoGerado) { var sql = new StringBuilder(); var dbHelper = ServerUtils.getDBHelper(); sql.Append("UPDATE FN_BOLETOS_GERADOS SET "); sql.Append(!String.IsNullOrEmpty(boletoGerado.NumeroBoleto) ? String.Concat("NUMEROBOLETO = '", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.NumeroBoleto), "', ") : "NUMEROBOLETO = NULL, "); //sql.Append(String.Concat("IDCLIENTE = ", boletoGerado.Cliente.Pessoa.ID.Value, ", ")); sql.Append(String.Concat("VALOR = ", UtilidadesDePersistencia.TPVd(boletoGerado.Valor), ", ")); sql.Append(boletoGerado.DataGeracao.HasValue ? String.Concat("DATAGERACAO = ", boletoGerado.DataGeracao.Value.ToString("yyyyMMdd"), ", ") : "DATAGERACAO = NULL, "); sql.Append(boletoGerado.DataVencimento.HasValue ? String.Concat("DATAVENCIMENTO = ", boletoGerado.DataGeracao.Value.ToString("yyyyMMdd"), ", ") : "DATAVENCIMENTO = NULL, "); sql.Append(!String.IsNullOrEmpty(boletoGerado.Observacao) ? String.Concat("OBSERVACAO = '", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.Observacao), "', ") : "OBSERVACAO = NULL, "); //sql.Append(String.Concat("IDCEDENTE = ", boletoGerado.Cedente.Pessoa.ID.Value, ", ")); sql.Append(!String.IsNullOrEmpty(boletoGerado.Instrucoes) ? String.Concat("INSTRUCOES = '", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.Instrucoes), "' ") : "INSTRUCOES = NULL "); //sql.Append(!String.IsNullOrEmpty(boletoGerado.Instrucoes) // ? String.Concat("STATUSBOLETO = '", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.StatusBoleto), "' ") // : "STATUSBOLETO = 'Aberto' "); sql.Append(" WHERE ID = " + boletoGerado.ID.Value); dbHelper.ExecuteNonQuery(sql.ToString()); }
public void AtualizarBoletoGerado(IBoletosGerados boletoGerado) { ServerUtils.setCredencial(_Credencial); var mapeador = FabricaGenerica.GetInstancia().CrieObjeto<IMapeadorDeBoleto>(); try { ServerUtils.BeginTransaction(); mapeador.AtualizarBoletoGerado(boletoGerado); ServerUtils.CommitTransaction(); } catch { ServerUtils.RollbackTransaction(); throw; } finally { ServerUtils.libereRecursos(); } }
public void Inserir(IBoletosGerados boletoGerado) { var sql = new StringBuilder(); IDBHelper DBHelper; DBHelper = ServerUtils.getDBHelper(); boletoGerado.ID = GeradorDeID.getInstancia().getProximoID(); sql.Append("INSERT INTO FN_BOLETOS_GERADOS ("); sql.Append("ID, NUMEROBOLETO, NOSSONUMERO, IDCLIENTE, VALOR, DATAGERACAO, DATAVENCIMENTO, "); sql.Append("OBSERVACAO, IDCEDENTE, INSTRUCOES, STATUSBOLETO, EHBOLETOAVULSO) "); sql.Append("VALUES ("); sql.Append(String.Concat(boletoGerado.ID.Value, ", ")); sql.Append(!string.IsNullOrEmpty(boletoGerado.NumeroBoleto) ? String.Concat("'", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.NumeroBoleto), "', ") : "NULL, "); sql.Append(String.Concat(boletoGerado.NossoNumero.Value, ", ")); sql.Append(String.Concat(boletoGerado.Cliente.Pessoa.ID.Value, ", ")); sql.Append(boletoGerado.Valor == 0 ? String.Concat(0, ", ") : String.Concat(UtilidadesDePersistencia.TPVd(boletoGerado.Valor), ", ")); sql.Append(boletoGerado.DataGeracao.HasValue ? String.Concat(boletoGerado.DataGeracao.Value.ToString("yyyyMMdd"), ", ") : "NULL, "); sql.Append(boletoGerado.DataVencimento.HasValue ? String.Concat(boletoGerado.DataVencimento.Value.ToString("yyyyMMdd"), ", ") : "NULL, "); sql.Append(!string.IsNullOrEmpty(boletoGerado.Observacao) ? String.Concat("'", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.Observacao), "', ") : "NULL, "); if (boletoGerado.Cedente != null && boletoGerado.Cedente.Pessoa.ID.HasValue) sql.Append(String.Concat(boletoGerado.Cedente.Pessoa.ID.Value, ", ")); else sql.Append("NULL, "); sql.Append(!string.IsNullOrEmpty(boletoGerado.Instrucoes) ? String.Concat("'", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.Instrucoes), "', ") : "NULL, "); sql.Append(!string.IsNullOrEmpty(boletoGerado.StatusBoleto) ? String.Concat("'", UtilidadesDePersistencia.FiltraApostrofe(boletoGerado.StatusBoleto), "', ") : "'Aberto', "); sql.Append(boletoGerado.EhBoletoAvulso ? " '1') " : " '0') "); DBHelper.ExecuteNonQuery(sql.ToString()); }
private void PreenchaInformacoesDoBoleto(IBoletosGerados boleto) { txtVencimento.SelectedDate = boleto.DataVencimento; txtValor.Text = boleto.Valor.ToString(); txtNumeroDoBoleto.Text = boleto.NumeroBoleto; txtFinalidadeBoleto.Text = boleto.Observacao; txtInstrucoes.Text = boleto.Instrucoes; }
public void Inserir(IBoletosGerados boletoGerado, bool gerarItemFinanceiro, TipoLacamentoFinanceiroRecebimento tipoLacamento) { ServerUtils.setCredencial(_Credencial); var mapeador = FabricaGenerica.GetInstancia().CrieObjeto<IMapeadorDeBoleto>(); var mapeadorItemFinanceiroRecebimento = FabricaGenerica.GetInstancia().CrieObjeto<IMapeadorDeItensFinanceirosDeRecebimento>(); var mapeadorDeItemFinanceiroRecebimentoComBoleto = FabricaGenerica.GetInstancia().CrieObjeto<IMapeadorDeItemFinanceiroRecebidoComBoleto>(); var itemLacamentoFinanceiro = FabricaGenerica.GetInstancia().CrieObjeto<IItemLancamentoFinanceiroRecebimento>(); itemLacamentoFinanceiro.Cliente = boletoGerado.Cliente; itemLacamentoFinanceiro.DataDoLancamento = DateTime.Now; itemLacamentoFinanceiro.DataDoVencimento = boletoGerado.DataVencimento.Value; itemLacamentoFinanceiro.Situacao = Situacao.CobrancaGerada; itemLacamentoFinanceiro.TipoLacamento = tipoLacamento; itemLacamentoFinanceiro.Valor = boletoGerado.Valor; itemLacamentoFinanceiro.NumeroBoletoGerado = boletoGerado.NossoNumero.Value.ToString(); itemLacamentoFinanceiro.FormaDeRecebimento = FormaDeRecebimento.Boleto; if (!string.IsNullOrEmpty(boletoGerado.NumeroBoleto)) itemLacamentoFinanceiro.Descricao = boletoGerado.NumeroBoleto; //if (boletoGerado.ID != null) itemLacamentoFinanceiro.IDBOLETO = boletoGerado.ID.Value; try { ServerUtils.BeginTransaction(); mapeador.Inserir(boletoGerado); if (gerarItemFinanceiro) { mapeadorItemFinanceiroRecebimento.Insira(itemLacamentoFinanceiro); mapeadorDeItemFinanceiroRecebimentoComBoleto.Insira(itemLacamentoFinanceiro.ID.Value, boletoGerado.ID.Value); } ServerUtils.CommitTransaction(); } catch { ServerUtils.RollbackTransaction(); throw; } finally { ServerUtils.libereRecursos(); } }
private PdfPTable ObtenhaTabelaDadosDosLancamentos(IBoletosGerados boletoGerado) { var tabelaBoleto = new PdfPTable(8); tabelaBoleto.DefaultCell.Border = Rectangle.NO_BORDER; var celulaCedente = new PdfPCell(new Phrase(boletoGerado.Cedente.Pessoa.Nome, _Fonte1)); celulaCedente.HorizontalAlignment = Cell.ALIGN_LEFT; celulaCedente.VerticalAlignment = Cell.ALIGN_CENTER; celulaCedente.Border = 0; tabelaBoleto.AddCell(celulaCedente); var celulaNumeroDoBoleto = new PdfPCell(new Phrase(boletoGerado.NumeroBoleto, _Fonte1)); celulaNumeroDoBoleto.HorizontalAlignment = Cell.ALIGN_LEFT; celulaNumeroDoBoleto.VerticalAlignment = Cell.ALIGN_CENTER; celulaNumeroDoBoleto.Border = 0; tabelaBoleto.AddCell(celulaNumeroDoBoleto); var celulaNossoNumero = new PdfPCell(new Phrase(boletoGerado.NossoNumero.HasValue ? boletoGerado.NossoNumero.Value.ToString() : "", _Fonte1)); celulaNossoNumero.HorizontalAlignment = Cell.ALIGN_LEFT; celulaNossoNumero.VerticalAlignment = Cell.ALIGN_CENTER; celulaNossoNumero.Border = 0; tabelaBoleto.AddCell(celulaNossoNumero); var celulaValor = new PdfPCell(new Phrase(boletoGerado.Valor.ToString(), _Fonte1)); celulaValor.HorizontalAlignment = Cell.ALIGN_LEFT; celulaValor.VerticalAlignment = Cell.ALIGN_CENTER; celulaValor.Border = 0; tabelaBoleto.AddCell(celulaValor); string dataGeracao = boletoGerado.DataGeracao.HasValue ? boletoGerado.DataGeracao.Value.ToString("dd/MM/yyyy") : ""; var celulaDataRecebimento = new PdfPCell(new Phrase(dataGeracao, _Fonte1)); celulaDataRecebimento.HorizontalAlignment = Cell.ALIGN_LEFT; celulaDataRecebimento.VerticalAlignment = Cell.ALIGN_CENTER; celulaDataRecebimento.Border = 0; tabelaBoleto.AddCell(celulaDataRecebimento); string dataVencimento = boletoGerado.DataVencimento.HasValue ? boletoGerado.DataVencimento.Value.ToString("dd/MM/yyyy") : ""; var celulaFormaDeRecebimento = new PdfPCell(new Phrase(dataVencimento, _Fonte1)); celulaFormaDeRecebimento.HorizontalAlignment = Cell.ALIGN_LEFT; celulaFormaDeRecebimento.VerticalAlignment = Cell.ALIGN_CENTER; celulaFormaDeRecebimento.Border = 0; tabelaBoleto.AddCell(celulaFormaDeRecebimento); var celulaStatus = new PdfPCell(new Phrase(boletoGerado.StatusBoleto, _Fonte1)); celulaStatus.HorizontalAlignment = Cell.ALIGN_LEFT; celulaStatus.VerticalAlignment = Cell.ALIGN_CENTER; celulaStatus.Border = 0; tabelaBoleto.AddCell(celulaStatus); var boletoEhAvulso = string.Empty; if(boletoGerado.EhBoletoAvulso) boletoEhAvulso = "SIM"; var celulaBoletoAvulso = new PdfPCell(new Phrase(boletoEhAvulso, _Fonte1)); celulaBoletoAvulso.HorizontalAlignment = Cell.ALIGN_LEFT; celulaBoletoAvulso.VerticalAlignment = Cell.ALIGN_CENTER; celulaBoletoAvulso.Border = 0; tabelaBoleto.AddCell(celulaBoletoAvulso); return tabelaBoleto; }