Robson Amaral

Robson Amaral

  • NA
  • 132
  • 15.4k

Read file and insert into bank

Apr 24 2018 4:23 PM
I need to read a file and save the Schedule Date field, Document Value, Protocol, Barcode, Record: record date and time, how could it be doing? Here is my code attached. The file can be opened in txt, but I can not attach it. Within this file I have several vouchers, I left only two as a basis for the explanation. I need help out of courtesy. 
  1. using System;  
  2. using System.Collections;  
  3. using System.Collections.Generic;  
  4. using System.IO;  
  5. using System.Linq;  
  6. using System.Text;  
  7. using System.Threading.Tasks;  
  8.   
  9.   
  10. namespace ServiceProcessingVouchers  
  11. {  
  12.     public class ProcessReturn  
  13.     {  
  14.         private static object objReader;  
  15.   
  16.         private static void Main (string [] args)  
  17.         {  
  18.             List <string> Values ​​found = new List <string> ();  
  19.   
  20.             try  
  21.             {  
  22.                 string [] File = System.IO.Directory.GetFiles (@ "\\ S3A601 \ ftp @ sefarix \ are \ Output_SDPJ \ test""* .cpv");  
  23.   
  24.                 foreach (var item in File)  
  25.                 {  
  26.                     string [] line = item.Split (new [] {''}, StringSplitOptions.RemoveEmptyEntries);  
  27.   
  28.                     if (line.Length> = 3)  
  29.                     {  
  30.                         values ​​found .Add (line [2]);  
  31.                     }  
  32.                 }  
  33.             }  
  34.             catch (Exception ex)  
  35.             {  
  36.   
  37.             }  
  38.         }  
  39.     }  
  40. }  
File information:
------------------------------------------------
CONTAK TECHNOLOGY SA
--------------CONTAK CORPORATIVO--------------
Electronic Payments and Transfers
PAYMENT: JUDICIAL DEPOSIT
------------------------------------------------
Client: José Frederico Costa e Silva
Enc Ger APLIX - Cta C
Account: 5.535.0125
Agency: 104-Central
Cod. Bars: 898800000078 000002130424
017092700009 270400028680
Agreed: JUDICIAL DEPOSIT
Date Scheduling: 29/09/2017
Document Value: R$500,00
Protocol: 94651134
Source: CORPORATE CONTAK
================================================
EFFECTIVE TRANSACTION
================================================
Record: 29/09/2017 11:21:29 /local/home/tef/d/20170929/sfcg012.
Emission.: 30/09/2017 09:54:19
------------------------------------------------
CONTAK TECHNOLOGY SA
--------------CONTAK CORPORATIVO--------------
Electronic Payments and Transfers
PAYMENT: JUDICIAL DEPOSIT
------------------------------------------------
Client: José Afrânio
Enc Ger APLIX - Cta C
Account: 5.535.0125
Agency: 104-Central
Cod. Bars: 898800000078 000002130424
017092700009 270400028680
Agreed: JUDICIAL DEPOSIT
Date Scheduling: 29/09/2017
Document Value: R$509,00
Protocol: 94651134
Source: CORPORATE CONTAK
================================================
EFFECTIVE TRANSACTION
================================================
Record: 29/09/2017 11:21:29 /local/home/tef/d/20170929/sfcg012.
Emission.: 30/09/2017 09:54:19
------------------------------------------------

Answers (6)