Пример #1
0
        /// <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);
        }
Пример #2
0
    public void Execute(IJobExecutionContext context)
    {
        try
        {
            lgk.BLL.SMS ruleLock = new lgk.BLL.SMS();
            lock (ruleLock)
            {
                DataSet ds = ruleLock.GetList(1, " IsValid=1 and IsDeleted=0 and SendNum<2 ", " ID ");
                if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
                {
                    List <lgk.Model.SMS> SMSList = ruleLock.DataTableToList(ds.Tables[0]);
                    foreach (lgk.Model.SMS smsModel in SMSList)
                    {
                        long phoneNum = regx.PhoneNum(smsModel.ToPhone);
                        try
                        {
                            if (smsModel.ValidTime > DateTime.Now)
                            {
                                //短信有效期已过
                                smsModel.IsValid = 0;
                                ruleLock.Update(smsModel);
                            }
                            int    SmsTempType = smsModel.TypeID;
                            string flag        = Library.SMSHelper.SendMessage2(phoneNum.ToString(), smsModel.SMSContent);
                            if (phoneNum > 0 && flag == "0")
                            {
                                smsModel.IsValid = 0;
                                Library.LogHelper.SaveLog("发送短信成功!" + phoneNum, "SMS");
                            }
                            else
                            {
                                Library.LogHelper.SaveLog("发送短信失败!" + phoneNum + "," + flag, "SMS");
                            }
                        }
                        catch (Exception ex)
                        {
                            Library.LogHelper.SaveLog("短信发送错误!" + phoneNum + "(" + ex.Message + ")", "SMS");
                        }
                        finally
                        {
                            smsModel.SendNum += 1;
                            StringBuilder UpSmsSql = new StringBuilder();
                            UpSmsSql.Append(" update SMS ");
                            UpSmsSql.AppendFormat(" Set SendNum+=1,IsValid={0} ", smsModel.IsValid);
                            UpSmsSql.AppendFormat(" where ToPhone='{0}' and SMSContent='{1}' ", phoneNum, smsModel.SMSContent);
                            UpSmsSql.AppendFormat(" and DATEADD(MM,-1,CONVERT(datetime,'{0}',101))<= PublishTime and DATEADD(MM,1,CONVERT(datetime,'{1}',101))>=PublishTime ", smsModel.PublishTime.ToString(), smsModel.PublishTime.ToString());
                            //UpSmsSql.Append(" and IsValid=1 and IsDeleted=0 ");

                            int n = DataAccess.DbHelperSQL.ExecuteSql(UpSmsSql.ToString());
                            if (n > 0)
                            {
                                Library.LogHelper.SaveLog("短信状态更新成功!" + phoneNum, "SMS");
                            }
                            else
                            {
                                Library.LogHelper.SaveLog("短信状态更新失败!" + phoneNum, "SMS");
                            }
                        }
                    }
                }
            }
        }
        catch (Exception ex)
        {
            //ISchedulerFactory sf = new Quartz.Impl.StdSchedulerFactory();
            //IScheduler sched = sf.GetScheduler();
            //sched.DeleteJob(new JobKey("job1", "group1"));
            Library.LogHelper.SaveLog("发送短信失败,停止运行作业!" + ex.StackTrace, "SMSErr");
        }
    }