ginBtn_Click(object sender,ImageClickEventArgs e)
{
if (UserName.Text == null || UserName.Text == "" || UserName.Text.Length <= 0)
{
ShowMessage("用户名称为空,请输入用户名称!");
return;
}
if (Password.Text == null || Password.Text == "" || Password.Text.Length <= 0)
{
ShowMessage("用户密码为空,请输入用户密码!");
return;
}
String userId = "";
String roleId = "";
///定义类并获取用户的登陆信息
BookShop.User user = new User();
SqlDataReader recu = user.GetUserLogin(UserName.Text.Trim(),
BookShop.User.Encrypt(Password.Text.Trim()));
///判断用户是否合法
if (recu.Read())
{
userId = recu["UserID"].ToString();
roleId = recu["RoleID"].ToString();
}
recu.Close();
///验证用户合法性,并跳转到系统平台
if ((userId != null) && (userId != ""))
{
Session["UserID"] = userId;
Session["UserName"] = UserName.Text;
if (roleId != "")
{
Session["RoleID"] = roleId;
}
//跳转到登录后的第一个页面
Response.Redirect("~/UserControls/UserLoginPage.aspx");
}
else
{
///显示错误信息
ShowMessage("你输入的用户名称/密码有误,请重新输入!");
}
}
书籍信息:
主要功能实现代码:
public int AddBook(string sName,int nCategoryID,string sDesn,string sAuthor,
string sPublish,DateTime dPublishDate,string sISBN,string sForeword,string sList,
string sOutLine,DateTime dBuyInDate,decimal dPrice,int nTotalNum,
string sAttribute1,string sAttribute2,string sAttribute3,
string sAttribute4,string sAttribute5,stri