Ejemplo n.º 1
0
        static void test()
        {
            EmployeeFixedFee  e1 = new EmployeeFixedFee(0, "FirstName1", "SecondName1", "MiddleName1", 10, 0, new DateTime(2000, 1, 1));
            EmployeeFixedFee  e2 = new EmployeeFixedFee(1, "FirstName2", "SecondName2", "MiddleName2", 30, 0, new DateTime(2000, 1, 1));
            EmployeeFixedFee  e3 = new EmployeeFixedFee(2, "FirstName3", "SecondName3", "MiddleName3", 20, 0, new DateTime(2000, 1, 1));
            EmployeeFixedFee  e4 = new EmployeeFixedFee(4, "FirstName4", "SecondName4", "MiddleName4", 5, 0, new DateTime(2000, 1, 1));
            EmployeeHourlyFee e5 = new EmployeeHourlyFee(5, "FirstName5", "SecondName5", "MiddleName5", 2, 20, new DateTime(2000, 1, 1));
            EmployeeFixedFee  e6 = new EmployeeFixedFee(6, "FirstName6", "SecondName6", "MiddleName6", 10, 50, new DateTime(2000, 1, 1));
            EmployeeHourlyFee e7 = new EmployeeHourlyFee(7, "FirstName7", "SecondName7", "MiddleName7", 2, 0, new DateTime(2000, 1, 1));
            EmployeeFixedFee  e8 = new EmployeeFixedFee(8, "FirstName8", "SecondName8", "MiddleName8", 8, 0, new DateTime(2000, 1, 1));

            Organization o = new Organization();

            o.add(e1);
            o.add(e2);
            o.add(e3);
            o.add(e4);
            o.add(e5);
            o.add(e6);
            o.add(e7);
            o.add(e8);

            o.sort();
            Menu.run(o);
        }
Ejemplo n.º 2
0
        public static void addEmployee(Organization org)
        {
            string[] name = consoleGetStrName();
            if (consoleGetBoolean("Enter the type of the employee\n \"fixed\" or\n \"hourly\"\n", "", ""))
            {
                EmployeeHourlyFee newEmployee =
                    new EmployeeHourlyFee(
                        consoleGetInt("Enter the ID of the new employee\n"),
                        name[1],                        //first
                        name[0],                        //second
                        name[2],                        //middle
                        consoleGetDecimal("Enter the rate of the employee"),
                        consoleGetDecimal("Enter the bounty of the employee, if there isn't - enter \"0\""),
                        consoleGetDateTime("Enter the birthday of the employee\nDD.MM.YYYY\n")
                        );

                Console.WriteLine("Proceed the adding?\n\n");
                employeeInfoOut(newEmployee);
                if (consoleGetBoolean("Enter \"yes\" or \"no\"...", "yes", "no"))
                {
                    org.add(newEmployee);
                    return;
                }
                else
                {
                    return;
                }
            }
            else
            {
                EmployeeFixedFee newEmployee =
                    new EmployeeFixedFee(
                        consoleGetInt("Enter the ID of the new employee\n"),
                        name[1],                        //first
                        name[0],                        //second
                        name[2],                        //middle
                        consoleGetDecimal("Enter the rate of the employee"),
                        consoleGetDecimal("Enter the bounty of the employee, if there isn't - enter \"0\""),
                        consoleGetDateTime("Enter the birthday of the employee\nDD.MM.YYYY\n")
                        );

                Console.WriteLine("Proceed the adding?\n\n");
                employeeInfoOut(newEmployee);
                if (consoleGetBoolean("Enter \"yes\" or \"no\"...", "yes", "no"))
                {
                    org.add(newEmployee);
                    return;
                }
                else
                {
                    return;
                }
            }
        }