static void Main(string[] args)
 {
     while (true)
     {
         IDataHandling  DataReader        = new DatabaseAccess();
         SignInRegister Screen            = new SignInRegister(DataReader);
         User           OnlineUser        = Screen.SignInOrRegister(DataReader);
         MainMenu       MainMenuSelection = new MainMenu(DataReader, OnlineUser);
         MainMenuSelection.ShowMenu();
     }
 }
예제 #2
0
 public ManageUser(IDataHandling dataprovider)
 {
     DataProvider = dataprovider;
     Create       = new SignInRegister(DataProvider);
     file         = new FileStorage();
 }
        public void ShowMenu()
        {
            if (ActiveUser != null)
            {
                MessageActions View        = new MessageActions(DataProvider, ActiveUser);
                SignInRegister InitialMenu = new SignInRegister(DataProvider);
                SpecificMenu   MenuActions = new SpecificMenu(DataProvider, ActiveUser);
                while (true)
                {
                    string selecteditem = string.Empty;

                    switch (ActiveUser.UserAccess)
                    {
                    case Role.visitor:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Create Message", "Inbox", "View Sent", "Log Out", "Exit"
                        });
                        break;

                    case Role.user:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Create Message", "Inbox", "View Sent", "Edit Message", "Delete Message", "Log Out", "Exit"
                        });
                        break;

                    case Role.moderator:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Messages", "Log Out", "Exit"
                        });
                        break;

                    case Role.administrator:
                        selecteditem = MenuStyle.Vertical(new List <string> {
                            "Manage Users", "Messages", "Log Out", "Exit"
                        });
                        break;
                    }
                    switch (selecteditem)
                    {
                    case "Manage Users":
                        MenuActions.ManageUserMenu();
                        break;

                    case "Messages":
                        MenuActions.MessagesMenu();
                        break;

                    case "Create Message":
                        View.CreateMessage();
                        break;

                    case "Inbox":
                        View.ShowReceivedMessages();
                        break;

                    case "View Sent":
                        View.ShowSentMessages();
                        break;

                    case "Edit Message":
                        View.UpdateMessage();
                        break;

                    case "Delete Message":
                        View.DeleteMessage();
                        break;

                    case "Log Out":
                        return;

                    case "Exit":
                        Console.WriteLine("\tThank you for watching");
                        Thread.Sleep(1600);
                        Environment.Exit(0);
                        break;
                    }
                }
            }
        }