您目前尚未登陆,请选择【登陆】或【注册
首页->行政办公->酒店管理系统(三层开发)源码>>WebSite_hotel/UserRecord.aspx.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(三层开发)源码
当前文件:文件类型 ThreeLayerHotel/WebSite_hotel/UserRecord.aspx.cs打开代码结构图
普通视图
		            
1using System; 2using System.Collections.Generic; 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 UserRecord : 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 MultiView5.ActiveViewIndex = 0; 27 MultiView4.ActiveViewIndex = 0; 28 Bind(); 29 } 30 } 31 32 /// <summary> 33 /// 查询所有 34 /// </summary> 35 void Bind() 36 { 37 List<HotelUserEntity> HUE = HotelUserBLL.GetHotelUser(); 38 GridView1.DataSource = HUE; 39 GridView1.DataBind(); 40 } 41 42 /// <summary> 43 /// 条件查询 44 /// </summary> 45 void Bind1() 46 { 47 if (ddl.Text == "用户ID") 48 { 49 DataTable dt = HotelUserBLL.GetHotelUserByUserName(txtfilter.Text); 50 MultiView4.ActiveViewIndex = 1; 51 GridView2.DataSource = dt; 52 GridView2.DataBind(); 53 } 54 else 55 { 56 DataTable dt = HotelUserBLL.GetHotelUserByName(txtfilter.Text); 57 MultiView4.ActiveViewIndex = 1; 58 GridView2.DataSource = dt; 59 GridView2.DataBind(); 60 } 61 } 62 void Show(int UserID) 63 { 64 DataTable dt = HotelUserBLL.GetHotelUserByUserID(UserID); 65 lbladdress.Text = dt.Rows[0]["Address"].ToString(); 66 lblemail.Text = dt.Rows[0]["Email"].ToString(); 67 lblname.Text = dt.Rows[0]["Name"].ToString(); 68 lblphone.Text = dt.Rows[0]["Phone"].ToString(); 69 if (Convert.ToInt32(dt.Rows[0]["Status"]) == 0) 70 { 71 lblstatus.Text = "普通用户"; 72 ddl2.Text = "普通用户"; 73 } 74 else 75 { 76 lblstatus.Text = "管理员"; 77 ddl2.Text = "管理员"; 78 } 79 lbluserid.Text = dt.Rows[0]["UserID"].ToString(); 80 lblusername.Text = dt.Rows[0]["UserName"].ToString(); 81 } 82 protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e) 83 { 84 GridView1.PageIndex = e.NewPageIndex; 85 Bind(); 86 } 87 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 88 { 89 MultiView5.ActiveViewIndex = 1; 90 int UserID = Convert.ToInt32(GridView1.DataKeys[GridView1.SelectedIndex].Value); 91 Show(UserID); 92 } 93 protected void GridView2_PageIndexChanging(object sender, GridViewPageEventArgs e) 94 { 95 GridView2.PageIndex = e.NewPageIndex; 96 Bind1(); 97 } 98 protected void GridView2_SelectedIndexChanged(object sender, EventArgs e) 99 { 100 MultiView5.ActiveViewIndex = 1; 101 int UserID = Convert.ToInt32(GridView2.DataKeys[GridView2.SelectedIndex].Value); 102 Show(UserID); 103 } 104 protected void LinkButton5_Click(object sender, EventArgs e) 105 { 106 107 if (lblstatus.Text != ddl2.Text) 108 { 109 int Status = 0; 110 if(ddl2.Text == "管理员") 111 Status = 1; 112 int flag = HotelUserBLL.UpdateStatusByUserName(Status, lblusername.Text,Session["Name"].ToString()); 113 if (flag == 1) 114 { 115 116 Session["flag"] = "成功的将用户 " + lblusername.Text + " 的身份由“" + lblstatus.Text + "”修改成“" + ddl2.Text + ""; 117 Response.Redirect("success.aspx"); 118 lblstatus.Text = ddl2.Text; 119 } 120 else if (flag == 0) 121 { 122 Label7.Visible = true; 123 Label7.Text = "修改失败,不能修改自己的身份..."; 124 ddl2.Text = lblstatus.Text; 125 } 126 else 127 {} 128 } 129 else 130 { 131 MultiView5.ActiveViewIndex = 0; 132 } 133 } 134 protected void LinkButton6_Click(object sender, EventArgs e) 135 { 136 MultiView5.ActiveViewIndex = 0; 137 } 138 139 protected void LinkButton7_Click(object sender, EventArgs e) 140 { 141 int flag = HotelUserBLL.DeleteHotelUserByUserID(Convert.ToInt32(lbluserid.Text)); 142 if (flag == 1) 143 { 144 Session["flag"] = "成功删除账号为:"+lblusername.Text+" 的用户!"; 145 Response.Redirect("success.aspx"); 146 MultiView5.ActiveViewIndex = 0; 147 if (MultiView4.ActiveViewIndex == 0) 148 Bind(); 149 else 150 Bind1(); 151 } 152 else if (flag == 0) 153 { 154 Label7.Visible = true; 155 if (lblstatus.Text == "管理员") 156 { 157 Label7.Text = "删除失败,不能删除管理员的账号..."; 158 } 159 else 160 Label7.Text = "删除失败,该用户已入住或已预订房间..."; 161 } 162 else 163 { } 164 } 165 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 166 { 167 if (e.Row.RowType == DataControlRowType.DataRow) 168 { 169 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 170 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 171 } 172 } 173 protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e) 174 { 175 if (e.Row.RowType == DataControlRowType.DataRow) 176 { 177 e.Row.Attributes.Add("onmouseover", "current=this.style.backgroundColor;this.style.backgroundColor='#6699ff'"); 178 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=current"); 179 } 180 } 181 protected void LinkButton11_Click(object sender, EventArgs e) 182 { 183 Bind1(); 184 } 185 protected void LinkButton12_Click(object sender, EventArgs e) 186 { 187 MultiView5.ActiveViewIndex = 0; 188 MultiView4.ActiveViewIndex = 0; 189 Bind(); 190 } 191 protected void Timer1_Tick(object sender, EventArgs e) 192 { 193 Label7.Visible = false; 194 } 195} 196
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:酒店管理系统(三层开发)源码
51Aspx.com 版权所有 CopyRight © 2000-2008. 京ICP备06046876号