Beispiel #1
0
        static void Main(string[] args)
        {
            while (true)
            {
                Console.WriteLine("Select the action (the value):");
                Console.WriteLine("1 - Add new employee");
                Console.WriteLine("2 - Select all employees");
                Console.WriteLine("3 - Select user by parametr from list (Max and Min salary, avarage age of employees )");
                Console.WriteLine("4 - Select user by department");
                Console.WriteLine("5 - Select user by name");
                string SelectAction = Console.ReadLine();
                switch (SelectAction)
                {
                case "1":
                    Console.WriteLine("Add new employee");
                    PersonsList.Add(PersonAttribute.AddEmployees());
                    break;

                case "2":
                    Console.WriteLine($"Employees list");
                    //Select "PersonsList" for itemize
                    PersonAttribute.SelectAllEmployees(PersonsList);     //Use "PersonAttribute" for itemize
                    break;

                case "3":
                    Console.WriteLine("Select one parametr from list: ");
                    Console.WriteLine("Parametr 1 is max salary");
                    Console.WriteLine("Parametr 2 is min salary");
                    Console.WriteLine("Parametr 3 is average age of employees");
                    PersonAttribute.OptionList(PersonsList);
                    break;

                case "4":
                    PersonAttribute.SelectDepartment(PersonsList);
                    break;

                case "5":
                    PersonAttribute.SelectUserByName(PersonsList);
                    break;
                }
                Console.WriteLine("For ending the program enter the 'end', for continuing press 'enter'");
                string EndAction = Console.ReadLine();
                if (EndAction == "end")
                {
                    break;
                }
            }
            Console.WriteLine("The program is ended");
        }
Beispiel #2
0
        public static PersonAttribute AddEmployees()
        {
            PersonAttribute Employee = new PersonAttribute(); //Creation of new object "Employee"

            Console.WriteLine($"Enter Employees name: ");
            Employee.Name = Console.ReadLine();
            Console.WriteLine($"Enter Employees Age: ");
            Employee.Age = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine($"Enter Employees Salary: ");
            Employee.Salary = Convert.ToDouble(Console.ReadLine());
            Console.WriteLine($"Enter Employees Department: ");
            Employee.Department = Console.ReadLine();

            return(Employee);
        }