public void Run()
        {
            Employee manager = new Manager("Elon Musk", new List <string>()
            {
                "SpaceX",
                "Tesla",
                "Hyperloop",
                "SolarCity"
            });

            Employee hygienist = new Hygienist("Lelq Vanche", new List <string>()
            {
                "Broom",
                "Paddle",
                "Vacuum Cleaner",
                "Big Mouth"
            });

            var employeeList = new List <Employee>()
            {
                manager, hygienist
            };
            var detailsPrinter = new DetailsPrinter(employeeList);

            Console.WriteLine(detailsPrinter.PrintDetails());;
        }
Esempio n. 2
0
        private void addEmployee_MouseUp(object sender, MouseButtonEventArgs e)
        {
            string       firstName = firstNameInput.Text;
            string       lastName  = lastNameInput.Text;
            string       egn       = egnInput.Text;
            Position     position  = (Position)positionComboBox.SelectedItem;
            ContractType type      = (ContractType)contractTypeComboBox.SelectedItem;
            decimal      salary    = (decimal)SliderGrade.Value;
            int          rating    = 1;
            // Get the object with Max ID
            var      maxIdEmEmployee = _employeeContainer.EmployeesList.Aggregate((seed, f) => f.Id > seed.Id ? f : seed); // IT is magic but works - don't know how, dont' touch it please :)
            int      id = maxIdEmEmployee.Id + 1;
            Employee newEmployee;

            switch (position)
            {
            case Position.Unknown:
                throw new ArgumentException("Please Select Valid Position Type");

            case Position.Principal:
                newEmployee = new Principal(firstName, lastName, egn, type, id, salary, rating);
                break;

            case Position.Administrator:
                newEmployee = new Administrator(firstName, lastName, egn, type, id, salary, rating);
                break;

            case Position.Teacher:
                newEmployee = new Teacher(firstName, lastName, egn, type, id, salary, rating);
                break;

            //case Position.Support:
            //    newEmployee = new Support(firstName, lastName, egn, type, id);
            //    break;
            case Position.Hygienist:
                newEmployee = new Hygienist(firstName, lastName, egn, type, id, salary, rating);
                break;

            default:
                newEmployee = new Teacher(firstName, lastName, egn, type, id, salary, rating);
                break;
            }
            _employeeContainer.Add(newEmployee);
            this.Close();
        }