Esempio n. 1
0
        public static System.Collections.Hashtable Insert(Model.SMS model, System.Collections.Hashtable MyHs)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SMS(");
            strSql.Append("SType,SContent,Tel,SMSKey,CreateDate,MID,SendState,Email)");
            strSql.Append(" values (");
            strSql.Append("@SType,@SContent,@Tel,@SMSKey,@CreateDate,@MID,@SendState,@Email)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SType",      SqlDbType.VarChar,   10),
                new SqlParameter("@SContent",   SqlDbType.Text),
                new SqlParameter("@Tel",        SqlDbType.VarChar,   20),
                new SqlParameter("@SMSKey",     SqlDbType.VarChar,   50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@MID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SendState",  SqlDbType.Bit,        1),
                new SqlParameter("@Email",      SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.SType;
            parameters[1].Value = model.SContent;
            parameters[2].Value = model.Tel;
            parameters[3].Value = model.SMSKey;
            parameters[4].Value = model.CreateDate;
            parameters[5].Value = model.MID;
            parameters[6].Value = model.SendState;
            parameters[7].Value = model.Email;

            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Esempio n. 2
0
 /// <summary>
 /// 得到个人信息
 /// </summary>
 /// <returns></returns>
 public Model.Member GetSelf()
 {
     if (TModel == null)
     {
         return(null);
     }
     Model.Member model = DAL.Member.GetModel(TModel.MID);
     if (model != null && !model.Role.Super)
     {
         if (string.IsNullOrEmpty(model.TempThrPsd) || model.ThrPsd != model.TempThrPsd)
         {
             if (!model.IsClose)
             {
                 model.IsClose = true;
                 MemberClose(model);
                 string    Msg      = "会员:" + model.MID + "于当前时间[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]账号异常,已锁定,未冻结";
                 Model.SMS smsmodel = new Model.SMS {
                     SType = Model.SMSType.ZCYZ, Tel = BLL.WebBase.Model.MonitorTel, SContent = Msg
                 };
                 string error = "";
                 if (BLL.SMS.Insert(smsmodel, ref error))
                 {
                     Msg += "[已发送您手机]";
                 }
                 Task.SendManage(model, "001", Msg);
             }
             return(null);
         }
     }
     return(model);
 }
Esempio n. 3
0
        public static bool Insert(Model.SMS model, ref string error)
        {
            if (BLL.WebBase.Model.EmailState && !string.IsNullOrEmpty(model.Email))
            {
                int level = 0;
                while (!model.SendState && level++ < 5)
                {
                    try
                    {
                        model.SendState = SendMessage(model, ref error);
                    }
                    catch (Exception ex)
                    {
                        //BLL.WebBase.Model.EmailName = Emails[new Random().Next(0, 100)];
                        //BLL.WebBase.Update(BLL.WebBase.Model);
                        error          += "邮件发送失败!" + ex.Message;
                        model.SendState = false;
                    }
                }

                model.CreateDate = DateTime.Now;
                model.SMSKey     = BLL.WebBase.Model.EmailName;
                DAL.SMS.Insert(model);
            }
            else
            {
                error += "邮箱功能已关闭!";
                return(false);
            }
            return(model.SendState);
        }
Esempio n. 4
0
            /// <summary>
            /// Parses received messages into IEnumberable object
            /// </summary>
            /// <param name="input"></param>
            /// <returns>IEnumerable of Model.SMS</returns>
            static IEnumerable <Model.SMS> ParseMessages(string input)
            {
                List <Model.SMS> msgs = new List <Model.SMS>();

                Regex r = new Regex(@"\+CMGL: (\d+),""(.+)"",""(.+)"",(.*),""(.+)""\r\n(.+)\r\n");
                Match m = r.Match(input);

                while (m.Success)
                {
                    Model.SMS msg = new Model.SMS();
                    msg.ID     = Guid.NewGuid();
                    msg.Status = dictstatus[m.Groups[2].Value];
                    msg.Mobile = m.Groups[3].Value;

                    DateTime today;
                    if (!DateTime.TryParseExact(m.Groups[5].Value, "yy/MM/dd,H:mm:ss+32", CultureInfo.InvariantCulture, DateTimeStyles.None, out today))
                    {
                        today = DateTime.Now;
                    }
                    msg.SMSDate = today;

                    msg.Message = m.Groups[6].Value;
                    msgs.Add(msg);

                    m = m.NextMatch();
                }

                return(msgs);
            }
Esempio n. 5
0
 public static bool Insert(Model.SMS model, ref string error)
 {
     try
     {
         model.SendState  = false;
         model.CreateDate = DateTime.Now;
         //model.SContent += "[" + BLL.WebBase.Model.SMSTitle + "]";
         if (BLL.WebBase.Model.SMSState && !string.IsNullOrEmpty(model.Tel))
         {
             if (TimeVerify(model.Tel, model.SType, BLL.Configuration.CodeTime[model.SType.ToString()]))
             {
                 //if (DAL.SMS.GetDayCount(DateTime.Now) <= DAL.WebBase.Model.SMSMinCount)
                 //{
                 string dian  = @"^(13+\d{9})|(15+\d{9})|(18+\d{9})|(17+\d{9})|(14+\d{9})|(19+\d{9})$";
                 Regex  regex = new Regex(dian);
                 if (regex.IsMatch(model.Tel))
                 {
                     model.SendState = SendSMS(model.Tel, model.SContent);
                     if (model.SendState)
                     {
                         DAL.SMS.Insert(model);
                     }
                     else
                     {
                         error = "短信发送失败,请稍后重试";
                     }
                 }
                 else
                 {
                     model.SendState = false;
                     error          += "手机号格式不正确";
                 }
                 //}
                 //else
                 //{
                 //    error += "今日短信已用完";
                 //}
             }
             else
             {
                 error += "请等待" + (BLL.Configuration.CodeTime[model.SType.ToString()]) + "秒后,才可以重新接收手机短信";
             }
         }
         else
         {
             error += "短信功能已关闭!";
         }
         return(model.SendState);
     }
     catch (Exception ex)
     {
         error += ex.ToString();
         return(false);
     }
 }
Esempio n. 6
0
        public static bool Update(Model.SMS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SMS set ");
            strSql.Append("SType=@SType,");
            strSql.Append("SContent=@SContent,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Email=@Email,");
            strSql.Append("SMSKey=@SMSKey,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("MID=@MID,");
            strSql.Append("SendState=@SendState");
            strSql.Append(" where SID=@SID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SType",      SqlDbType.VarChar,   10),
                new SqlParameter("@SContent",   SqlDbType.Text),
                new SqlParameter("@Tel",        SqlDbType.VarChar,   20),
                new SqlParameter("@Email",      SqlDbType.VarChar,   50),
                new SqlParameter("@SMSKey",     SqlDbType.VarChar,   50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@MID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SID",        SqlDbType.Int,        4),
                new SqlParameter("@SendState",  SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.SType;
            parameters[1].Value = model.SContent;
            parameters[2].Value = model.Tel;
            parameters[3].Value = model.Email;
            parameters[4].Value = model.SMSKey;
            parameters[5].Value = model.CreateDate;
            parameters[6].Value = model.MID;
            parameters[7].Value = model.SID;
            parameters[8].Value = model.SendState;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        protected override string btnAdd_Click()
        {
            string tel     = Request.Form["tel"];
            string content = Request.Form["contents"];

            Model.SMS model = new Model.SMS {
                SType = Model.SMSType.ZCYZ, Tel = tel, SContent = content, SMSKey = ""
            };
            string error = "";

            if (BLL.SMS.Insert(model, ref error))
            {
                return("发送成功");
            }
            else
            {
                return(error);
            }
        }
Esempio n. 8
0
        private static bool SendMessage(Model.SMS model, ref string error)
        {
            SmtpClient client = new SmtpClient(BLL.WebBase.Model.EmailSmtp, 25);

            //出站方式设置为NetWork
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            //smtp服务器验证并制定账号密码
            client.Credentials = new NetworkCredential(BLL.WebBase.Model.EmailName, BLL.WebBase.Model.EmailPassword);
            MailMessage message = new MailMessage();

            //设置优先级
            message.Priority = MailPriority.Normal;
            //设置收件方看到的邮件来源为:发送方邮件地址、来源标题、编码
            message.From = new MailAddress(BLL.WebBase.Model.EmailName, "Vinci", Encoding.GetEncoding("gb2312"));
            //接收方
            if (!string.IsNullOrEmpty(model.Email))
            {
                try
                {
                    message.To.Add(model.Email);
                }
                catch
                {
                    error += "邮箱设置不正确!";
                    return(false);
                }
            }
            else
            {
                error += "邮箱未设置!";
                return(false);
            }
            //标题
            message.Subject         = BLL.WebBase.Model.EmailTitle;
            message.SubjectEncoding = Encoding.GetEncoding("gb2312");
            //邮件正文是否支持HTML
            message.IsBodyHtml = true;
            //正文编码
            message.BodyEncoding = Encoding.GetEncoding("gb2312");
            message.Body         = model.SContent;
            client.Send(message);
            return(true);
        }
Esempio n. 9
0
        public static bool Insert(Model.SMS model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SMS(");
            strSql.Append("SType,SContent,Tel,SMSKey,CreateDate,MID,SendState,Email)");
            strSql.Append(" values (");
            strSql.Append("@SType,@SContent,@Tel,@SMSKey,@CreateDate,@MID,@SendState,@Email)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SType",      SqlDbType.VarChar,   10),
                new SqlParameter("@SContent",   SqlDbType.Text),
                new SqlParameter("@Tel",        SqlDbType.VarChar,   20),
                new SqlParameter("@SMSKey",     SqlDbType.VarChar,   50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@MID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SendState",  SqlDbType.Bit,        1),
                new SqlParameter("@Email",      SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.SType;
            parameters[1].Value = model.SContent;
            parameters[2].Value = model.Tel;
            parameters[3].Value = model.SMSKey;
            parameters[4].Value = model.CreateDate;
            parameters[5].Value = model.MID;
            parameters[6].Value = model.SendState;
            parameters[7].Value = model.Email;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(true);
            }
            else
            {
                return(Convert.ToInt32(obj) > 0);
            }
        }
Esempio n. 10
0
        public static System.Collections.Hashtable Update(Model.SMS model, System.Collections.Hashtable MyHs)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update SMS set ");
            strSql.Append("SType=@SType,");
            strSql.Append("SContent=@SContent,");
            strSql.Append("Tel=@Tel,");
            strSql.Append("Email=@Email,");
            strSql.Append("SMSKey=@SMSKey,");
            strSql.Append("CreateDate=@CreateDate,");
            strSql.Append("MID=@MID");
            strSql.Append("SendState=@SendState");
            strSql.Append(" where SID=@SID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SType",      SqlDbType.VarChar,   10),
                new SqlParameter("@SContent",   SqlDbType.Text),
                new SqlParameter("@Tel",        SqlDbType.VarChar,   20),
                new SqlParameter("@Email",      SqlDbType.VarChar,   50),
                new SqlParameter("@SMSKey",     SqlDbType.VarChar,   50),
                new SqlParameter("@CreateDate", SqlDbType.DateTime),
                new SqlParameter("@MID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SID",        SqlDbType.Int,        4),
                new SqlParameter("@SendState",  SqlDbType.Bit, 1)
            };
            parameters[0].Value = model.SType;
            parameters[1].Value = model.SContent;
            parameters[2].Value = model.Tel;
            parameters[3].Value = model.Email;
            parameters[4].Value = model.SMSKey;
            parameters[5].Value = model.CreateDate;
            parameters[6].Value = model.MID;
            parameters[7].Value = model.SID;
            parameters[8].Value = model.SendState;

            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Esempio n. 11
0
 public static bool Insert(Model.SMS model, ref string error)
 {
     model.SendState  = false;
     model.CreateDate = DateTime.Now;
     //model.SContent += "[" + BLL.WebBase.Model.SMSTitle + "]";
     if (BLL.WebBase.Model.SMSState && !string.IsNullOrEmpty(model.Tel))
     {
         //if (TimeVerify(model.Tel, model.SType, BLL.Configuration.CodeTime[model.SType.ToString()]))
         {
             if (DAL.SMS.GetDayCount(DateTime.Now) <= DAL.WebBase.Model.SMSMinCount)
             {
                 model.SendState = SendSMS(model.Tel, model.SContent);
                 DAL.SMS.Insert(model);
                 if (model.SendState)
                 {
                     error = "发送成功";
                 }
                 else
                 {
                     error += "发送失败";
                 }
             }
             else
             {
                 error += "今日短信已用完";
             }
         }
         //else
         //{
         //    error += "请等待" + (BLL.Configuration.CodeTime[model.SType.ToString()] / 60) + "分钟后,才可以重新接收手机短信";
         //}
     }
     else
     {
         error += "短信功能已关闭!";
     }
     return(model.SendState);
 }
Esempio n. 12
0
        /// <summary>
        /// 推荐人
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Insert(Model.Member model, bool NeedEmail, ref string retStr)
        {
            if (model.AgencyCode == "001")
            {
                model.MState      = false;
                model.RoleCode    = BLL.Roles.RolsList["Notactive"].RType;
                model.MBDIndex    = 0;
                model.MCreateDate = DateTime.Now;
                model.MDate       = DateTime.MaxValue;
                model.MConfig     = new Model.MemberConfig
                {
                    MID        = model.MID,
                    JJTypeList = DAL.Reward.RewardStr,
                    DTFHState  = true,
                    JTFHState  = true
                };
            }
            retStr = Validation(model);
            if (retStr != "")
            {
                return(false);
            }
            string password = model.Password;
            string secpsd   = model.SecPsd;

            if (string.IsNullOrEmpty(model.FMID))
            {
                model.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(model.Password + model.Salt, "MD5").ToUpper();
                model.SecPsd   = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(model.SecPsd + model.Salt, "MD5").ToUpper();
            }
            if (DAL.Member.Insert(model))
            {
                Model.Member mtjmodel = DAL.Member.GetModel(model.MTJ);

                retStr = "恭喜您注册成功,您的会员账号为:" + model.MID +
                         ",登录密码是:" + password + ",资金密码是:" + secpsd + "!";
                Model.SMS smsmodel = new Model.SMS {
                    MID = model.MID, SContent = retStr, Email = model.Email, SType = Model.SMSType.QT
                };

                BLL.Task.ManageSend(model, "尊敬的" + model.MID +
                                    "会员:恭喜成功注册,为了您的账户安全,请妥善保管您的密码,并且定期在[安全中心]修改密码,为了使您能够享受更多的服务,请及时购币激活账号,您的推荐人QQ号码:" + mtjmodel.QQ + ",手机号码:" + mtjmodel.Tel);

                string emailerr = "";
                if (NeedEmail)
                {
                    BLL.Email.Insert(smsmodel, ref emailerr);
                }

                emailerr = "恭喜您,会员账号" + model.MID + "成功注册为您伞下体验会员,请尽快协助新会员购币激活账号,谢谢合作!";
                BLL.Task.ManageSend(mtjmodel, emailerr);
                smsmodel = new Model.SMS {
                    MID = mtjmodel.MID, SContent = emailerr, Email = mtjmodel.Email, SType = Model.SMSType.QT
                };
                if (NeedEmail)
                {
                    BLL.Email.Insert(smsmodel, ref emailerr);
                }
                return(true);
            }
            return(false);
        }
Esempio n. 13
0
 public static bool Update(Model.SMS model)
 {
     return(DAL.SMS.Update(model));
 }
Esempio n. 14
0
 public static System.Collections.Hashtable Update(Model.SMS model, System.Collections.Hashtable MyHs)
 {
     return(DAL.SMS.Update(model, MyHs));
 }
Esempio n. 15
0
 public static System.Collections.Hashtable Insert(Model.SMS model, System.Collections.Hashtable MyHs)
 {
     model.SendState  = SendSMS(model.Tel, model.SContent);
     model.CreateDate = DateTime.Now;
     return(DAL.SMS.Insert(model, MyHs));
 }