예제 #1
0
        static void Chose()
        {
            Console.Clear();
            Company company1 = MyCollection();

            Console.WriteLine("Enter Id");
            int  id;
            bool result = int.TryParse(Console.ReadLine(), out id);

            Console.WriteLine("Enter Last Name");
            string lastName = Console.ReadLine();

            Console.WriteLine("Enter First Name");
            string firstName = Console.ReadLine();

            Console.WriteLine("Enter Gander - enter key man ant any key woman");
            string gender = Console.ReadLine();

            GenderInfo(gender);
            MenuPosition();

            Position pos;

            Enum.TryParse(Console.ReadLine(), out pos);

            switch (pos)
            {
            case Position.Executive:
            {
                Executive executive = new Executive(id, lastName, firstName, GenderInfo(gender),
                                                    Position.Executive);

                company1.AddEmploee(executive);
                company1.Show();
            }
            break;

            case Position.Manager:
            {
                Manager manager = new Manager(id, lastName, firstName, GenderInfo(gender), Position.Manager);
                company1.AddEmploee(manager);
                company1.Show();
            }
            break;

            case Position.HourlyEmloyee:
            {
                HourlyEmloyee hourlyEmp = new HourlyEmloyee(id, lastName, firstName, GenderInfo(gender),
                                                            Position.HourlyEmloyee, 0);

                company1.AddEmploee(hourlyEmp);
                company1.Show();
            }
            break;

            case Position.SalariedEmployee:
            {
                SalariedEmployee salasried = new SalariedEmployee(id, lastName, firstName, GenderInfo(gender),
                                                                  Position.SalariedEmployee);

                company1.AddEmploee(salasried);
                company1.Show();
            }
            break;

            default:
            {
                Console.WriteLine("Mistake. Make your choice \n" +
                                  "press any button to continue");
                Console.ReadKey();
            }
            break;
            }
        }