示例#1
0
        public dataCollectorEmployeeDB(EmployeeDB DB)
        {
            Employee employee;

            DB_ = DB;
            DB_.Reset();
            while ((employee = DB_.GetNextEmployee()) != null)
            {
                employees_.Add(employee);
            }
        }
示例#2
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);
            }
        }
        public void CompileReport(IPrinter printer)
        {
            var      employees = new List <Employee>();
            Employee employee;

            _employeeDb.Reset();

            // Get all employees
            while ((employee = _employeeDb.GetNextEmployee()) != null)
            {
                employees.Add(employee);
            }
            printer.Print(employees);
        }
        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);
        }
示例#5
0
        public List <Employee> GetEmployees()
        {
            var      employees = new List <Employee>();
            Employee employee;

            db.Reset();

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

            return(employees);
        }
示例#6
0
        /// <summary>
        /// Compiles a report from the database
        /// </summary>
        /// <returns>The compiled report</returns>
        public List <IEmployee> CompileReport()
        {
            List <IEmployee> employeesReport = new List <IEmployee>();
            IEmployee        employee;

            _employeeDb.Reset();

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

            return(employeesReport);
        }
示例#7
0
        public List <Employee> CompileReport()
        {
            var      employees = new List <Employee>();
            Employee employee;

            _employeeDb.Reset();

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

            return(employees);
        }
示例#8
0
        public IEnumerable <Employee> GetEmployees()
        {
            var      employees = new List <Employee>();
            Employee employee;

            _employeeDb.Reset();

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

            return(employees);
        }
示例#9
0
        public void CompileReport()
        {
            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
            _currentOutputFormat.print(employees);
        }
示例#10
0
        public void CompileReport()
        {
            var            employees = new List <Employee>();
            Employee       employee;
            PrintToConsole f = new PrintToConsole(_currentOutputFormat);

            _employeeDb.Reset();

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

            foreach (var e in employees)
            {
                f.Print(e);
            }

            // 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;
            //}
        }
示例#11
0
        public void CompileReport()
        {
            var      employees = new List <Employee>();
            Employee employee;

            _employeeDb.Reset();

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

            foreach (var e in employees)
            {
                _reportType.print(e);
            }
        }
示例#12
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);
        }
示例#13
0
        public void CompileReport()
        {
            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 (_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;
            }
        }