protected void SubmitClicked(object sender, ImageClickEventArgs e) { if (Page.IsValid) { string userId = WebComponents.CleanString.InputText(txtUserId.Text, 50); string password = WebComponents.CleanString.InputText(txtPassword.Text, 50); string email = WebComponents.CleanString.InputText(txtEmail.Text, 50); AddressInfo address = addr.Address; string language = prefs.Language; string favCategory = prefs.Category; bool showFavorites = prefs.IsShowFavorites; bool showBanners = prefs.IsShowBanners; // Store all the customers information in an account business entity AccountInfo accountInfo = new AccountInfo(userId, password, email, address, language, favCategory, showFavorites, showBanners); ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); if (!accountController.CreateAccount(accountInfo)){ // Tell the user they have failed to create an account valUserId.ErrorMessage = MSG_FAILURE; valUserId.IsValid = false; } } }
protected override void OnLoad(EventArgs e) { // Create an instance of the account controller ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); // Tell the controller that the user is logging out accountController.LogOut(); }
protected override void OnLoad(EventArgs e) { if (!IsPostBack){ enterAddress.Visible = true; confirmAddress.Visible = false; ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); AccountInfo myAccount = accountController.GetAccountInfo(true); if (myAccount != null){ Account account = new Account(); billAddr.Address = account.GetAddress(myAccount.UserId); } } }
protected override void OnLoad(EventArgs e) { if (!IsPostBack) { ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); // Retrieve the account information from the account controller AccountInfo myAccount = accountController.GetAccountInfo(true); lblUserId.Text = myAccount.UserId; txtEmail.Text = myAccount.Email; addr.Address = myAccount.Address; prefs.Language = myAccount.Language; prefs.Category = myAccount.Category; prefs.IsShowBanners = myAccount.IsShowBanners; prefs.IsShowFavorites = myAccount.IsShowFavorites; } }
protected void SubmitClicked(object sender, ImageClickEventArgs e) { if (Page.IsValid) { ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); // Retrieve the account information from the account controller AccountInfo myAccount = accountController.GetAccountInfo(true); // Merge in the changes string email = WebComponents.CleanString.InputText(txtEmail.Text, 50); AddressInfo address = addr.Address; string language = prefs.Language; string favCategory = prefs.Category; bool showFavorites = prefs.IsShowFavorites; bool showBanners = prefs.IsShowBanners; AccountInfo updatedAccountInfo = new AccountInfo(myAccount.UserId, myAccount.Password, email, address, language, favCategory, showFavorites, showBanners); // Submit the changes back to the controller accountController.UpdateAccount(updatedAccountInfo); } }
override protected void OnLoad(EventArgs e) { // Create an instance of the cart controller ProcessFlow.CartController cartController = new ProcessFlow.CartController(); myCart = cartController.GetCart(true); if (!Page.IsPostBack) { // Get the itemdId from the query string string itemId = Request["itemId"]; if (itemId != null) { // Clean the input string itemId = WebComponents.CleanString.InputText(itemId, 50); myCart.Add(itemId); cartController.StoreCart(myCart); } } //Get an account controller ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); //Get the user's favourite category string favCategory = accountController.GetFavouriteCategory(); //If we have a favourite category, render the favourites list if (favCategory != null) { favorites.Visible = true; ViewState[KEY_CATEGORY] = favCategory; } Refresh(); }
protected override void OnLoad(EventArgs e) { // Create an instance of the cart controller ProcessFlow.CartController cartController = new ProcessFlow.CartController(); myCart = cartController.GetCart(true); if (!Page.IsPostBack){ // Get the itemdId from the query string string itemId = Request["itemId"]; if (itemId != null){ // Clean the input string itemId = WebComponents.CleanString.InputText(itemId, 50); myCart.Add(itemId); cartController.StoreCart(myCart); } } //Get an account controller ProcessFlow.AccountController accountController = new ProcessFlow.AccountController(); //Get the user's favourite category string favCategory = accountController.GetFavouriteCategory(); //If we have a favourite category, render the favourites list if (favCategory != null){ favorites.Visible = true; ViewState[KEY_CATEGORY] = favCategory; } Refresh(); }