📄 createaccount.aspx.cs
字号:
using BookShop.Model;
using BookShop.BLL;
using BookShop.Web.Controls;
//using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace BookShop.Web {
public class CreateAccount : Page {
// Assume a duplicate record is the reason for the error
private const string MSG_FAILURE = "用户名已存在!请重试.";
protected TextBox txtUserId;
protected TextBox txtPassword;
protected TextBox txtEmail;
protected RequiredFieldValidator valUserId;
protected AddressUI addr;
protected NavBar header;
protected System.Web.UI.WebControls.RequiredFieldValidator valPassword;
protected System.Web.UI.WebControls.RequiredFieldValidator valEmail;
protected System.Web.UI.WebControls.ImageButton btnSubmit;
protected System.Web.UI.HtmlControls.HtmlForm frmCreateAcct;
protected Preferences prefs;
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;
}
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -