protected void btnSave_Click(object sender, EventArgs e) { string RealName = this.txtRealName.Text; string UserName = this.txtUserName.Text; string Password = FormsAuthentication.HashPasswordForStoringInConfigFile(this.txtPassword.Text, "MD5"); //对密码进行MD5加密 string Gender = Request.Form["gender"].ToString(); string BornDate = this.txtBornDate.Text; string Phone = this.txtPhone.Text; string Address = this.txtAddress.Text; string IDNumber = this.txtIDNumber.Text; int RID = 2008; //int.Parse(this.txtRID.Text); string AddDate = DateTime.Now.ToString(); CHSS.Model.CUser model = new CHSS.Model.CUser(); model.RealName = RealName; model.UserName = UserName; model.Password = Password; model.Gender = Gender; model.BornDate = BornDate; model.Phone = Phone; model.Address = Address; model.IDNumber = IDNumber; model.RID = RID; model.AddDate = AddDate; CHSS.BLL.CUser bll = new CHSS.BLL.CUser(); bll.Add(model); Response.Redirect("Show.aspx?id=" + (bll.GetMaxId() - 1)); }
public void BindData() { DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); if (txtKeyword.Text.Trim() != "") { strWhere.AppendFormat("RealName like '%{0}%' or UserName like '%{0}%' or RoleName like '%{0}%'", txtKeyword.Text.Trim()); } ds = new CHSS.BLL.CUser().GetList(strWhere.ToString()); gridView.DataSource = ds; gridView.DataBind(); }
private void ShowInfo(int UID) { CHSS.BLL.CUser bll = new CHSS.BLL.CUser(); CHSS.Model.CUser model = bll.GetModel(UID); this.UID.Text = model.UID.ToString(); this.txtRealName.Text = model.RealName; this.txtUserName.Text = model.UserName; this.txtPassword.Text = model.Password + " (加密)"; this.txtGender.Text = model.Gender; this.txtBornDate.Text = model.BornDate; this.txtPhone.Text = model.Phone; this.txtAddress.Text = model.Address; this.txtIDNumber.Text = model.IDNumber; //this.txtRID.Text = model.RID.ToString(); }
private void ShowInfo(int UID) { CHSS.BLL.CUser bll = new CHSS.BLL.CUser(); CHSS.Model.CUser model = bll.GetModel(UID); this.UID.Text = model.UID.ToString(); this.RealName.Text = model.RealName; this.UserName.Text = model.UserName; this.Password.Text = model.Password + " (加密)"; this.Gender.Text = model.Gender; this.BornDate.Text = model.BornDate; this.Phone.Text = model.Phone; this.Address.Text = model.Address; this.IDNumber.Text = model.IDNumber; this.RoleName.Text = bll.GetList("UID=" + UID.ToString()).Tables[0].Rows[0]["RoleName"].ToString(); }
protected void submit_Click(object sender, EventArgs e) { //判断验证码,是否正确 String vCode = Request.Form["verifyCode"].ToString(); //非runat=server控件可通过HttpContext.Current.Request.Form["控件名"]获取 if (Request.Cookies.Get("CheckCode").Value != vCode.Trim()) { msg = "验证码输入有误!"; } else { String uName = userName.Text; String pass = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"); //对密码进行MD5加密 String strWhere = "UserName='******'"; DataSet ds = new CHSS.BLL.CUser().GetList(strWhere); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["Password"].Equals(pass)) { Session["userName"] = uName; Session["UID"] = ds.Tables[0].Rows[0]["UID"]; try { DataSet dsOfRole = new CHSS.BLL.CRole().GetList("RID='" + ds.Tables[0].Rows[0]["RID"] + "'"); Session["roleValue"] = dsOfRole.Tables[0].Rows[0]["RoleValue"]; } catch { } Response.Redirect("Index.aspx"); } else { userName.Text = uName; msg = "密码错误,请区分字母大小写!"; } } else { userName.Text = ""; msg = "该用户名不存在,抢注去呗!"; } } Page.DataBind(); }
public void btnSave_Click(object sender, EventArgs e) { int UID = int.Parse(this.UID.Text); string RealName = this.txtRealName.Text; string UserName = this.txtUserName.Text; //string Password = this.txtPassword.Text; string BornDate = this.txtBornDate.Text; string Phone = this.txtPhone.Text; string Address = this.txtAddress.Text; string IDNumber = this.txtIDNumber.Text; //int RID = int.Parse(this.txtRID.Text); string Gender = String.Empty; try { Gender = Request.Form["gender"].ToString(); } catch { Gender = this.txtGender.Text; } if (Request.Params["id"] != null && Request.Params["id"].Trim() != "") { int RequestUID = (Convert.ToInt32(Request.Params["id"])); CHSS.BLL.CUser bll = new CHSS.BLL.CUser(); CHSS.Model.CUser model = bll.GetModel(RequestUID); model.UID = UID; model.RealName = RealName; model.UserName = UserName; //model.Password = Password; model.Gender = Gender; model.BornDate = BornDate; model.Phone = Phone; model.Address = Address; model.IDNumber = IDNumber; //model.RID = RID; bll.Update(model); } Response.Redirect("Show.aspx?id=" + UID); }
protected void submit_Click(object sender, EventArgs e) { CHSS.Model.CUser model = new CHSS.Model.CUser(); model.UserName = username.Text; model.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(password.Text, "MD5"); //对密码进行MD5加密 model.BornDate = birthday.Text; model.Phone = phonenumber.Text; model.Address = address.Text; model.IDNumber = idcard.Text; //----- model.AddDate = DateTime.Now.ToString(); model.RealName = "某某"; model.Gender = Request.Form["gender"].ToString(); model.RID = 2008; CHSS.BLL.CUser bll = new CHSS.BLL.CUser(); bll.Add(model); Response.Redirect("Login.aspx?userName="******"&msg=恭喜注册成功,请登录!"); }
protected void Page_Load(object sender, EventArgs e) { //这段代码是用给前台的ajax验证用户名是否已经存在返回验证结果的 try { String strWhere = "UserName='******'"; DataSet ds = new CHSS.BLL.CUser().GetList(strWhere); if (ds.Tables[0].Rows.Count > 0) { this.Response.Write(1); this.Response.End(); //不加Response.End()的话,返回的ResponseText会包含整个HTML文件的代码 } else { this.Response.Write(0); this.Response.End(); } } catch { } }