Esempio n. 1
0
        public void CompileReport()
        {
            var employees = _employeeDb.GetAllEmployees();

            // All employees collected - let's output them
            switch (_currentOutputFormat)
            {
            case ReportOutputFormatType.NameFirst:
                Console.WriteLine("Name-first report");
                foreach (var e in employees)
                {
                    Console.WriteLine("------------------");
                    Console.WriteLine("Name: {0}", e.Name);
                    Console.WriteLine("Salary: {0}", e.Salary);
                    Console.WriteLine("------------------");
                }
                break;

            case ReportOutputFormatType.SalaryFirst:
                Console.WriteLine("Salary-first report");
                foreach (var e in employees)
                {
                    Console.WriteLine("------------------");
                    Console.WriteLine("Salary: {0}", e.Salary);
                    Console.WriteLine("Name: {0}", e.Name);
                    Console.WriteLine("------------------");
                }
                break;
            }
        }