コード例 #1
0
 /// <summary>
 ///  This is an alternate constructor that does the same thing. It is just to make order matter a little less.!-- Same function, could add more if scaling makes it necessary.
 /// </summary>
 public EmployeeManager(Person MyCurrentUser, PersonManager MyPersonManager, StoreManager MyStoreManager, OrderManager MyOrderManager)
 {
     this.MyPersonManager = MyPersonManager;
     this.MyStoreManager  = MyStoreManager;
     this.MyOrderManager  = MyOrderManager;
     this.MyCurrentUser   = MyCurrentUser;
     MyNewUserInput       = new MakeNewUser(MyPersonManager, MyStoreManager);
 }
コード例 #2
0
        public void EditAccountDetails()
        {
            Console.Clear();
            Console.WriteLine("You have been redirected to ACCOUNT_DETAILS");
            Console.WriteLine();
            Console.WriteLine($"User = {CurrentUser.GetName()}, Location = {CurrentUser.GetLocation()}");
            Console.WriteLine();
            Console.WriteLine("What would you like to do?");
            List <string> Options = new List <string> {
                "Change Username", "Change Location", "Change Password"
            };

            for (int i = 0; i < Options.Count; i++)
            {
                Console.WriteLine($"{i+1}. {Options[i]}");
            }
            Console.WriteLine($"Enter 'B' or '0' to go back to Main Menu.");
            var  MyInputCollector = new InputCollector();
            int  input            = 0;
            bool GoodNumber       = false;

            while (!GoodNumber)
            {
                input = MyInputCollector.GetNumber();
                if (!(input < 0 || input > Options.Count))
                {
                    GoodNumber = true;
                }
                if (GoodNumber == false)
                {
                    Console.WriteLine("That number is not on the list!");
                }
            }
            if (input == 0)
            {
                return;
            }
            else if (input == 1)
            {
                var    NewUserName = new MakeNewUser(this, MyStoreManager);
                string x           = NewUserName.GetDesiredUsername();
                CurrentUser.SetName(x);
                Console.WriteLine($"Username changed to {x}");
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();
                EditAccountDetails();
            }
            else if (input == 2)
            {
                var    NewUserName = new MakeNewUser(this, MyStoreManager);
                string x           = NewUserName.GetDesiredLocation();
                CurrentUser.SetLocation(x);
                Console.WriteLine($"Location changed to {x}");
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();
                EditAccountDetails();
            }
            else if (input == 3)
            {
                var    NewUserName = new MakeNewUser(this, MyStoreManager);
                string x           = NewUserName.GetDesiredPassword();
                CurrentUser.SetPassword(x);
                x = NewUserName.GetStarredPassword(x);
                Console.WriteLine($"Password changed. {x}");
                Console.WriteLine("Press enter to continue.");
                Console.ReadLine();
                EditAccountDetails();
            }
            return;
        }