static void Main(string[] args)
        {
            Console.WriteLine("===========Input===========");

            Employee employee = new Employee();

            Console.WriteLine("You have the following designation: ");
            for (int i = 1; i <= Enum.GetValues(typeof(DesignationEnum)).Length; i++)
            {
                Console.Write(i + ". ");
                for (int j = i; j <= Enum.GetValues(typeof(DesignationEnum)).Length;)
                {
                    DesignationEnum des = (DesignationEnum)j;
                    Console.WriteLine(des);
                    break;
                }
            }

            Console.Write("Type any of the serial number of desingation mensioned above: ");
            int designation = Int32.Parse(Console.ReadLine());

            employee.DesignationProperty = Convert.ToString((DesignationEnum)designation);

            Console.WriteLine("Enter 'STOP' to stop role plays. ");
            Console.WriteLine("Role Play: ");
            bool isRoleContinue = true;
            int  roleCounter    = 0;

            do
            {
                string userInput = " ";
                userInput = Console.ReadLine();
                if (userInput.ToUpper() == "STOP")
                {
                    isRoleContinue = false;
                }
                else
                {
                    employee.RpInterfaceMethod().Add(userInput);
                    roleCounter++;
                }
            }while (isRoleContinue);

            Console.WriteLine("==========Output===========");
            Console.WriteLine($"ID: {employee.GetID()}");
            Console.WriteLine($"Name: {employee.GetName()}");
            Console.WriteLine($"Designation: {employee.DesignationProperty}");
            Console.WriteLine($"Birth Date: {employee.GetBirthDate().ToLongDateString()}");
            Console.WriteLine($"Join Date: {employee.GetJoinDate().ToLongDateString()}");
            Console.WriteLine($"Roles Play: {string.Join(", ", employee.RpArray)}");
        }
예제 #2
0
 public bool IsAccessAllowedToUser(DesignationEnum userDesignation)
 {
     return(_allowedDesignations.Any(designation => designation == userDesignation));
 }