/// <summary> /// 输入验证 /// </summary> /// <returns></returns> protected bool RegValidate() { lgk.Model.tb_user recommendInfo = new lgk.Model.tb_user(); //lgk.Model.tb_user parentInfo = new lgk.Model.tb_user(); //lgk.Model.tb_agent agentInfo = new lgk.Model.tb_agent(); #region 会员编号验证 if (txtUserCode.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("PleaseNumber"), Library.Enums.ModalTypes.warning);//请输入会员编号 return(false); } //if (!PageValidate.checkUserCode(txtUserCode.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("MemberNumber") + "');", true);//会员编号必须由6-10位的英文字母或数字组成 // return false; //} if (AC.GetUserID(txtUserCode.Value.Trim()) > 0) { MessageBox.ShowBox(this.Page, AC.GetLanguage("Memberexists"), Library.Enums.ModalTypes.info);//该会员编号已存在,请重新输入! return(false); } #endregion if (txtNiceName.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("Nickname"), Library.Enums.ModalTypes.warning);//会员昵称不能为空 return(false); } #region 密码验证 if (txtPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("PasswordISNull"), Library.Enums.ModalTypes.warning);//登录密码不能为空 return(false); } //if (txtPassword.Value.Trim().Length < 6) //{ // MessageBox.ShowBox(this.Page, GetLanguage("PasswordLength"), Library.Enums.ModalTypes.warning);//密码长度不能小于6位 // return false; //} if (txtRegPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("ConfirmPasswordISNull"), Library.Enums.ModalTypes.warning);//确认密码不能为空 return(false); } if (!txtPassword.Value.Trim().Equals(txtRegPassword.Value.Trim())) { MessageBox.ShowBox(this.Page, AC.GetLanguage("TwoPasswordMatch"), Library.Enums.ModalTypes.warning);//两次输入的登录密码不一致 return(false); } if (txtSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return(false); } if (txtRegSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, AC.GetLanguage("secondaryPasswordISNull"), Library.Enums.ModalTypes.warning);//确认二级密码不能为空 return(false); } if (!txtSecondPassword.Value.Trim().Equals(txtRegSecondPassword.Value.Trim())) { MessageBox.ShowBox(this.Page, AC.GetLanguage("TwoSecondaryMatch"), Library.Enums.ModalTypes.warning);//两次输入的二级密码不一致 return(false); } #endregion #region 银行验证 //string strBankAccount = this.txtBankAccount.Value.Trim(); //if (txtAlipay.Value.Trim() == "" && string.IsNullOrEmpty(strBankAccount)) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("AlipayAccount") + "');", true);//支付宝账号不能为空 // return false; //} //if (!string.IsNullOrEmpty(strBankAccount) && !PageValidate.RegexTrueBank(this.txtBankAccount.Value) && string.IsNullOrEmpty(txtAlipay.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("BankCardErrors") + "');", true);//银行卡号输入错误 // return false; //} //string strBankAccountUser = this.txtBankAccountUser.Value.Trim(); //if (!string.IsNullOrEmpty(strBankAccountUser) && !PageValidate.RegexTrueName(txtBankAccountUser.Value.Trim()) && string.IsNullOrEmpty(txtAlipay.Value.Trim())) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("NameMust") + "');", true);//开户名必须为2-30个中英文 // return false; //} #endregion #region 推荐人验证 string reName = this.txtRecommendCode.Value.Trim(); if (string.IsNullOrEmpty(reName)) { MessageBox.ShowBox(this.Page, AC.GetLanguage("ReferenceNumberIsnull"), Library.Enums.ModalTypes.warning);//推荐人编号不能为空 return(false); } else { recommendInfo = AC.userBLL.GetModel(AC.GetUserID(reName));//推薦用户 if (recommendInfo == null) { MessageBox.ShowBox(this.Page, AC.GetLanguage("featuredNotExist"), Library.Enums.ModalTypes.warning);//该推荐会员不存在 return(false); } if (recommendInfo.IsOpend == 0) { MessageBox.ShowBox(this.Page, AC.GetLanguage("MemberISNull"), Library.Enums.ModalTypes.warning);//该会员尚未开通,不能作为推荐会员 return(false); } } #endregion //if (radioRegQy.SelectedValue == "") //{ // MessageBox.ShowBox(this.Page, "请选择注册区域", Library.Enums.ModalTypes.warning);//会员昵称不能为空 // return false; //} #region 手机号码验证 var strPhoneNum = this.txtUserCode.Value.Trim(); AllCore ac = new AllCore(); if (!string.IsNullOrEmpty(strPhoneNum) && !PageValidate.RegexPhone(strPhoneNum)) { MessageBox.ShowBox(this.Page, ac.GetLanguage("PhoneMust"), Library.Enums.ModalTypes.error);//联系电话格式错误 return(false); } int userid = ac.GetUserIDbByPhone(strPhoneNum); if (userid > 0) { MessageBox.ShowBox(this.Page, ac.GetLanguage("PhoneRegExists"), Library.Enums.ModalTypes.info);//该手机号码已注册 return(false); } int ct = ac.GetPhoneNumber(strPhoneNum); // int p_phoneNumer = getParamInt("RegisterPhoneNumber"); if (ct >= 1) { MessageBox.ShowBox(this.Page, string.Format(ac.GetLanguage("RegisterPhoneNumber")), Library.Enums.ModalTypes.warning);//该手机号码已注册 return(false); } if (txtIDNumber.Value.Trim().Length < 15 && txtIDNumber.Value.Trim().Length > 18) { MessageBox.ShowBox(this.Page, string.Format("请输入正确的身份证号码!"), Library.Enums.ModalTypes.warning);//请输入正确的身份证号码 return(false); } ct = ac.GetIDCodeNumber(txtIDNumber.Value.Trim()); if (ct >= 1) { MessageBox.ShowBox(this.Page, string.Format(ac.GetLanguage("RegisterIDCodeNumber")), Library.Enums.ModalTypes.warning);//该身份证号注册 return(false); } var agentcode = Agent.Value.Trim(); int ID = ac.agentBLL.GetAgentsIDByUserCode(agentcode); if (ID == 0) //服务中心 { MessageBox.ShowBox(this.Page, string.Format("该服务中心不存在!"), Library.Enums.ModalTypes.warning); //请输入正确的身份证号码 return(false); } if (ac.agentBLL.GetModel(ID).Flag == 2) { MessageBox.ShowBox(this.Page, string.Format("该服务中心已被冻结!"), Library.Enums.ModalTypes.warning);//请输入正确的身份证号码 return(false); } #endregion #region 密保问题验证 //if (dropQuestion.SelectedValue.Trim() == "0") //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseSelectQuestion") + "');", true);//请选择密保问题 // return false; //} //if (string.IsNullOrEmpty(txtAnswer.Text)) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseAnswer") + "');", true);//请输入密保答案 // return false; //} #endregion #region 商务中心 //int iAgentOpend = getParamInt("AgentSwith");//商务中心是否开启 //if (!string.IsNullOrEmpty(txtAgent.Value.Trim())) //{ // if (iAgentOpend == 1) // { // bool isagent = agentBLL.isExistByName(txtAgent.Value.Trim()); // if (!isagent) // { // MessageBox.ShowBox(this.Page, GetLanguage("AgentNumberExist"), Library.Enums.ModalTypes.warning);//商务中心编号不存在 // return false; // } // } //} //decimal regopen = getParamAmount("RegOpen"); //if(LoginUser.Emoney < regopen) //{ // MessageBox.ShowBox(this.Page, GetLanguage("RegOpenMust"), Library.Enums.ModalTypes.warning);//注册积分不足 // return false; //} #endregion return(true); }
/// <summary> /// 输入验证 /// </summary> /// <returns></returns> protected bool RegValidate() { lgk.Model.tb_user recommendInfo = new lgk.Model.tb_user(); if (txtUserCode.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("PleaseNumber"), Library.Enums.ModalTypes.warning);//请输入会员编号 return(false); } if (!PageValidate.checkUserCode(txtUserCode.Value.Trim())) { MessageBox.ShowBox(this.Page, "", GetLanguage("MemberNumber"), Library.Enums.ModalTypes.warning);//会员编号必须由6-10位的英文字母或数字组成 return(false); } if (GetUserID(txtUserCode.Value.Trim()) > 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("Memberexists"), Library.Enums.ModalTypes.info);//该会员编号已存在,请重新输入! return(false); } //if (sex1.Checked != true && sex2.Checked != true) //{ // ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('" + GetLanguage("PleaseArea") + "');", true);//请选择注册区域 // return false; //} //int iLocation = 0; //if (sex1.Checked == true) { iLocation = 1; } //if (sex2.Checked == true) { iLocation = 2; } #region 手机号码验证 if (txtPhoneNum.Value == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("Phoneempty"), Library.Enums.ModalTypes.warning);//手机号码不能为空 return(false); } var strPhoneNum = this.txtPhoneNum.Value.Trim(); if (!string.IsNullOrEmpty(strPhoneNum) && !PageValidate.RegexPhone(strPhoneNum)) { MessageBox.ShowBox(this.Page, "", GetLanguage("PhoneMust"), Library.Enums.ModalTypes.error);//联系电话格式错误 return(false); } int userid = GetUserIDbByPhone(strPhoneNum); if (userid > 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("PhoneRegExists"), Library.Enums.ModalTypes.info);//该手机号码已注册 return(false); } if (appId == "Open") { if (verifid_code.Value.Trim() == "") { MessageBox.ResponseScript(this, "msg_disp('请输入验证码!');"); return(false); } DataSet ds = new lgk.BLL.SMS().GetList(" IsValid=0 and ToUserCode='" + Session.SessionID + "' and ToPhone='" + txtPhoneNum.Value.Trim() + "' and SCode='" + verifid_code.Value.Trim() + "' and ValidTime >= getdate() "); if (ds == null || ds.Tables == null || ds.Tables[0] == null || ds.Tables[0].Rows.Count <= 0) { MessageBox.ResponseScript(this, "msg_disp('验证码无效!');"); return(false); } else { lgk.Model.SMS sms = new lgk.BLL.SMS().GetModel(long.Parse(ds.Tables[0].Rows[0]["ID"].ToString())); sms.IsValid = -1; new lgk.BLL.SMS().Update(sms); CacheHelper.Remove(Session.SessionID); } } #endregion #region 密码验证 if (txtPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("PasswordISNull"), Library.Enums.ModalTypes.warning);//登录密码不能为空 return(false); } if (txtSecondPassword.Value.Trim() == "") { MessageBox.ShowBox(this.Page, "", GetLanguage("SecondaryISNUll"), Library.Enums.ModalTypes.warning);//二级密码不能为空 return(false); } #endregion #region 推荐人验证 if (txtRecommendCode.Value == "") { MessageBox.ShowBox(this.Page, GetLanguage("ReferenceNumberIsnull"), Library.Enums.ModalTypes.warning);//推荐人编号不能为空 return(false); } else { string reName = this.txtRecommendCode.Value.Trim(); recommendInfo = userBLL.GetModel(GetUserID(reName));//推薦用户 if (recommendInfo == null) { MessageBox.ShowBox(this.Page, "", GetLanguage("featuredNotExist"), Library.Enums.ModalTypes.warning);//该推荐会员不存在 return(false); } if (recommendInfo.IsOpend == 0) { MessageBox.ShowBox(this.Page, "", GetLanguage("MemberISNull"), Library.Enums.ModalTypes.warning);//该会员尚未开通,不能作为推荐会员 return(false); } } #endregion return(true); }