示例#1
0
        public void CreateUsersCLI()
        {
            User               user   = new User();
            AdminDA            admin  = new AdminDA();
            PasswordProtection pp     = new PasswordProtection();
            ExcuteAdminCLI     excute = new ExcuteAdminCLI();

            Console.WriteLine("");
            Console.WriteLine("+++ Add New User +++");
            Console.WriteLine("");

            Console.WriteLine("enter user name :");
            user.userName = Console.ReadLine();

            Console.WriteLine("enter user password :"******"enter user role :");
            Console.WriteLine("");
            Console.WriteLine("1 - admin");
            Console.WriteLine("2 - Team Lead");
            Console.WriteLine("3 - Normal Member");
            Console.WriteLine("");
            Console.WriteLine("Enter respective number : ");
            user.role = Int32.Parse(Console.ReadLine());

            Console.WriteLine("");
            Console.WriteLine("** press [Esc] to save and exit");
            Console.WriteLine("** press [1] to save and add new user");

            var k = Console.ReadKey(true);

            if (k.Key == ConsoleKey.Escape)
            {
                var msg = admin.CreateUsersDA(user);
                Console.WriteLine(msg);
                Console.Clear();
                excute.Header();
            }
            else if (k.Key == ConsoleKey.NumPad1 || k.Key == ConsoleKey.D1)
            {
                var mmsg = admin.CreateUsersDA(user);
                Console.WriteLine(mmsg);
                Console.Clear();
                excute.HeaderInfo();
                CreateUsersCLI();
            }
        }