private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 18));
            db.AddEmployee(new Employee("Berit", 2000, 20));
            db.AddEmployee(new Employee("Christel", 1000, 24));


            // Create a default (name-first) report
            var reportGenerator = new ReportGenerator_namefirst();

            reportGenerator.CompileReport(db);

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            var reportGenerator2 = new ReportGenerator_salaryfirst();

            reportGenerator2.CompileReport(db);

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            var reportGenerator3 = new ReportGenerator_agefirst();

            reportGenerator3.CompileReport(db);
        }
Ejemplo n.º 2
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null) throw new ArgumentNullException("employeeDb");
     _currentOutputFormat = format;
     _employeeDb = employeeDb;
     this.dbhandler = dbhandler;
 }
Ejemplo n.º 3
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("ZUB", 1, 18));
            db.AddEmployee(new Employee("Magnus", 2, 36));
            db.AddEmployee(new Employee("Lasse", 3, 49));

            var SalaryreportGenerator = new SalaryFirstRP();
            var NamereportGenerator   = new NameFirstRP();
            var AgereportGenerator    = new AgeFirstRP();
            var ReportGenerator       = new ReportGenerator(db);

            ReportGenerator.CompileReport(NamereportGenerator);

            Console.WriteLine("");
            Console.WriteLine("");

            ReportGenerator.CompileReport(SalaryreportGenerator);

            Console.WriteLine("");
            Console.WriteLine("");

            ReportGenerator.CompileReport(AgereportGenerator);

            Console.WriteLine("");
            Console.WriteLine("");
        }
Ejemplo n.º 4
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 32));
            db.AddEmployee(new Employee("Berit", 2000, 45));
            db.AddEmployee(new Employee("Christel", 1000, 54));

            IReport ReportType = new AgeFirst();

            var reportGenerator = new ReportGenerator(db, ReportType);

            // Create a default (name-first) report
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            reportGenerator._reportType = new SalaryFirst();
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a age-first report
            reportGenerator._reportType = new AgeFirst();
            reportGenerator.CompileReport();
        }
Ejemplo n.º 5
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new EmployeeWithAge("Christel", 1000, 20));

            //Create report generator and printer
            var reportGenerator = new EmployeeReportGenerator(db);
            var printer         = new Printer <IEmployee>(new EmployeeByNameFormatter());

            var report = reportGenerator.CompileReport();

            printer.Print(report);

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a age-first report
            printer.Formatter = new EmployeeByAgeFormatter();
            report            = reportGenerator.CompileReport();
            printer.Print(report);

            Console.ReadKey();
        }
Ejemplo n.º 6
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 20));
            db.AddEmployee(new Employee("Berit", 2000, 55));
            db.AddEmployee(new Employee("Christel", 1000, 24));

            dataCollectorEmployeeDB collector = new dataCollectorEmployeeDB(db);
            consolePrint            printer   = new consolePrint();
            Compiler compiler = new Compiler("Name");

            ReportGenerator RG = new ReportGenerator(printer, collector, compiler);

            // Create a default (name-first) report
            RG.start();

            Console.WriteLine("");
            Console.WriteLine("");

            compiler.ChangeFirst = "Salary";
            // Create a salary-first report
            RG.start();
            Console.WriteLine("");
            Console.WriteLine("");

            compiler.ChangeFirst = "Age";
            //age first
            RG.start();
            while (true)
            {
                ;
            }
        }
Ejemplo n.º 7
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 25));
            db.AddEmployee(new Employee("Berit", 2000, 74));
            db.AddEmployee(new Employee("Christel", 1000, 15));

            var reportGenerator = new ReportGenerator(db);

            // Create a default (name-first) report
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            reportGenerator.SetOutputFormat(new ReportSalaryFirst());
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            reportGenerator.SetOutputFormat(new ReportAgeFirst());
            reportGenerator.CompileReport();
        }
Ejemplo n.º 8
0
 public ReportDataFetcher(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
 }
Ejemplo n.º 9
0
 public SalaryFirstRG(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
 }
 public ReportGenerator(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
 }
Ejemplo n.º 11
0
 public ReportGenerator(EmployeeDB employeeDb, IReport ReportType)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
     _reportType = ReportType;
 }
Ejemplo n.º 12
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _currentOutputFormat = ReportOutputFormatType.NameFirst;
     _employeeDb          = employeeDb;
 }
Ejemplo n.º 13
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _currentOutputFormat = format;
     _employeeDb          = employeeDb;
     this.dbhandler       = dbhandler;
 }
Ejemplo n.º 14
0
        public dataCollectorEmployeeDB(EmployeeDB DB)
        {
            Employee employee;

            DB_ = DB;
            DB_.Reset();
            while ((employee = DB_.GetNextEmployee()) != null)
            {
                employees_.Add(employee);
            }
        }
Ejemplo n.º 15
0
        public Report(EmployeeDB employeeDb)
        {
            Employee employee;
            if (employeeDb == null) throw new ArgumentNullException("employeeDb");

            employeeDb.Reset();

            // Get all employees
            while ((employee = _employeeDb.GetNextEmployee()) != null)
            {
                Add(employee);
            }
        }
Ejemplo n.º 16
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000, 18));
            db.AddEmployee(new Employee("Berit", 2000, 20));
            db.AddEmployee(new Employee("Christel", 1000, 45));

            Console.WriteLine("");
            Console.WriteLine("");
            ReportGenerator.CompileReport(new EmployeeHandler(db), new ConsoleOutputter(), new AgeFirstFormatter());
        }
Ejemplo n.º 17
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new Employee("Christel", 1000));

            var reportGenerator = new ReportGenerator(db, new ReportFormatSalaryFirst(), new ReportGetEmployees(db));

            reportGenerator.CompileReport();
        }
        public void CompileReport(EmployeeDB _employeeDB)
        {
            var employees = base.generateList(_employeeDB);

            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("------------------");
            }
        }
Ejemplo n.º 19
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new Employee("Christel", 1000));

            var reportGenerator = new ReportGenerator(db, new ReportFormatSalaryFirst(), new ReportGetEmployees(db));

            reportGenerator.CompileReport();
        }
        protected List <Employee> generateList(EmployeeDB _employeeDB)
        {
            var      employees = new List <Employee>();
            Employee employee;

            _employeeDB.Reset();

            // Get all employees
            while ((employee = _employeeDB.GetNextEmployee()) != null)
            {
                employees.Add(employee);
            }
            return(employees);
        }
Ejemplo n.º 21
0
        public Report(EmployeeDB employeeDb)
        {
            if (employeeDb == null) throw new ArgumentNullException("employeeDb");
            var employeeDb1 = employeeDb;

            Employee employee;

            employeeDb1.Reset();

            while ((employee = employeeDb1.GetNextEmployee()) != null)
            {
                _employees.Add(employee);
            }
        }
Ejemplo n.º 22
0
        public Report(EmployeeDB employeeDb)
        {
            if (employeeDb == null)
            {
                throw new ArgumentNullException("employeeDb");
            }
            var employeeDb1 = employeeDb;

            Employee employee;

            employeeDb1.Reset();

            while ((employee = employeeDb1.GetNextEmployee()) != null)
            {
                _employees.Add(employee);
            }
        }
Ejemplo n.º 23
0
        public List <string> CompileReport(ref EmployeeDB employeeDB, ReportOutputFormatType format)
        {
            List <string> formattedString = new List <string>();
            var           employees       = new List <Employee>();
            Employee      employee;

            employeeDB.Reset();

            // Get all employees
            while ((employee = employeeDB.GetNextEmployee()) != null)
            {
                employees.Add(employee);
            }

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

            case ReportOutputFormatType.SalaryFirst:
                formattedString.Add("Salary-first report");
                foreach (var e in employees)
                {
                    formattedString.Add("------------------");
                    formattedString.Add("Salary: {0}" + e.Salary);
                    formattedString.Add("Name: {0}" + e.Name);
                    formattedString.Add("------------------");
                }
                break;
            }
            return(formattedString);
        }
Ejemplo n.º 24
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new Employee("Christel", 1000));

            var reportGenerator = new ReportGenerator(db);

            // Create a default (name-first) report
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            reportGenerator.SetOutputFormat(ReportOutputFormatType.SalaryFirst);
            reportGenerator.CompileReport();
        }
Ejemplo n.º 25
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("ZUB ZUB", 1000000000));
            db.AddEmployee(new Employee("Magnus", 2000));
            db.AddEmployee(new Employee("Lasse", 1000));

            var SalaryreportGenerator = new SalaryFirstRG(db);
            var NamereportGenerator   = new NameFirstRG(db);

            // Create a Name-first salary report
            NamereportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            SalaryreportGenerator.CompileReport();
        }
Ejemplo n.º 26
0
        static void Main(string[] args)
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new Employee("Christel", 1000));

            var reportGenerator = new ReportGenerator(db);

            // Create a default (name-first) report
            reportGenerator.CompileReport();

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            reportGenerator.SetOutputFormat(ReportOutputFormatType.SalaryFirst);
            reportGenerator.CompileReport();
        }
Ejemplo n.º 27
0
        private static void Main()
        {
            var db = new EmployeeDB();

            // Add some employees
            db.AddEmployee(new Employee("Anne", 3000));
            db.AddEmployee(new Employee("Berit", 2000));
            db.AddEmployee(new Employee("Christel", 1000));

            var reportGenerator = new ReportGenerator(db);

            // Create a default (name-first) report
            IPrinter nameprinter = new NameFirst();

            reportGenerator.CompileReport(nameprinter);

            Console.WriteLine("");
            Console.WriteLine("");

            // Create a salary-first report
            IPrinter salprinter = new SalaryFirst();

            reportGenerator.CompileReport(salprinter);
        }
Ejemplo n.º 28
0
 public EmployeeReportGenerator(EmployeeDB employeeDb)
 {
     _employeeDb = employeeDb ?? throw new ArgumentNullException("employeeDb");
 }
Ejemplo n.º 29
0
 public ReportGetEmployees(EmployeeDB db)
 {
     this.db = db;
 }
Ejemplo n.º 30
0
 public ReportGenerator(EmployeeDB edb)
 {
     _employeeReport   = new Report(edb);
     _currentFormatter = new AgeFirstFormatter();
     _currentPrinter   = new ConsolePrinter();
 }
Ejemplo n.º 31
0
 public EmployeeHandler(EmployeeDB employeeDB)
 {
     _employeeDb = employeeDB ?? throw new ArgumentNullException(nameof(employeeDB));
 }
Ejemplo n.º 32
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     _employeeDb = employeeDb;
 }
Ejemplo n.º 33
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     _reportDataFetcher = new ReportDataFetcher(employeeDb);
 }
Ejemplo n.º 34
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     if (employeeDb == null) throw new ArgumentNullException("employeeDb");
     _currentOutputFormat = ReportOutputFormatType.NameFirst;
     _employeeDb = employeeDb;
 }
Ejemplo n.º 35
0
 public ReportGetEmployees(EmployeeDB db)
 {
     this.db = db;
 }
Ejemplo n.º 36
-1
 public ReportGenerator(EmployeeDB edb)
 {
     _employeeReport = new Report(edb);
     _currentFormatter = new AgeFirstFormatter();
     _currentPrinter = new ConsolePrinter();
 }