温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:
ThreeLayerHotel/WebSite_hotel/UserReception.aspx.cs,打开代码结构图
ThreeLayerHotel/WebSite_hotel/UserReception.aspx.cs,打开代码结构图1using System; 2
using System.Collections; 3
using System.Configuration; 4
using System.Data; 5
using System.Linq; 6
using System.Web; 7
using System.Web.Security; 8
using System.Web.UI; 9
using System.Web.UI.HtmlControls; 10
using System.Web.UI.WebControls; 11
using System.Web.UI.WebControls.WebParts; 12
using System.Xml.Linq; 13
using BLL; 14
using Entity; 15
16
public partial class UserReception : System.Web.UI.Page 17
{ 18
protected void Page_Load(object sender, EventArgs e) 19
{ 20
if (!IsPostBack) 21
{ 22
if (!IsPostBack) 23
{ 24
if (Session["Name"] == null) 25
{ 26
Response.Redirect("Index.aspx"); 27
} 28
} 29
MultiView4.ActiveViewIndex = 0; 30
Bind(); 31
} 32
} 33
34
/// <summary> 35
/// 查询所有 36
/// </summary> 37
void Bind() 38
{ 39
DataTable dt = UserRoomBLL.GetReceptionTable(); 40
GridView1.DataSource = dt; 41
GridView1.DataBind(); 42
} 43
44
/// <summary> 45
/// 条件查询 46
/// </summary> 47
void Bind1() 48
{ 49
if (ddl.Text == "用户ID") 50
{ 51
DataTable dt = UserRoomBLL.GetUserReceptionByUserName(txtfilter.Text); 52
GridView2.DataSource = dt; 53
GridView2.DataBind(); 54
} 55
else 56
{ 57
DataTable dt = UserRoomBLL.GetUserReceptionByName(txtfilter.Text); 58
GridView2.DataSource = dt; 59
GridView2.DataBind(); 60
} 61
} 62
63
void Do(int RoomID) 64
{ 65
DataTable dt = UserRoomBLL.GetUserReceptionStateByRoomID(RoomID); 66
if (dt.Rows[0]["state"].ToString() == "已预订") 67
{ 68
int flag = UserRoomBLL.UpdateUserReceptionStateByRoomID(RoomID); 69
if (flag == 1) 70
{ 71
Session["flag"] = "成功的将用户“" + dt.Rows[0]["username"].ToString() + "”预订的房间“" + dt.Rows[0]["Number"] + "”修改为入住状态"; 72
if (MultiView4.ActiveViewIndex == 0) 73
Bind(); 74
else 75
Bind1(); 76
} 77
} 78
else 79
{ 80
return; 81
} 82
} 83
84
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 85
{ 86
int RoomID = Convert.ToInt32(GridView1.DataKeys[GridView1.SelectedIndex].Value); 87
Do(RoomID); 88
} 89
90
protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) 91
{ 92
int RoomID = Convert.ToInt32(GridView2.DataKeys[GridView2.SelectedIndex].Value); 93
Do(RoomID); 94
} 95
96
protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 97
{ 98
GridView1.PageIndex = e.NewPageIndex; 99
Bind(); 100
} 101
102
103
protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) 104
{ 105
GridView2.PageIndex = e.NewPageIndex; 106
Bind1(); 107
} 108
109
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 110
{ 111
if (e.Row.RowType == DataControlRowType.DataRow) 112
{ 113
e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 114
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 115
} 116
} 117
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) 118
{ 119
if (e.Row.RowType == DataControlRowType.DataRow) 120
{ 121
e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 122
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 123
} 124
} 125
protected void LinkButton12_Click(object sender, EventArgs e) 126
{ 127
MultiView4.ActiveViewIndex = 0; 128
Bind(); 129
} 130
protected void LinkButton11_Click(object sender, EventArgs e) 131
{ 132
MultiView4.ActiveViewIndex = 1; 133
Bind1(); 134
} 135
} 136





}
}