private void BindData() { zs.BLL.Tbl_User bll = new zs.BLL.Tbl_User(); this.Repeater1.DataSource = bll.GetAllList(); this.Repeater1.DataBind(); createData(); }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "delete") { zs.BLL.Tbl_User bll = new zs.BLL.Tbl_User(); bll.Delete(int.Parse(e.CommandArgument.ToString())); BindData(); } }
protected void btn_Login_Click(object sender, EventArgs e) { zs.BLL.Tbl_User blluser = new zs.BLL.Tbl_User(); string userName = CheckInput(this.tb_userName.Text.Trim()); string userPSW = CheckInput(this.tb_password.Text.Trim()); if (blluser.Exists(userName)) { //存在用户名 if (blluser.GetModel(userName).userPsw == ApplicationMethod.encript(userPSW)) { //密码正确 Response.Cookies["userId"].Value = blluser.GetModel(userName).id.ToString(); Response.Cookies["userName"].Value = blluser.GetModel(userName).userName; Response.Redirect("./Default.aspx"); } else {//密码错误 ClientScript.RegisterClientScriptBlock(this.GetType(), "showPError", "<script>alert('用户名密码不正确,请确认!')</script>"); } } else {//用户名不存在 ClientScript.RegisterClientScriptBlock(this.GetType(), "showUError", "<script>alert('用户名密码不正确,请确认!')</script>"); } }