您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->酒店管理系统(三层开发)源码>>WebSite_hotel/SelectRoomType.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:文件类型 ThreeLayerHotel/WebSite_hotel/SelectRoomType.aspx.cs打开代码结构图
普通视图
		            
1 2using System; 3using System.Collections; 4using System.Configuration; 5using System.Data; 6using System.Linq; 7using System.Web; 8using System.Web.Security; 9using System.Web.UI; 10using System.Web.UI.HtmlControls; 11using System.Web.UI.WebControls; 12using System.Web.UI.WebControls.WebParts; 13using System.Xml.Linq; 14using BLL; 15using Entity; 16 17public partial class SelectRoomType : System.Web.UI.Page 18{ 19 20 protected void Page_Load(object sender, EventArgs e) 21 { 22 if (!IsPostBack) 23 { 24 if (Session["Name"] == null) 25 { 26 Response.Redirect("Index.aspx"); 27 } 28 29 if (Session["Status"].ToString() == "普通用户") 30 { 31 GridView1.Columns[5].Visible = false; 32 GridView1.Columns[6].Visible = false; 33 GridView2.Columns[5].Visible = false; 34 GridView2.Columns[6].Visible = false; 35 GridView1.Columns[7].Visible = true; 36 GridView2.Columns[7].Visible = true; 37 } 38 else 39 { 40 GridView1.Columns[7].Visible = false; 41 GridView2.Columns[7].Visible = false; 42 } 43 MultiView3.ActiveViewIndex = 0; 44 Bind(); 45 } 46 } 47 /// <summary> 48 /// 查询所有 49 /// </summary> 50 void Bind() 51 { 52 DataTable dt = RoomTypeBLL.GetRoomTypeByFilter(); 53 GridView1.DataSource = dt; 54 GridView1.DataBind(); 55 } 56 /// <summary> 57 /// 按条件查询 58 /// </summary> 59 void Bind1() 60 { 61 DataTable dt = RoomTypeBLL.GetRoomTypeByFilter(txtfilter.Text); 62 GridView2.DataSource = dt; 63 GridView2.DataBind(); 64 65 } 66 67 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 68 { 69 string TypeID = GridView1.DataKeys[GridView1.SelectedIndex].Value.ToString(); 70 if (Session["Status"].ToString() == "普通用户") 71 { 72 Response.Redirect("SelectRoomTypeInfo.aspx?TypeID=" + TypeID); 73 } 74 else 75 { 76 Response.Redirect("UpdateRoomType.aspx?TypeID=" + TypeID); 77 } 78 } 79 80 void Del(int TypeID) 81 { 82 if (RoomTypeBLL.GetRoomTypeByRoom_TypeID(TypeID)) 83 { 84 Session["flag"] = "已存在该房间类型的房间,不能删除...要删除请先删除该类型的房间..."; 85 Response.Redirect("success.aspx"); 86 } 87 else 88 { 89 RoomTypeEntity RTE = new RoomTypeEntity(); 90 RTE.TypeID = TypeID; 91 if (RoomTypeBLL.DeleteRoomType(RTE) == 1) 92 { 93 if (MultiView3.ActiveViewIndex == 0) 94 Bind(); 95 else 96 Bind1(); 97 } 98 } 99 } 100 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 101 { 102 GridView1.PageIndex = e.NewPageIndex; 103 Bind(); 104 } 105 protected void GridView1_RowDeleting1(object sender, GridViewDeleteEventArgs e) 106 { 107 int TypeID = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); 108 Del(TypeID); 109 } 110 protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) 111 { 112 string TypeID = GridView2.DataKeys[GridView2.SelectedIndex].Value.ToString(); 113 if (Session["Status"].ToString() == "普通用户") 114 { 115 Response.Redirect("SelectRoomTypeInfo.aspx?TypeID=" + TypeID); 116 } 117 else 118 { 119 Response.Redirect("UpdateRoomType.aspx?TypeID=" + TypeID); 120 } 121 } 122 protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) 123 { 124 GridView2.PageIndex = e.NewPageIndex; 125 Bind1(); 126 } 127 protected void GridView2_RowDeleting(object sender, GridViewDeleteEventArgs e) 128 { 129 int TypeID = Convert.ToInt32(GridView2.DataKeys[e.RowIndex].Value); 130 Del(TypeID); 131 } 132 133 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 134 { 135 if (e.Row.RowType == DataControlRowType.DataRow) 136 { 137 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 138 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 139 } 140 } 141 protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) 142 { 143 if (e.Row.RowType == DataControlRowType.DataRow) 144 { 145 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 146 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 147 } 148 } 149 protected void LinkButton12_Click(object sender, EventArgs e) 150 { 151 MultiView3.ActiveViewIndex = 1; 152 Bind1(); 153 } 154 protected void LinkButton13_Click(object sender, EventArgs e) 155 { 156 MultiView3.ActiveViewIndex = 0; 157 Bind(); 158 } 159} 160
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:酒店管理系统(三层开发)源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号