您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->酒店管理系统(三层开发)源码>>WebSite_hotel/SelectRoomInfo.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:文件类型 ThreeLayerHotel/WebSite_hotel/SelectRoomInfo.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections; 3using System.Configuration; 4using System.Data; 5using System.Linq; 6using System.Web; 7using System.Web.Security; 8using System.Web.UI; 9using System.Web.UI.HtmlControls; 10using System.Web.UI.WebControls; 11using System.Web.UI.WebControls.WebParts; 12using System.Xml.Linq; 13using BLL; 14using Entity; 15 16public partial class SelectRoom : 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 if (!string.IsNullOrEmpty(Request.QueryString["TypeName"])) 27 { 28 MultiView4.ActiveViewIndex = 1; 29 Bind2(); 30 } 31 else 32 { 33 MultiView4.ActiveViewIndex = 0; 34 Bind(); 35 } 36 if (Session["Status"].ToString() == "普通用户") 37 { 38 GridView1.Columns[7].Visible = false; 39 GridView1.Columns[8].Visible = false; 40 GridView2.Columns[7].Visible = false; 41 GridView2.Columns[8].Visible = false; 42 GridView1.Columns[9].Visible = true; 43 GridView2.Columns[9].Visible = true; 44 } 45 else 46 { 47 GridView1.Columns[9].Visible = false; 48 GridView2.Columns[9].Visible = false; 49 } 50 } 51 } 52 53 54 55 protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e) 56 { 57 58 } 59 /// <summary> 60 /// 查询所有 61 /// </summary> 62 void Bind() 63 { 64 DataTable dt = RoomBLL.GetRoomByFilter(); 65 GridView1.DataSource = dt; 66 GridView1.DataBind(); 67 } 68 69 /// <summary> 70 /// 按条件查询 71 /// </summary> 72 void Bind1() 73 { 74 DataTable dt = RoomBLL.GetRoomByFilter(ddl.Text, txtnumber.Text); 75 GridView2.DataSource = dt; 76 GridView2.DataBind(); 77 } 78 79 void Bind2() 80 { 81 string filter = ddl.Text; 82 if (!string.IsNullOrEmpty(Request.QueryString["TypeName"])) 83 { 84 filter = Request.QueryString["TypeName"].ToString(); 85 } 86 DataTable dt = RoomBLL.GetRoomByFilter(filter, txtnumber.Text); 87 GridView2.DataSource = dt; 88 GridView2.DataBind(); 89 } 90 91 protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e) 92 { 93 string RoomID = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); 94 if (Session["Status"].ToString() == "普通用户") 95 { 96 Response.Redirect("BookOnLine.aspx?RoomID=" + RoomID); 97 } 98 else 99 { 100 string State = RoomBLL.GetStateByRoomID(Convert.ToInt32(RoomID)); 101 if (State == "入住" || State == "已预订") 102 { 103 Session["flag"] = "该房间以有人住或已预订,不能编辑..."; 104 Response.Redirect("success.aspx"); 105 } 106 else 107 { 108 Response.Redirect("UpdateRoomInfo.aspx?RoomID=" + RoomID); 109 } // get 110 //Server.Transfer("") // post 111 } 112 } 113 114 protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) 115 { 116 string RoomID = GridView2.DataKeys[GridView2.SelectedIndex].Value.ToString(); 117 if (Session["Status"].ToString() == "普通用户") 118 { 119 Response.Redirect("BookOnLine.aspx?RoomID=" + RoomID); 120 } 121 else 122 { 123 string State = RoomBLL.GetStateByRoomID(Convert.ToInt32(RoomID)); 124 if (State == "入住" || State == "已预订") 125 { 126 Session["flag"] = "该房间以有人住或已预订,不能编辑..."; 127 Response.Redirect("success.aspx"); 128 } 129 else 130 { 131 Response.Redirect("UpdateRoomInfo.aspx?RoomID=" + RoomID); 132 } 133 } 134 } 135 protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) 136 { 137 GridView2.PageIndex = e.NewPageIndex; 138 Bind1(); 139 } 140 141 protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) 142 { 143 144 int RoomID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); 145 Del(RoomID); 146 } 147 protected void GridView1_PageIndexChanging1(object sender, GridViewPageEventArgs e) 148 { 149 GridView1.PageIndex = e.NewPageIndex; 150 Bind(); 151 } 152 153 void Del(int RoomID) 154 { 155 string State = RoomBLL.GetStateByRoomID(RoomID); 156 if (State == "入住" || State == "已预订") 157 { 158 Session["flag"] = "该房间已有人住或已预订,不能删除..."; 159 Response.Redirect("success.aspx"); 160 } 161 else 162 { 163 RoomEntity RE = new RoomEntity(); 164 RE.RoomID = RoomID; 165 if (RoomBLL.DeleteRoom(RE) != 1) 166 { 167 168 } 169 else 170 { 171 if (MultiView4.ActiveViewIndex == 0) 172 Bind(); 173 else 174 Bind1(); 175 } 176 } 177 } 178 179 protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e) 180 { 181 int RoomID = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Value); 182 Del(RoomID); 183 } 184 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 185 { 186 if (e.Row.RowType == DataControlRowType.DataRow) 187 { 188 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 189 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 190 } 191 } 192 protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) 193 { 194 if (e.Row.RowType == DataControlRowType.DataRow) 195 { 196 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 197 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 198 } 199 } 200 protected void LinkButton13_Click(object sender, EventArgs e) 201 { 202 MultiView4.ActiveViewIndex = 1; 203 Bind1(); 204 } 205 protected void LinkButton14_Click(object sender, EventArgs e) 206 { 207 MultiView4.ActiveViewIndex = 0; 208 Bind(); 209 } 210} 211
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:酒店管理系统(三层开发)源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号