温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:
ThreeLayerHotel/WebSite_hotel/UserRegist.aspx.cs,打开代码结构图
ThreeLayerHotel/WebSite_hotel/UserRegist.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using BLL; 12
using Entity; 13
14
public partial class UserRegist : System.Web.UI.Page 15
{ 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
19
} 20
21
protected void LinkButton1_Click(object sender, EventArgs e) 22
{ 23
if (lblmag.Text == "恭喜!可以使用的帐号") 24
{ 25
MultiView1.ActiveViewIndex = 1; 26
lblAddress.Text = txtaddress.Text; 27
lblLoginID.Text = txtloginid.Text; 28
lblName.Text = txtname.Text; 29
lblEmail.Text = txtemail.Text; 30
lblPhone.Text = txtphone.Text; 31
Session["pwd"] = txtloginpwd.Text; 32
} 33
} 34
protected void LinkButton2_Click(object sender, EventArgs e) 35
{ 36
Response.Redirect(Request.UrlReferrer.ToString()); 37
} 38
protected void LinkButton3_Click(object sender, EventArgs e) 39
{ 40
HotelUserEntity HUE = new HotelUserEntity(); 41
HUE.UserName = txtloginid.Text; 42
HUE.Password = Session["pwd"].ToString(); 43
HUE.Address = txtaddress.Text; 44
HUE.Email = txtemail.Text; 45
HUE.Phone = txtphone.Text; 46
HUE.Name = txtname.Text; 47
int flag = HotelUserBLL.AddHotelUser(HUE); 48
if (flag == -1) 49
{ 50
Response.Write("<script language=javascript>alert('SQL语句执行错误,原因:输入的数据有误..');</script>"); 51
} 52
if (flag == -2) 53
{ 54
Response.Write("<script language=javascript>alert('数据库连接错误,原因:数据库未连接或数据库为附加..');</script>"); 55
} 56
if (flag == 1) 57
{ 58
Session["msg"] = "注册成功"; 59
Response.Redirect("index.aspx"); 60
} 61
} 62
63
protected void LinkButton4_Click(object sender, EventArgs e) 64
{ 65
MultiView1.ActiveViewIndex = 0; 66
} 67
protected void txtloginid_TextChanged(object sender, EventArgs e) 68
{ 69
if (HotelUserBLL.GetCountUserName(txtloginid.Text) == 0) 70
lblmag.Text = "恭喜!可以使用的帐号"; 71
else 72
lblmag.Text = "该帐号已存在,请重输"; 73
} 74
} 75





}
}