protected void btnApply_Click(object sender, EventArgs e) { string corpid = lCorpID.Text.Trim(); if (corpid.Equals("")) { GetAlertMsg("您查询的企业不存在,请输入正确的企业代码。"); return; } using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { PersonDAL personDAL = new PersonDAL(conn); string cpid = personDAL.ApplyCorp(personid, corpid); if (cpid.Equals("")) { //add log //CorpPersonDAL cpDAL = new CorpPersonDAL(conn); //cpDAL.ProcAndLog(cpid, "", (int)CorpPersonProcType.Apply, (int)CorpPersonStatus.Applying); //日志已在上函数包含 GetSuccessMsg("您的申请已提交请等待企业审核审批。","list.aspx"); } else { GetAlertMsg("你已经处于在申请/入职或申请状态,请勿重复申请。"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { PersonDAL personDAL = new PersonDAL(conn); string name = this.txtName_.Text; string birth = this.txtBirth.Text; string hujidi = this.txtHujidi.Text; string people = this.ddlPeople.SelectedValue; string sex = this.ddlSex.SelectedValue; string idnumber = this.txtIDNumber.Text; string mobile = this.txtMobile.Text; string hujitype = this.ddlHujiType.SelectedValue; string family_addr = this.txtFamilyAddr.Text; string family_postcode = this.txtFamilyPostCode.Text; string work_addr = this.txtWorkAddr.Text; string work_postcode = this.txtWorkPostCode.Text; DataRow person = personDAL.GetAPerson(personid); person["realName"] = name; person["Birthday"] = DateTime.Parse(birth); person["Hujidi"] = hujidi; person["People"] = people; person["gendar"] = sex; person["Idnumber"] = idnumber; person["mobile"] = mobile; person["hujitype"] = hujitype; person["family_addr"] = family_addr; person["family_postcode"] = family_postcode; person["work_addr"] = work_addr; person["work_postcode"] = work_postcode; personDAL.Update(person); string from = ViewState["from"].ToString(); if (from.Equals("reg")) { //GetAlertMsg("用户基本信息已更新,注册完成,请使用契合网签系统."); //Response.Redirect("../index.aspx"); GetSuccessMsg("用户基本信息已更新,注册完成,请使用契合网签系统.","../index.aspx",false); } else { GetAlertMsg("用户基本信息已更新"); } } }
private void BindData() { string pid = this._personid; ViewState["personid"] = pid; PersonDAL personDAL = new PersonDAL(_conn); SysResDAL sysResDAL = new SysResDAL(_conn); DataRow pa = personDAL.GetAPerson(pid); if (null == pa) return; this.lRealName.Text = Functions.CleanDBString(pa["realname"]); this.lBirthday.Text = Functions.GetShortDateStringFromNullableDateTime(Functions.CleanDBDateTime(pa["birthday"])); this.lIDNumber.Text = Functions.CleanDBString(pa["idnumber"]); this.lHujidi.Text = Functions.CleanDBString(pa["hujidi"]); this.lSex.Text = SexHashTable.GetName(Functions.CleanDBInt(pa["gendar"])); this.lPeople.Text = sysResDAL.GetResName("res_people", Functions.CleanDBString(pa["people"])); this.lRealName.Text = Functions.CleanDBString(pa["realname"]); }
protected void btnSubmit_Click(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { string password = this.txtPassword.Text; string newpassword = this.txtNewPassword.Text; string newpassword2 = this.txtNewPassword2.Text; string password_md5 = CommonBLL.GetMD5Password(password); //if (!newpassword.Equals(newpassword2)) { // GetSuccessMsg("两次输入新密码不一致."); // return; //} PersonDAL personDAL = new PersonDAL(conn); DataRow person = personDAL.GetAPerson(personid); CommonDAL dal = new CommonDAL(conn); if (password_md5.Equals(Functions.CleanDBString(person["password"]))) { string newpassword_md5 = CommonBLL.GetMD5Password(newpassword); string sql = "update person set password='******',passworduserchanged=1 where id='" + personid+"'"; dal.ExecSQL(sql); Session["person.passworduserchanged"] = 1; GetSuccessMsg("密码已更新", "../index.aspx"); return; } else { GetSuccessMsg("原密码不正确"); return; } } }
public static object CheckLogin(SqlConnection conn, string username, string password) { PersonDAL personDAL = new PersonDAL(conn); string password_md5 = CommonBLL.GetMD5Password(password); DataRow p =null; //username if (null == p) { p = personDAL.GetAPersonByUsername(username); } //usercode if (null == p) { p = personDAL.GetAPersonByUserCode(username); } //idnumber if (null == p) { p = personDAL.GetAPersonByIDNumber(username); } if (null == p) return "-1"; if (Functions.CleanDBString(p["password"]).Equals(password_md5)) { //return Functions.CleanDBGuid(p["id"]); return p; } else { return "-2"; } }
protected void btnSubmit_Click(object sender, EventArgs e) { using (SqlConnection conn = new SqlConnection(Globals.ConnectionString)) { PersonDAL personDAL = new PersonDAL(conn); //验证码 string checkcode = Request.Cookies["CheckCode"].Value; string valicode = txtValiCode.Text; if (String.Compare(checkcode, valicode, true) != 0) { GetErrMsg("验证码错误,请输入正确的验证码。"); return; } //身份证已存在否? string idnumber = txtIDNumber.Text; if (personDAL.IsIDNumberExist( idnumber)) { GetErrMsg("该身份证号已注册过,不可重复注册.\\n请使用已有的用户名登录."); return; } //用户名已存在否? string username = txtUsername.Text; if (personDAL.IsUsernameExist( username)) { GetErrMsg("该用户名已注册过,请换名再试"); return; } //邮箱已存在否? string email = txtEMail.Text; if (personDAL.IsEmailExist(email)) { GetErrMsg("该邮箱已被注册过,请换邮箱再试"); return; } //获取用户code string usercode = PersonBLL.GetPersonNumber(); //记录用户信息 DataRow p = personDAL.GetABlankPerson(); p["Username"] = username; p["usercode"] = usercode; p["Password"] = CommonBLL.GetMD5Password(this.txtPassword.Text); p["Idnumber"] = idnumber; p["mobile"] = txtMyMobile.Text; p["Email"] = txtEMail.Text; p["passworduserchanged"] = 1; string pid = personDAL.Create(p); if (pid!=null) { //set session ,simu as login Session["person.id"] = pid; Session["person.username"] = username; Session["person.passworduserchanged"] =1; string mailtitle = "契合网用户注册信息"; string mailcontent = "您的用户名是:" + username + " , 请牢记. "; EmailBLL emailBLL = new EmailBLL(); emailBLL.SendMail(email, mailtitle, mailcontent); GetSuccessMsg("注册信息已发送至您的安全邮箱.\\n下一步,请填写个人信息", "baseinfo.aspx?from=reg");// goto baseinfo } else { GetSuccessMsg("系统错误发生!"); } }//conn }
//分配11位的号码 public static string GetPersonNumber() { string res = ""; using(SqlConnection conn = new SqlConnection(Globals.ConnectionString)){ while (true) { res = RandomHelper.GenerateRandomNumber(11); PersonDAL pd = new PersonDAL(conn); DataRow p = pd.GetAPersonByUserCode(res); if (null == p) break; } } return res; }
private void BindData(SqlConnection conn) { PersonDAL personDAL = new PersonDAL(conn); DataRow person = personDAL.GetAPerson(personid); this.lUserCode.Text = Functions.CleanDBString(person["usercode"]); this.txtIDNumber.Text = Functions.CleanDBString(person["Idnumber"]); this.txtIDNumber0.Text = this.txtIDNumber.Text; this.txtName_.Text = Functions.CleanDBString(person["realname"]); DateTime? birthday = Functions.CleanDBDateTime(person["Birthday"]); if (null == birthday) { this.txtBirth.Text = Functions.GetShortDateStringFromNullableDateTime( Functions.GetBirthDayFromIDNumber(Functions.CleanDBString(person["Idnumber"]))); }else{ this.txtBirth.Text = Functions.GetShortDateStringFromNullableDateTime(birthday); } this.txtHujidi.Text = Functions.CleanDBString(person["Hujidi"]); this.ddlSex.SelectedValue = Functions.ParseStr(Functions.CleanDBInt(person["gendar"])); this.ddlPeople.SelectedValue = Functions.CleanDBString(person["People"]); this.txtMobile.Text = Functions.CleanDBString(person["mobile"]); this.ddlHujiType.SelectedValue = Functions.CleanDBString(person["hujitype"]); this.txtFamilyAddr.Text = Functions.CleanDBString(person["family_addr"]); this.txtFamilyPostCode.Text = Functions.CleanDBString(person["family_postcode"]); this.txtWorkAddr.Text = Functions.CleanDBString(person["work_addr"]); this.txtWorkPostCode.Text = Functions.CleanDBString(person["work_postcode"]); }