// Method to handle user login validation, obtain user // information, and redirect client following login attempt. protected void EquipCheckLoginCtrl_Authenticate(object sender, AuthenticateEventArgs e) { EquipCheckAppUser user = new EquipCheckAppUser(); user.Username = EquipCheckLoginCtrl.UserName; user.Password = EquipCheckLoginCtrl.Password; UserManager userMgr = new UserManager(); EquipCheckAppUser userAtServer = userMgr.RetrieveUser(user); if (userAtServer != null) { e.Authenticated = true; EquipCheckAppUser userLocal = userMgr.RetrieveLocalUser(userAtServer); if (userLocal == null) { userLocal = userMgr.CreateUser(userAtServer); userLocal = ListCreation.CreateLists(userLocal); } // Get user's checklists CheckListManager checkListManager = new CheckListManager(); List <CheckList> checkLists = checkListManager.RetrieveCheckLists(userLocal); List <String> checkListNames = checkListManager.getCheckListNames(checkLists); userLocal.AllCheckList = checkLists; userLocal.AllCheckListNames = checkListNames; // Get user's equipment lists EquipListManager equipListManager = new EquipListManager(); List <EquipmentList> equipLists = equipListManager.RetrieveEquipLists(userLocal); if (equipLists == null || equipLists.Count == 0) { userLocal = ListCreation.CreateLists(userLocal); } else { List <String> equipListNames = equipListManager.getEquipmentListNames(equipLists); userLocal.AllEquipLists = equipLists; userLocal.AllEquipListNames = equipListNames; } Session["user"] = userLocal; Response.Redirect("/Restricted/Welcome.aspx"); } else { e.Authenticated = false; Session["user"] = null; Session["message_type"] = "login_error"; Session["message"] = "Login Error."; Session["details"] = "User Credentials Invalid."; Response.Redirect("/Restricted/Message.aspx"); } }
static void Main() { // Variable for true false used incase user wants to continue the program. bool exit = false; // Reads the order at the start of the program. Will notify user immediately if there is an error in their pricing. ListCreation.ReadOrder(); do { // Switch that uses goes to menu options and uses the user's choice. switch (StandardMessages.Menu()) { case "yes": { // "" is for cleaning up apperance and then the program records the user's text file into a list for use in calculation. Console.WriteLine(""); // Validates whether the user entered the products correctly or with a proper amount. ProductListAndValidation.PurchaseValidation(); break; } case "no": { // Exit's the program if the user says no. exit = true; break; } } } while (exit == false); }
// Method to initialize a new user account protected void CreateUserWizard_CreatedUser(object sender, EventArgs e) { EquipCheckAppUser userAtServer = (EquipCheckAppUser)Session["user"]; UserManager userManager = new UserManager(); userAtServer = userManager.RetrieveUser(userAtServer); Roles.AddUserToRole(userAtServer.Username, "Members"); EquipCheckAppUser userLocal = null; if (userAtServer != null) { userLocal = userManager.CreateUser(userAtServer); } if (userLocal != null) { userLocal = ListCreation.CreateLists(userLocal); } }
static void Main() { bool exit = false; bool adminExit = false; // Here we call our list creation to create all our list from files we have saved in our bin // Then we show the user a welcome screen // Finally the program goes to player creation and asks the user if they want to create or load a player. #region Startup ListCreation.FromReader(); Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Welcome to The Kingdom Of Old Renown!"); //ToDo better welcome screeen! Console.ForegroundColor = ConsoleColor.White; while (adminExit == false) { Console.WriteLine("Are you a Player or Admin (type 'Quit' to quit program)"); Console.Write("> "); string choice = Console.ReadLine().ToLower(); if (choice == "admin") { DungeonCrawlerForms.Program.Main(); } else if (choice == "player") { adminExit = true; } else if (choice == "quit") { Environment.Exit(1); } else { Console.WriteLine("Not an Option!"); } } Player player = NewOrOldPlayer.PlayerCreateOrLoad(); //Todo Delete old player profiles #endregion Startup // Here the game gives the user starting options along with where they are located and what direction they would want to move. #region Game Starts Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Type 'Menu' to see the Menu\n"); Console.WriteLine("Type 'Quit' to quit the game\n"); Console.ForegroundColor = ConsoleColor.White; #endregion Game Starts //The player is displayed exits points. They have access to either quit, go to the menu, or make a decision. #region Player Decision do { ShowExitLocations.DisplayExits(player); // Displays exits for user Console.Write("\nPlease enter what you would like to do: > "); string input = Console.ReadLine().ToLower(); Console.WriteLine(""); if (input == "quit") { exit = true; } else { ActionCommand.PlayerChoice(input, player); // Moves players location } } while (exit == false); #endregion Player Decision }
private void Awake() { main = this; }