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.
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ServiceProcessingVouchers
- {
- public class ProcessReturn
- {
- private static object objReader;
- private static void Main (string [] args)
- {
- List <string> Values found = new List <string> ();
- try
- {
- string [] File = System.IO.Directory.GetFiles (@ "\\ S3A601 \ ftp @ sefarix \ are \ Output_SDPJ \ test", "* .cpv");
- foreach (var item in File)
- {
- string [] line = item.Split (new [] {''}, StringSplitOptions.RemoveEmptyEntries);
- if (line.Length> = 3)
- {
- values found .Add (line [2]);
- }
- }
- }
- catch (Exception ex)
- {
- }
- }
- }
- }
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
------------------------------------------------
6 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Robson AmaralPosted Aug 28, 2018, 6:20 AM
Nitin SontakkePosted Aug 28, 2018, 12:37 AM
Robson AmaralPosted Aug 27, 2018, 8:15 PM
Nitin Sontakke,
It is this information that I acquired when I was compiling my application, I do not know if there is a better way to read this file, since I need to read the following fields and get the value of each field:
CodBars Payday
Document Value
Protocol
Record
Emission
This data can come in several lines of the file randomly, because it is a voucher, I have to get and store the information of each field of these items I mentioned above, but it does not work at all: It also follows the structure of this voucher.
Maybe I'm complicating a way to be properly programmed, if someone has more experience and wants to contribute a better practice to take this reading, thank you:
Nitin SontakkePosted May 13, 2018, 1:16 AM
Robson AmaralPosted May 12, 2018, 2:08 PM
Željko PerićPosted May 6, 2018, 8:02 AM