private void bidata() { ZwEntity.MyUserEntity myUser = (ZwEntity.MyUserEntity)Session["myuser"]; ZwBLL.MyUserBLL userBLL = new ZwBLL.MyUserBLL(); myUser = userBLL.list(myUser.UserId); spanAccount.Text = myUser.UserAccount; txtRealName.Text = myUser.UserRealName; txtPhone.Text = myUser.UserPhone; }
protected void btUpdate_Click(object sender, EventArgs e) { ZwEntity.MyUserEntity myUser = (ZwEntity.MyUserEntity)Session["myuser"]; ZwBLL.MyUserBLL userBLL = new ZwBLL.MyUserBLL(); myUser = userBLL.list(myUser.UserId); myUser.UserRealName = txtRealName.Text; myUser.UserPhone = txtPhone.Text; if (userBLL.Update(myUser) == 1) { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改完成')</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('未知错误!')</script>"); } bidata(); }
private void bindata() { if (string.IsNullOrWhiteSpace(Request["UserId"])) { return; } int id = Convert.ToInt32(Request["UserId"]); ZwBLL.MyUserBLL myUser = new ZwBLL.MyUserBLL(); ZwEntity.MyUserEntity userEntity = myUser.list(id); ViewState["UserPowerList"] = userEntity.UserPowerList; Label1.Text = userEntity.UserAccount; ZwBLL.MyPowerBLL powerBLL = new ZwBLL.MyPowerBLL(); string str = "___"; Repeater1.DataSource = powerBLL.list(str); Repeater1.DataBind(); }
private void bindata() { ZwBLL.MyRoleBLL myRole = new ZwBLL.MyRoleBLL(); ddlRole.DataTextField = "RoleName"; ddlRole.DataValueField = "RoleId"; ddlRole.DataSource = myRole.list(); ddlRole.DataBind(); ddlRole.Items.Insert(0, new ListItem("--请选择--", "0")); ZwBLL.MyUserBLL myUser = new ZwBLL.MyUserBLL(); int id = int.Parse(Request["UserId"]); ZwEntity.MyUserEntity userEntity = new ZwEntity.MyUserEntity(); userEntity = myUser.list(id); ddlRole.SelectedValue = userEntity.RoleId.ToString(); txtAccount.Text = userEntity.UserAccount; txtRealName.Text = userEntity.UserRealName; txtPhone.Text = userEntity.UserPhone; }
protected void btUpdate_Click(object sender, EventArgs e) { ZwEntity.MyUserEntity myUser = (ZwEntity.MyUserEntity)Session["myuser"]; ZwBLL.MyUserBLL userBLL = new ZwBLL.MyUserBLL(); myUser = userBLL.list(myUser.UserId); if (txtOldPwd.Text.Equals(myUser.UserPwd)) { myUser.UserPwd = txtConfirmPwd.Text; if (userBLL.Update(myUser) == 1) { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改完成')</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('未知错误!')</script>"); } } else { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('原始密码不正确!')</script>"); } }
protected void btAdd_Click(object sender, EventArgs e) { ZwBLL.MyUserBLL myUser = new ZwBLL.MyUserBLL(); int id = int.Parse(Request["UserId"]); ZwEntity.MyUserEntity userEntity = myUser.list(id); userEntity.RoleId = Convert.ToInt32(ddlRole.SelectedValue); if (!txtPwd.Text.Equals("")) { userEntity.UserPwd = txtPwd.Text; } userEntity.UserRealName = txtRealName.Text; userEntity.UserPhone = txtPhone.Text; if (myUser.Update(userEntity) == 1) { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('修改成功');window.parent.location.reload();</script>"); } else { ClientScript.RegisterStartupScript(GetType(), "", "<script>alert('未知错误')</script>"); } }
protected override void OnPreInit(EventArgs e) { if (this.Request.Path.Contains("Admin")) { if (this.Request.Path.Contains("Login") || this.Request.Path.Contains("Vesbtext")) { return; } if (Session["myuser"] == null) { returnkd(); } else { if (this.Request.Path.Contains("inc")) { return; } ZwEntity.MyUserEntity myUser = (ZwEntity.MyUserEntity)Session["myuser"]; ZwBLL.MyUserBLL userBLL = new ZwBLL.MyUserBLL(); myUser = userBLL.list(myUser.UserId); string stry = ""; if (!string.IsNullOrWhiteSpace(myUser.UserPowerList)) { stry += myUser.UserPowerList; } if (!string.IsNullOrWhiteSpace(myUser.UserPowerList) && !string.IsNullOrWhiteSpace(myUser.Role.RolePowerList)) { stry += ","; } if (!string.IsNullOrWhiteSpace(myUser.Role.RolePowerList)) { stry += myUser.Role.RolePowerList; } string[] arr = stry.Split(','); if (this.Request.Path.Contains("Book") && !qeix(arr, "002")) { returnkd(); } if (this.Request.Path.Contains("Member") && !qeix(arr, "001")) { returnkd(); } if (this.Request.Path.Contains("Order") && !qeix(arr, "003")) { returnkd(); } if (this.Request.Path.Contains("Self") && !qeix(arr, "998")) { returnkd(); } if (this.Request.Path.Contains("User") && !qeix(arr, "999")) { returnkd(); } if (this.Request.Path.Contains("Role") && !qeix(arr, "999")) { returnkd(); } } return; } if (Session["usr"] == null) { if (Request["web"] != null && Request["web"].Equals("BookSearch")) { return; } if (this.Request.Path.Contains("Myrespson")) { this.Response.Redirect("~/Login.aspx"); } else { this.Response.Redirect("~/Login.aspx?myurl=" + this.Request.Path); } } base.OnPreInit(e); }