/// <summary> /// Executes the input file path in beginning and exportation process at end /// </summary> /// <param name="args"></param> /// <returns>and returns either the GetInputFolderPath method (for reading the file when program starts) and GetExportFolderPath method (for writing the file before the program ends)</returns> static void Main(string[] args) { //Importing the .csv file linked with csvimporter.cs string relativePath = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "Import" ); string importPath = Path.Combine(relativePath, "employee-payroll-data.csv"); List <PayRecord> payRecords = CsvImporter.ImportPayRecords(importPath); //Exporting the .csv file linked with PayRecordWriter.cs string erelativePath = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "..", "..", "..", "Export" ); string exportPath = Path.Combine(erelativePath, $"{DateTime.Now.Ticks}.csv"); PayRecordWriter.Write(exportPath, payRecords, true); }
public static void Main(string[] args) { // List where we import the data in the csv file List <PayRecord> payRecords = CsvImporter.ImportPayRecords(GetInputPath()); // Variable storing datetime value to be used as part of export file name DateTime dateTimeNow = DateTime.UtcNow; // String containing full path of output folder + name of the file to be created string fileExportPath = Path.Combine(GetPathOutput(), dateTimeNow.Ticks + "-records.csv"); // Calling the Write() method to create a new file and write the data into it PayRecordWriter.Write(fileExportPath, payRecords, true); }
static void Main(string[] args) { string fileName = @"import\employee-payroll-data.csv"; //List<PayRecord> PayRecords = new List<PayRecord>(); //PayRecords = CsvImporter.ImportPayRecords(fileName); //Console.WriteLine(PayRecords.Count); //foreach (PayRecord rec in PayRecords) { // Console.WriteLine(rec.GetDetails()); //} //Console.ReadKey(); List <PayRecord> payRecords = new List <PayRecord>(); payRecords = CsvImporter.ImportPayRecords(fileName); PayRecordWriter.Write(payRecords, true); Console.ReadKey(); }