public void SelecionaImportaPosicaoClienteFundosITAU() { try { this.DeletaImportaPosicaoClienteFundosITAU(); using (AcessaDados lAcessaDados = new AcessaDados()) { lAcessaDados.Conexao = new Conexao(); lAcessaDados.ConnectionStringName = "ClubesFundos"; using (DbCommand lCommand = lAcessaDados.CreateCommand(CommandType.StoredProcedure, "PRC_SEL_POSICAO_COTISTAS")) { DataTable dt = lAcessaDados.ExecuteDbDataTable(lCommand); foreach (DataRow dr in dt.Rows) { if (string.IsNullOrEmpty(dr["dsCpfCnpj"].ToString())) { continue; } PosicaoClienteItauInfo lPosicao = new PosicaoClienteItauInfo(); lPosicao.CodigoCliente = SelecionaCodigoCliente(dr["dsCpfCnpj"].ToString()); lPosicao.Angencia = dr["agencia"].ToString(); lPosicao.Banco = dr["banco"].ToString(); lPosicao.Conta = dr["conta"].ToString(); lPosicao.DigitoConta = dr["digitoConta"].ToString(); lPosicao.DsCpfCnpj = dr["dsCpfCnpj"].ToString(); lPosicao.DtProcessamento = Convert.ToDateTime(dr["dtProcessamento"]); lPosicao.DtReferencia = Convert.ToDateTime(dr["dtReferencia"]); lPosicao.IdCotista = dr["idCotista"].ToString(); lPosicao.IdFundo = SelecionaCodigoProduto(Convert.ToInt32(dr["idFundo"])); lPosicao.IdMovimento = Convert.ToInt32(dr["idMovimento"].ToString()); lPosicao.IdProcessamento = Convert.ToInt32(dr["idProcessamento"].ToString()); lPosicao.QuantidadeCotas = Convert.ToDecimal(dr["quantidadeCotas"].ToString()); lPosicao.SubConta = dr["subConta"].ToString(); lPosicao.ValorBruto = Convert.ToDecimal(dr["valorBruto"].ToString()); lPosicao.ValorCota = Convert.ToDecimal(dr["valorCota"].ToString()); lPosicao.ValorIOF = Convert.ToDecimal(dr["valorIOF"].ToString()); lPosicao.ValorIR = Convert.ToDecimal(dr["valorIR"].ToString()); lPosicao.ValorLiquido = Convert.ToDecimal(dr["ValorLiquido"].ToString()); this.ImportaPosicaoClienteFundosITAU(lPosicao); } } } } catch (Exception ex) { gLogger.ErrorFormat("Erro encontrado no método SelecionaImportaPosicaoClienteFundosITAU = [{0}]", ex.StackTrace); } }
public void ImportaPosicaoClienteFundosITAU(PosicaoClienteItauInfo info) { try { using (AcessaDados lAcessaDados = new AcessaDados()) { lAcessaDados.Conexao = new Conexao(); lAcessaDados.ConnectionStringName = "PlataformaInviXX"; gLogger.InfoFormat("Importando dados de fundo do Cliente [{0}]", info.CodigoCliente); using (DbCommand lCommand = lAcessaDados.CreateCommand(CommandType.StoredProcedure, "PRC_INS_POSICAO_COTISTAS")) { lAcessaDados.AddInParameter(lCommand, "@CodigoCliente", DbType.Int32, info.CodigoCliente); lAcessaDados.AddInParameter(lCommand, "@Agencia", DbType.String, info.Angencia); lAcessaDados.AddInParameter(lCommand, "@Banco", DbType.String, info.Banco); lAcessaDados.AddInParameter(lCommand, "@Conta", DbType.String, info.Conta); lAcessaDados.AddInParameter(lCommand, "@DigitoConta", DbType.String, info.DigitoConta); lAcessaDados.AddInParameter(lCommand, "@DsCpfCnpj", DbType.String, info.DsCpfCnpj); lAcessaDados.AddInParameter(lCommand, "@DtProcessamento", DbType.DateTime, info.DtProcessamento); lAcessaDados.AddInParameter(lCommand, "@DtReferencia", DbType.DateTime, info.DtReferencia); lAcessaDados.AddInParameter(lCommand, "@IdCotista", DbType.String, info.IdCotista); lAcessaDados.AddInParameter(lCommand, "@IdFundo", DbType.Int32, info.IdFundo); lAcessaDados.AddInParameter(lCommand, "@IdMovimento", DbType.Int32, info.IdMovimento); lAcessaDados.AddInParameter(lCommand, "@IdProcessamento", DbType.Int32, info.IdProcessamento); lAcessaDados.AddInParameter(lCommand, "@QuantidadeCotas", DbType.Decimal, info.QuantidadeCotas); lAcessaDados.AddInParameter(lCommand, "@SubConta", DbType.String, info.SubConta); lAcessaDados.AddInParameter(lCommand, "@ValorCota", DbType.Decimal, info.ValorCota); lAcessaDados.AddInParameter(lCommand, "@ValorBruto", DbType.Decimal, info.ValorBruto); lAcessaDados.AddInParameter(lCommand, "@ValorIR", DbType.Decimal, info.ValorIR); lAcessaDados.AddInParameter(lCommand, "@ValorIOF", DbType.Decimal, info.ValorIOF); lAcessaDados.AddInParameter(lCommand, "@ValorLiquido", DbType.Decimal, info.ValorLiquido); lAcessaDados.ExecuteNonQuery(lCommand); } } } catch (Exception ex) { gLogger.ErrorFormat("Erro encontrado no método ImportarPosicaoClienteFundosITAU = [{0}]", ex.StackTrace); } }