Ejemplo n.º 1
0
        internal static void Main(string[] args)
        {
            RoundService roundService = new RoundService();
            TaxRuleService taxRuleService = new TaxRuleService(roundService);

            EmployeeIncomeService employeeIncomeService = new EmployeeIncomeService(taxRuleService, roundService);

            var employeeList = GetEmployeeInfos();

            OutputToFile(employeeList, employeeIncomeService);
        }
Ejemplo n.º 2
0
        private static void OutputToFile(IList<EmployeeInfo> employeeList, EmployeeIncomeService employeeIncomeService)
        {
            using (StreamWriter file = new StreamWriter(@"output.csv"))
            {
                IList<Payslip> payslipList = new List<Payslip>();

                foreach (var employeeInfo in employeeList)
                {
                    var payslip = employeeIncomeService.CalculatePayslip(employeeInfo);

                    payslipList.Add(payslip);
                }

                var csvWriter = new CsvWriter(file);
                csvWriter.Configuration.RegisterClassMap<PayslipMap>();
                csvWriter.Configuration.HasHeaderRecord = false;
                csvWriter.WriteRecords(payslipList);
            }
        }
 public void Init()
 {
     RoundService roundService = new RoundService();
     TaxRuleService taxRuleService = new TaxRuleService(roundService);
     this.employeeIncomeService = new EmployeeIncomeService(taxRuleService, roundService);
 }