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);
        }
Пример #2
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null) throw new ArgumentNullException("employeeDb");
     _currentOutputFormat = format;
     _employeeDb = employeeDb;
     this.dbhandler = dbhandler;
 }
Пример #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("");
        }
Пример #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();
        }
Пример #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();
        }
Пример #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)
            {
                ;
            }
        }
Пример #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();
        }
Пример #8
0
 public ReportDataFetcher(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
 }
Пример #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;
 }
Пример #11
0
 public ReportGenerator(EmployeeDB employeeDb, IReport ReportType)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _employeeDb = employeeDb;
     _reportType = ReportType;
 }
Пример #12
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _currentOutputFormat = ReportOutputFormatType.NameFirst;
     _employeeDb          = employeeDb;
 }
Пример #13
0
 public ReportGenerator(EmployeeDB employeeDb, ReportFormatEmployees format, IDBHandler dbhandler)
 {
     if (employeeDb == null)
     {
         throw new ArgumentNullException("employeeDb");
     }
     _currentOutputFormat = format;
     _employeeDb          = employeeDb;
     this.dbhandler       = dbhandler;
 }
Пример #14
0
        public dataCollectorEmployeeDB(EmployeeDB DB)
        {
            Employee employee;

            DB_ = DB;
            DB_.Reset();
            while ((employee = DB_.GetNextEmployee()) != null)
            {
                employees_.Add(employee);
            }
        }
Пример #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);
            }
        }
Пример #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());
        }
Пример #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("------------------");
            }
        }
Пример #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);
        }
Пример #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);
            }
        }
Пример #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);
            }
        }
Пример #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);
        }
Пример #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();
        }
Пример #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();
        }
Пример #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();
        }
Пример #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);
        }
Пример #28
0
 public EmployeeReportGenerator(EmployeeDB employeeDb)
 {
     _employeeDb = employeeDb ?? throw new ArgumentNullException("employeeDb");
 }
Пример #29
0
 public ReportGetEmployees(EmployeeDB db)
 {
     this.db = db;
 }
Пример #30
0
 public ReportGenerator(EmployeeDB edb)
 {
     _employeeReport   = new Report(edb);
     _currentFormatter = new AgeFirstFormatter();
     _currentPrinter   = new ConsolePrinter();
 }
Пример #31
0
 public EmployeeHandler(EmployeeDB employeeDB)
 {
     _employeeDb = employeeDB ?? throw new ArgumentNullException(nameof(employeeDB));
 }
Пример #32
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     _employeeDb = employeeDb;
 }
Пример #33
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     _reportDataFetcher = new ReportDataFetcher(employeeDb);
 }
Пример #34
0
 public ReportGenerator(EmployeeDB employeeDb)
 {
     if (employeeDb == null) throw new ArgumentNullException("employeeDb");
     _currentOutputFormat = ReportOutputFormatType.NameFirst;
     _employeeDb = employeeDb;
 }
Пример #35
0
 public ReportGetEmployees(EmployeeDB db)
 {
     this.db = db;
 }
Пример #36
-1
 public ReportGenerator(EmployeeDB edb)
 {
     _employeeReport = new Report(edb);
     _currentFormatter = new AgeFirstFormatter();
     _currentPrinter = new ConsolePrinter();
 }