Beispiel #1
0
        public void Login()
        {
            Console.Write("Please enter login:"******"Please enter password:"******"Incorrect credentials");
            }
        }
Beispiel #2
0
        public void Display(int button)
        {
            bool ifAvailableChoise = false;

            foreach (var item in actions)
            {
                if (item.button == button && item.ifEnabled)
                {
                    ifAvailableChoise = true;
                    break;
                }
            }

            if (!ifAvailableChoise)
            {
                Console.WriteLine("You made incorrect choice");
            }
            else
            {
                switch (button)
                {
                case 15:
                    SessionStatus = SessionStatus.notActive;
                    break;

                case 1:
                    Login();
                    break;

                case 2:
                    visitor._visitorType = Visitor.VisitorType.guest;
                    ActionVisibilityChanger.ActionChanger(actions, visitor);
                    break;

                case 3:
                    DisplayProducts();
                    break;

                case 4:
                    DisplayProductSearch();
                    break;

                case 5:
                    Registration();
                    break;

                case 6:
                    Shopping();
                    break;

                case 7:
                    SeeOrderHistory();
                    break;

                case 8:
                    OrderStatusUpdate();
                    break;

                case 9:
                    UserDataChangeByUser();
                    break;

                //case 10:
                //    OrderStatusUpdate();
                //    break;

                case 11:
                    UserDataChangeByAdmin();
                    break;

                case 12:
                    ProductAdd();
                    break;

                case 13:
                    ProductDataChange();
                    break;

                default:
                    Console.WriteLine("How did you get here?");
                    break;
                }
            }
        }
Beispiel #3
0
        void UserDataChangeByUser()
        {
            Console.WriteLine("Do you wish to update you profile Y/N? ");
            bool ifUpdate = Console.ReadLine().ToLower() == "y";
            bool logout   = false;

            if (ifUpdate)
            {
                string newName     = "tba";
                string newLogin    = "******";
                string newPassword = "******";

                foreach (var user in userList)
                {
                    if (user.userLogin == visitor.login)
                    {
                        newName     = user.userName;
                        newLogin    = user.userLogin;
                        newPassword = user.userPassword;
                        break;
                    }
                }


                ifUpdate = false;
                Console.WriteLine("Update name Y/N? ");
                ifUpdate = Console.ReadLine().ToLower() == "y";

                if (ifUpdate)
                {
                    Console.Write("Please enter new Name: ");
                    newName = Console.ReadLine();
                    Console.WriteLine("Name updated");
                }

                Console.WriteLine("Update login Y/N? ");
                ifUpdate = Console.ReadLine().ToLower() == "y";

                if (ifUpdate)
                {
                    Console.Write("Please enter new Login: "******"Login updated");
                }

                Console.WriteLine("Update password Y/N? ");
                ifUpdate = Console.ReadLine().ToLower() == "y";

                if (ifUpdate)
                {
                    Console.Write("Please enter new Password: "******"Password updated");
                }

                foreach (var user in userList)
                {
                    if (user.userLogin == visitor.login)
                    {
                        user.userName     = newName;
                        user.userLogin    = newLogin;
                        user.userPassword = newPassword;
                        break;
                    }
                }
            }

            if (logout)
            {
                Console.WriteLine("Please login again");
                visitor._visitorType = Visitor.VisitorType.guest;
                ActionVisibilityChanger.ActionChanger(actions, visitor);
            }
        }