Пример #1
0
        public BindingList <EFundos> ConsultarFundos(string _CPFCNPJ)
        {
            base.AcessaDados.ConnectionStringName = base.ConexaoOMS;
            var fundos = new BindingList <EFundos>();
            var fundo  = new EFundos();
            var dados  = new DataTable();

            using (var _DbCommand = AcessaDados.CreateCommand(CommandType.StoredProcedure, "prc_consulta_fundos"))
            {
                AcessaDados.AddInParameter(_DbCommand, "@ds_cpfcgc", DbType.String, _CPFCNPJ.Replace(".", string.Empty).Replace("-", string.Empty).Replace("/", string.Empty).Replace(@"\", string.Empty));

                dados = AcessaDados.ExecuteOracleDataTable(_DbCommand);
            }

            foreach (DataRow item in dados.Rows)
            {
                fundo              = new EFundos();
                fundo.CpfCnpj      = item["CPFCGC"].DBToString();
                fundo.Carteira     = item["CARTEIRA"].DBToInt32();
                fundo.Cliente      = item["CLIENTE"].DBToInt32();
                fundo.NomeFundo    = item["NOMEFUNDO"].DBToString();
                fundo.NomeCliente  = item["NOMECLIENTE"].DBToString();
                fundo.Cota         = item["COTA"].DBToDecimal();
                fundo.Quantidade   = item["QUANTIDADE"].DBToDecimal();
                fundo.ValorBruto   = item["VALORBRUTO"].DBToDecimal();
                fundo.IR           = item["IR"].DBToDecimal();
                fundo.IOF          = item["IOF"].DBToDecimal();
                fundo.ValorLiquido = item["VALORLIQUIDO"].DBToDecimal();
                fundo.DataAtu      = item["DATAATU"].DBToDateTime();
                fundos.Add(fundo);
            }
            return(fundos);
        }
Пример #2
0
        public void ProcessarArquivos(string arquivo)
        {
            try
            {
                XDocument document = XDocument.Load(arquivo);

                List <EFundos> lstFundos  = new List <EFundos>();
                EFundos        eFundos    = new EFundos();
                EFundos        eFundosAux = new EFundos();
                lstFundos.Clear();

                var lListaCarteiras = from carteira in document.Descendants("carteira")
                                      select new
                {
                    CARTEIRA  = carteira.Element("identificacao").Element("codigo").Value,
                    NOMEFUNDO = carteira.Element("identificacao").Element("nome-completo").Value,
                    DATAATU   = carteira.Element("identificacao").Element("data-atual").Value,
                };

                foreach (var lCarteira in lListaCarteiras)
                {
                    eFundosAux.Carteira  = int.Parse(lCarteira.CARTEIRA);
                    eFundosAux.DataAtu   = DateTime.Parse(lCarteira.DATAATU);
                    eFundosAux.NomeFundo = lCarteira.NOMEFUNDO;
                }

                var lListaClientes = from cliente in document.Descendants("cliente")
                                     select new
                {
                    CLIENTE      = cliente.Element("identificacao").Element("codigo").Value,
                    NOMECLIENTE  = cliente.Element("identificacao").Element("nome").Value,
                    COTA         = cliente.Element("saldo").Element("valor-da-cota").Value,
                    QUANTIDADE   = cliente.Element("saldo").Element("saldo-de-cotas").Value,
                    VALORBRUTO   = cliente.Element("saldo").Element("valor-bruto").Value,
                    IR           = cliente.Element("saldo").Element("ir").Value,
                    IOF          = cliente.Element("saldo").Element("iof").Value,
                    VALORLIQUIDO = cliente.Element("saldo").Element("valor-liquido").Value,
                    CPFCNPJ      = cliente.Element("identificacao").Element("cpf-cnpj").Value,
                };

                foreach (var lCliente in lListaClientes)
                {
                    eFundos              = new EFundos();
                    eFundos.Carteira     = eFundosAux.Carteira;
                    eFundos.DataAtu      = eFundosAux.DataAtu;
                    eFundos.NomeFundo    = eFundosAux.NomeFundo;
                    eFundos.Cliente      = int.Parse(lCliente.CLIENTE);
                    eFundos.NomeCliente  = lCliente.NOMECLIENTE;
                    eFundos.Cota         = decimal.Parse(lCliente.COTA, new CultureInfo("pt-BR"));
                    eFundos.Quantidade   = decimal.Parse(lCliente.QUANTIDADE, new CultureInfo("pt-BR"));
                    eFundos.ValorBruto   = decimal.Parse(lCliente.VALORBRUTO, new CultureInfo("pt-BR"));
                    eFundos.IR           = decimal.Parse(lCliente.IR, new CultureInfo("pt-BR"));
                    eFundos.IOF          = decimal.Parse(lCliente.IOF, new CultureInfo("pt-BR"));
                    eFundos.ValorLiquido = decimal.Parse(lCliente.VALORLIQUIDO, new CultureInfo("pt-BR"));
                    eFundos.CpfCnpj      = lCliente.CPFCNPJ.Replace(".", "").Replace("-", "").Replace("/", "");
                    lstFundos.Add(eFundos);
                }

                new DFundos().AtualizarFundos(lstFundos);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }