示例#1
0
        public List <EmployeeData> ReadData()
        {
            var employeeList = new List <EmployeeData>();

            List <string> csvData = CSVHandler.GetData(_readPath);

            foreach (var row in csvData)
            {
                var employee = CSVHandler.ConvertToEmployee(row);
                employeeList.Add(employee);
            }

            return(employeeList);
        }
示例#2
0
        public void PrintPayslip(List <Payslip> Payslips)
        {
            var fileWriter = new StreamWriter(_writePath);

            fileWriter.WriteLine("name,pay period,gross income,income tax,net income,super");
            fileWriter.Flush();

            // Write data line for each payslip
            foreach (var payslip in Payslips)
            {
                var dataLine = CSVHandler.FormatPayslip(payslip);
                fileWriter.WriteLine(dataLine);
                fileWriter.Flush();
            }

            var filepath = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.Parent.Parent.FullName;

            Console.WriteLine("\nYour payslip has been generated as a CSV at " + filepath + "/" +
                              _writePath.TrimStart('/', '.') + "\nThank you for using MYOB!");
        }