温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:
ThreeLayerHotel/WebSite_hotel/UpdateRoomInfo.aspx.cs,打开代码结构图
ThreeLayerHotel/WebSite_hotel/UpdateRoomInfo.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 UpdateRoomInfo : System.Web.UI.Page 17
{ 18
protected void Page_Load(object sender, EventArgs e) 19
{ 20
if (!IsPostBack) 21
{ 22
if (Session["Name"] == null) 23
{ 24
Response.Redirect("Index.aspx"); 25
} 26
Label7.Text = Request.UrlReferrer.ToString(); 27
Bind(); 28
29
30
} 31
} 32
33
void Bind() 34
{ 35
36
if (!string.IsNullOrEmpty(Request.QueryString["RoomID"].ToString())) 37
{ 38
int RoomID = Convert.ToInt32(Request.QueryString["RoomID"]); 39
RoomEntity RE = RoomBLL.GetRoomByRoomID(RoomID); 40
lblroomnumber.Text = RE.Number; 41
txtbednumber.Text = RE.BedNumber.ToString(); 42
txtdescription.Text = RE.Description; 43
txtguestnumber.Text = RE.GuestNumber.ToString(); 44
DropDownList1.Text = RE.TypeName.ToString(); 45
DropDownList2.Text = RE.State; 46
47
48
} 49
} 50
51
protected void LinkButton11_Click(object sender, EventArgs e) 52
{ 53
string TypeName = DropDownList1.Text; 54
55
RoomEntity RE = new RoomEntity(); 56
RE.BedNumber = Convert.ToInt32(txtbednumber.Text); 57
RE.GuestNumber = Convert.ToInt32(txtguestnumber.Text); 58
//调用方法获得TypeID 59
RE.TypeID = RoomTypeBLL.GetTypeIDByTypeName(TypeName); ; 60
RE.Description = txtdescription.Text; 61
RE.Number = lblroomnumber.Text; 62
RE.State = DropDownList2.Text; 63
RE.RoomID = Convert.ToInt32(Request.QueryString["RoomID"]); 64
65
int flag = RoomBLL.UpdateRoomByNumber(RE); 66
if (flag == 1) 67
{ 68
Session["flag"] = "成功修改房间 :" + RE.Number + "的信息"; 69
Response.Redirect("Success.aspx"); 70
} 71
else 72
{ 73
Response.Redirect("Lost.aspx"); 74
} 75
} 76
protected void LinkButton12_Click(object sender, EventArgs e) 77
{ 78
Response.Redirect(Label7.Text); 79
} 80
} 81





}
}