Beispiel #1
0
        /// <summary>
        /// Importa as transações de um relatório da cielo
        /// </summary>
        /// <param name="csv">conteudo csv do relatorio</param>
        /// <returns>List of transactions found in OFX document</returns>
        private void ImportTransations(CieloDocument cieloDocument, DataTable csv)
        {
            string periodo = csv.Rows[0][0].ToString().Replace('\"', ' ').Trim();

            string[] periodos = periodo.Split(':')[1].Split('a');

            cieloDocument.StatementStart = Convert.ToDateTime(periodos[0].Trim());
            cieloDocument.StatementEnd   = Convert.ToDateTime(periodos[1].Trim());


            //tira o cabecalho
            var transactionNodes = ParseHeader(csv).Rows; //nao funcionou

            cieloDocument.Transactions = new List <CieloTransaction>();
            foreach (DataRow dr in transactionNodes)
            {
                try
                {
                    cieloDocument.Transactions.Add(new CieloTransaction(dr));
                }
                catch
                {
                    continue;
                }
            }
        }
Beispiel #2
0
        private CieloDocument ParseCieloDocument(string cieloString)
        {
            //Lê o arquivo csv
            DataTable     dt    = Moses.Utils.CsvToDataTable(cieloString, false, ';');
            CieloDocument cielo = new CieloDocument();

            ImportTransations(cielo, dt);



            return(cielo);
        }