protected void Button1_Click(object sender, EventArgs e) { Model.H_User user = new Model.H_User(); Model.H_Student student = new Model.H_Student(); user.username = this.TextUser.Value.Trim(); user.password = this.TextPwd.Value.Trim(); user.qxid = 4; user.isoccupy = 1; student.username = this.TextUser.Value.Trim(); student.name = this.TextName.Value.Trim(); student.email = this.TextEmail.Value.Trim(); student.telphone = this.TextTel.Value.Trim(); student.zhifubao = this.TextZhifubao.Value.Trim(); student.bank = this.TextBank.Value.Trim(); student.bank_name = this.TextBank_name.Value.Trim(); student.bank_num = this.TextBank_number.Value.Trim(); student.region_province = this.HiddenProvince.Value.ToString(); student.region_city = this.HiddenCity.Value.ToString(); student.region_county = this.HiddenArea.Value.ToString(); if (H_UserClass.Add(user) && H_StudentClass.Add(student)) { JScript.Alert("操作成功", "a2", this); Response.Redirect("AdminLogin.aspx"); } else { JScript.Alert("操作失败", "a2", this); } }
private void InitUserData() { int PageIndex = 1; if (Request.QueryString["page"] != null) { int.TryParse(Request.QueryString["page"].ToString(), out PageIndex); } int PageSize = 10; int TotalCount = 0; string strWhere = "id>1"; if (Request.QueryString["user_name"] != null) { string user_name = HttpUtility.UrlDecode(Request.QueryString["user_name"].ToString(), Encoding.UTF8); strWhere += "and username like'%" + user_name + "%'"; } if (Request.QueryString["qxid"] != null) { string qxid = HttpUtility.UrlDecode(Request.QueryString["qxid"].ToString(), Encoding.UTF8); strWhere += "and qxid=" + qxid + ""; } DataTable dt = H_UserClass.GetList(PageSize, PageIndex, strWhere, out TotalCount); this.Repeater1.DataSource = dt; this.Repeater1.DataBind(); this.LiteralPage.Text = PageClass.BuildPage(PageIndex, TotalCount, PageSize); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["user"] != null && Request.Form["pwd"] != null) { string user = Request.Form["user"].ToString(); string pwd = Request.Form["pwd"].ToString(); DataTable dt = H_UserClass.CheckLogin(user, pwd); if (dt.Rows.Count > 0) { HttpCookie khcookie = new HttpCookie("qx"); //khcookie.Expires = DateTime.Now.AddMinutes(30); khcookie.Values.Add("uid", dt.Rows[0]["id"].ToString()); khcookie.Values.Add("user", HttpUtility.UrlEncode(dt.Rows[0]["username"].ToString(), Encoding.UTF8)); khcookie.Values.Add("qxid", dt.Rows[0]["qxid"].ToString()); khcookie.Values.Add("isoccupy", dt.Rows[0]["isoccupy"].ToString()); Response.Cookies.Add(khcookie); FormsAuthentication.SetAuthCookie(dt.Rows[0]["username"].ToString(), false); //Response.Redirect("Main.aspx"); Response.Write(Tool.CreateJson("登陆成功!", "1")); } else { Response.Write(Tool.CreateJson("密码或账号不正确!", "2")); } } else { Response.Write(Tool.CreateJson("缺少参数!", "3")); } Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.Form["pid"] != null) { string pid = Request.Form["pid"].ToString(); string getName = "select username from H_User where id=" + pid + ""; string username = DbHelperSQL.GetSingle(getName).ToString(); string getSql = "select * from H_OrderView where student_name='" + username + "' or clerk_name='" + username + "' or exam_handler='" + username + "' or pay_stu_handler='" + username + "' or pay_cle_handler='" + username + "'"; DataTable dt = DbHelperSQL.Query(getSql).Tables[0]; if (dt.Rows.Count > 0) { Response.Write(Tool.CreateJson("对不起,该用户还有其他业务", "2")); } else { if (H_UserClass.Delete(pid)) { Response.Write(Tool.CreateJson("操作成功", "1")); } else { Response.Write(Tool.CreateJson("操作失败", "2")); } } } else { Response.Write(Tool.CreateJson("缺少参数", "3")); } Response.End(); }
protected void ButtonSub_Click(object sender, EventArgs e) { string khmc = HttpUtility.UrlDecode(Request.Cookies["qx"].Values["user"].ToString(), Encoding.UTF8); string oldpwd = this.TextOldPwd.Value; if (H_UserClass.CheckLogin(khmc, oldpwd).Rows.Count <= 0) { JScript.Alert("旧密码不正确", "a1", this); return; } if (H_UserClass.ChangePwd(khmc, this.TextNewPwd.Value)) { JScript.Alert("修改成功", "a2", this); } else JScript.Alert("修改失败", "a3", this); }
protected void Button1_Click(object sender, EventArgs e) { Model.H_User user = new Model.H_User(); user.username = this.TextUser.Value.Trim(); user.qxid = int.Parse(this.SelectAuth.Value); user.password = this.TextPwd.Value.Trim(); user.isoccupy = 0; if (H_UserClass.Add(user)) { JScript.AlertAndRedirect("操作成功", "UserList.aspx", this); } else { JScript.Alert("操作失败", "a2", this); } }