Exemplo n.º 1
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="emailList">实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(EmailList emailList, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(EmailList._)
                      .ValueP(EmailList._EmailAddress, emailList.EmailAddress)
                      .ValueP(EmailList._NickName, emailList.NickName)
                      .ValueP(EmailList._LastSendStatus, emailList.LastSendStatus)
                      .ValueP(EmailList._LastSendError, emailList.LastSendError)
                      .ValueP(EmailList._LastSendTime, emailList.LastSendTime)
                      .ValueP(EmailList._LastSendSmtp, emailList.LastSendSmtp)
                      .ValueP(EmailList._SendCount, emailList.SendCount)
                      .ValueP(EmailList._CreateTime, emailList.CreateTime)
                      .ValueP(EmailList._ex0, emailList.ex0)
                      .ValueP(EmailList._ex1, emailList.ex1)
                      .ValueP(EmailList._ex2, emailList.ex2)
                      .ValueP(EmailList._ex3, emailList.ex3)
                      .ValueP(EmailList._ex4, emailList.ex4)
                      .ValueP(EmailList._ex5, emailList.ex5)
                      .ValueP(EmailList._ex6, emailList.ex6)
                      .ValueP(EmailList._ex7, emailList.ex7)
                      .ValueP(EmailList._ex8, emailList.ex8)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 清除按主键查询的缓存
        /// </summary>
        public static void ClearCacheSelectByID(string emailAddress, Where where = null)
        {
            string cacheName    = "TH.Mailer.EmailListCache_SelectByID_{0}";
            string cacheNameKey = string.Format(cacheName, emailAddress + "_" + "_" + where);

            Cache2.Remove(cacheNameKey);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 路由修改记录
        /// </summary>
        /// <param name="routeSetting">路由实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(RouteSetting routeSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (routeSetting.RouteID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(RouteSetting._)
                        .SetP(RouteSetting._RouteIP, routeSetting.RouteIP)
                        .SetP(RouteSetting._UserName, routeSetting.UserName)
                        .SetP(RouteSetting._RPassword, routeSetting.RPassword)
                        .SetP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
                        .SetP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
                        .SetP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
                        .Where(new Where()
                               .AndP(RouteSetting._RouteID, routeSetting.RouteID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 修改多条记录
        /// </summary>
        /// <param name="emailAddressList">发送的Email列表,用“,”号分隔</param>
        /// <param name="emailList">实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool UpdateByIDList(IEnumerable <string> emailAddressList, EmailList emailList, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Update(EmailList._)
                        .SetP(EmailList._NickName, emailList.NickName)
                        .SetP(EmailList._LastSendStatus, emailList.LastSendStatus)
                        .SetP(EmailList._LastSendError, emailList.LastSendError)
                        .SetP(EmailList._LastSendTime, emailList.LastSendTime)
                        .SetP(EmailList._LastSendSmtp, emailList.LastSendSmtp)
                        .SetP(EmailList._SendCount, emailList.SendCount)
                        .SetP(EmailList._CreateTime, emailList.CreateTime)
                        .SetP(EmailList._ex0, emailList.ex0)
                        .SetP(EmailList._ex1, emailList.ex1)
                        .SetP(EmailList._ex2, emailList.ex2)
                        .SetP(EmailList._ex3, emailList.ex3)
                        .SetP(EmailList._ex4, emailList.ex4)
                        .SetP(EmailList._ex5, emailList.ex5)
                        .SetP(EmailList._ex6, emailList.ex6)
                        .SetP(EmailList._ex7, emailList.ex7)
                        .SetP(EmailList._ex8, emailList.ex8)
                        .Where(new Where()
                               .And(EmailList._EmailAddress, "(" + emailAddressList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
            return(true);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 邮件模版添加记录
        /// </summary>
        /// <param name="htmlTemplate">邮件模版实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>返回添加成功后的ID</returns>
        public static Int64 Insert(HtmlTemplate htmlTemplate, string dbkey = "", string[] delCache = null)
        {
            object obj = new SQL().Database(dbkey).Insert(HtmlTemplate._)
                         .ValueP(HtmlTemplate._TemplateID, htmlTemplate.TemplateID)
                         .ValueP(HtmlTemplate._Subject, htmlTemplate.Subject)
                         .ValueP(HtmlTemplate._Body, htmlTemplate.Body)
                         .ValueP(HtmlTemplate._ShowName, htmlTemplate.ShowName)
                         .ValueP(HtmlTemplate._IsHTML, htmlTemplate.IsHTML)
                         .ValueP(HtmlTemplate._Status, htmlTemplate.Status)
                         .ValueP(HtmlTemplate._CreateTime, htmlTemplate.CreateTime)
                         .ToExec();

            if (obj.ToInt() != 1)
            {
                return(0);
            }
            obj = new SQL().Database(dbkey).From(HtmlTemplate._).Max("TemplateID").ToScalar();
            if (obj.IsAllNull())
            {
                return(0);
            }
            Int64 value = obj.ToString().ToBigInt();

            if (delCache.IsNull())
            {
                return(value);
            }
            Cache2.Remove("TH.Mailer.HtmlTemplateCache_", delCache);
            return(value);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 邮件模版修改记录
        /// </summary>
        /// <param name="htmlTemplate">邮件模版实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(HtmlTemplate htmlTemplate, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (htmlTemplate.TemplateID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(HtmlTemplate._)
                        .SetP(HtmlTemplate._Subject, htmlTemplate.Subject)
                        .SetP(HtmlTemplate._Body, htmlTemplate.Body)
                        .SetP(HtmlTemplate._ShowName, htmlTemplate.ShowName)
                        .SetP(HtmlTemplate._IsHTML, htmlTemplate.IsHTML)
                        .SetP(HtmlTemplate._Status, htmlTemplate.Status)
                        .SetP(HtmlTemplate._CreateTime, htmlTemplate.CreateTime)
                        .Where(new Where()
                               .AndP(HtmlTemplate._TemplateID, htmlTemplate.TemplateID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.HtmlTemplateCache_", delCache);
            return(true);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取IP配置修改记录
        /// </summary>
        /// <param name="ipSetting">获取IP配置实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(IpSetting ipSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (ipSetting.IPCID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(IpSetting._)
                        .SetP(IpSetting._WebName, ipSetting.WebName)
                        .SetP(IpSetting._IPUrl, ipSetting.IPUrl)
                        .SetP(IpSetting._IPRegex, ipSetting.IPRegex)
                        .SetP(IpSetting._DataEncode, ipSetting.DataEncode)
                        .Where(new Where()
                               .AndP(IpSetting._IPCID, ipSetting.IPCID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.IpSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 清除按主键查询的缓存
        /// </summary>
        public static void ClearCacheSelectByID(string smtpServer, int smtpPort, string userName, Where where = null)
        {
            string cacheName    = "TH.Mailer.SmtpListCache_SelectByID_{0}";
            string cacheNameKey = string.Format(cacheName, smtpServer + "_" + smtpPort + "_" + userName + "_" + "_" + where);

            Cache2.Remove(cacheNameKey);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 修改记录
        /// </summary>
        /// <param name="smtpList">实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(SmtpList smtpList, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (smtpList.SmtpServer.IsNullEmpty() && smtpList.SmtpPort.IsNull() && smtpList.UserName.IsNullEmpty())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(SmtpList._)
                        .SetP(SmtpList._SPassword, smtpList.SPassword)
                        .SetP(SmtpList._SSL, smtpList.SSL)
                        .SetP(SmtpList._Status, smtpList.Status)
                        .SetP(SmtpList._Sends, smtpList.Sends)
                        .SetP(SmtpList._SendFails, smtpList.SendFails)
                        .SetP(SmtpList._CreateTime, smtpList.CreateTime)
                        .Where(new Where()
                               .AndP(SmtpList._SmtpServer, smtpList.SmtpServer, Operator.Equal, true)
                               .AndP(SmtpList._SmtpPort, smtpList.SmtpPort, Operator.Equal, true)
                               .AndP(SmtpList._UserName, smtpList.UserName, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.SmtpListCache_", delCache);
            return(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获取IP配置添加记录
        /// </summary>
        /// <param name="ipSetting">获取IP配置实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>返回添加成功后的ID</returns>
        public static Int64 Insert(IpSetting ipSetting, string dbkey = "", string[] delCache = null)
        {
            object obj = new SQL().Database(dbkey).Insert(IpSetting._)
                         .ValueP(IpSetting._IPCID, ipSetting.IPCID)
                         .ValueP(IpSetting._WebName, ipSetting.WebName)
                         .ValueP(IpSetting._IPUrl, ipSetting.IPUrl)
                         .ValueP(IpSetting._IPRegex, ipSetting.IPRegex)
                         .ValueP(IpSetting._DataEncode, ipSetting.DataEncode)
                         .ToExec();

            if (obj.ToInt() != 1)
            {
                return(0);
            }
            obj = new SQL().Database(dbkey).From(IpSetting._).Max("IPCID").ToScalar();
            if (obj.IsAllNull())
            {
                return(0);
            }
            Int64 value = obj.ToString().ToBigInt();

            if (delCache.IsNull())
            {
                return(value);
            }
            Cache2.Remove("TH.Mailer.IpSettingCache_", delCache);
            return(value);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 设置修改记录
        /// </summary>
        /// <param name="sendSetting">设置实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(SendSetting sendSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (sendSetting.SettingID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(SendSetting._)
                        .SetP(SendSetting._TemplateID, sendSetting.TemplateID)
                        .SetP(SendSetting._ConnectType, sendSetting.ConnectType)
                        .SetP(SendSetting._SendInterval, sendSetting.SendInterval)
                        .SetP(SendSetting._IPInterval, sendSetting.IPInterval)
                        .SetP(SendSetting._SmtpInterval, sendSetting.SmtpInterval)
                        .SetP(SendSetting._DeleteInterval, sendSetting.DeleteInterval)
                        .SetP(SendSetting._MaxRetryCount, sendSetting.MaxRetryCount)
                        .SetP(SendSetting._SendRetryCount, sendSetting.SendRetryCount)
                        .SetP(SendSetting._Status, sendSetting.Status)
                        .Where(new Where()
                               .AndP(SendSetting._SettingID, sendSetting.SettingID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.SendSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 清除路由按主键查询的缓存
        /// </summary>
        public static void ClearCacheSelectByID(int routeID, Where where = null)
        {
            string cacheName    = "TH.Mailer.RouteSettingCache_SelectByID_{0}";
            string cacheNameKey = string.Format(cacheName, routeID + "_" + "_" + where);

            Cache2.Remove(cacheNameKey);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 拨号连接修改记录
        /// </summary>
        /// <param name="modelSetting">拨号连接实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(ModelSetting modelSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (modelSetting.ModelID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(ModelSetting._)
                        .SetP(ModelSetting._ModelName, modelSetting.ModelName)
                        .SetP(ModelSetting._UserName, modelSetting.UserName)
                        .SetP(ModelSetting._MPassword, modelSetting.MPassword)
                        .Where(new Where()
                               .AndP(ModelSetting._ModelID, modelSetting.ModelID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.ModelSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="ipHistory">实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(IpHistory ipHistory, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(IpHistory._)
                      .ValueP(IpHistory._IP, ipHistory.IP)
                      .ValueP(IpHistory._CreateTime, ipHistory.CreateTime)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.IpHistoryCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 天翼连接设置添加记录
        /// </summary>
        /// <param name="tianYiSetting">天翼连接设置实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(TianYiSetting tianYiSetting, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(TianYiSetting._)
                      .ValueP(TianYiSetting._TianYiID, tianYiSetting.TianYiID)
                      .ValueP(TianYiSetting._TianYiExePath, tianYiSetting.TianYiExePath)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.TianYiSettingCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 拨号连接添加记录
        /// </summary>
        /// <param name="modelSetting">拨号连接实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(ModelSetting modelSetting, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(ModelSetting._)
                      .ValueP(ModelSetting._ModelID, modelSetting.ModelID)
                      .ValueP(ModelSetting._ModelName, modelSetting.ModelName)
                      .ValueP(ModelSetting._UserName, modelSetting.UserName)
                      .ValueP(ModelSetting._MPassword, modelSetting.MPassword)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.ModelSettingCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 删除多条记录
        /// </summary>
        /// <param name="iPList">IP地址列表,用“,”号分隔</param>
        /// <param name="where">删除时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByIDList(IEnumerable <string> iPList, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Delete(IpHistory._)
                        .Where(new Where()
                               .And(IpHistory._IP, "(" + iPList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.IpHistoryCache_", delCache);
            return(true);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 天翼连接设置修改多条记录
        /// </summary>
        /// <param name="tianYiIDList">天翼连接设置编号列表,用“,”号分隔</param>
        /// <param name="tianYiSetting">天翼连接设置实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool UpdateByIDList(IEnumerable <int> tianYiIDList, TianYiSetting tianYiSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Update(TianYiSetting._)
                        .SetP(TianYiSetting._TianYiExePath, tianYiSetting.TianYiExePath)
                        .Where(new Where()
                               .And(TianYiSetting._TianYiID, "(" + tianYiIDList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.TianYiSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 路由添加记录
        /// </summary>
        /// <param name="routeSetting">路由实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(RouteSetting routeSetting, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(RouteSetting._)
                      .ValueP(RouteSetting._RouteID, routeSetting.RouteID)
                      .ValueP(RouteSetting._RouteIP, routeSetting.RouteIP)
                      .ValueP(RouteSetting._UserName, routeSetting.UserName)
                      .ValueP(RouteSetting._RPassword, routeSetting.RPassword)
                      .ValueP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
                      .ValueP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
                      .ValueP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 拨号连接修改多条记录
        /// </summary>
        /// <param name="modelIDList">拨号连接编号列表,用“,”号分隔</param>
        /// <param name="modelSetting">拨号连接实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool UpdateByIDList(IEnumerable <int> modelIDList, ModelSetting modelSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Update(ModelSetting._)
                        .SetP(ModelSetting._ModelName, modelSetting.ModelName)
                        .SetP(ModelSetting._UserName, modelSetting.UserName)
                        .SetP(ModelSetting._MPassword, modelSetting.MPassword)
                        .Where(new Where()
                               .And(ModelSetting._ModelID, "(" + modelIDList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.ModelSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 添加记录
        /// </summary>
        /// <param name="smtpList">实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(SmtpList smtpList, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(SmtpList._)
                      .ValueP(SmtpList._SmtpServer, smtpList.SmtpServer)
                      .ValueP(SmtpList._SmtpPort, smtpList.SmtpPort)
                      .ValueP(SmtpList._UserName, smtpList.UserName)
                      .ValueP(SmtpList._SPassword, smtpList.SPassword)
                      .ValueP(SmtpList._SSL, smtpList.SSL)
                      .ValueP(SmtpList._Status, smtpList.Status)
                      .ValueP(SmtpList._Sends, smtpList.Sends)
                      .ValueP(SmtpList._SendFails, smtpList.SendFails)
                      .ValueP(SmtpList._CreateTime, smtpList.CreateTime)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.SmtpListCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 设置添加记录
        /// </summary>
        /// <param name="sendSetting">设置实体类</param>
        /// <param name="delCache">添加成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>添加是否成功</returns>
        public static bool Insert(SendSetting sendSetting, string dbkey = "", string[] delCache = null)
        {
            int obj = new SQL().Database(dbkey).Insert(SendSetting._)
                      .ValueP(SendSetting._SettingID, sendSetting.SettingID)
                      .ValueP(SendSetting._TemplateID, sendSetting.TemplateID)
                      .ValueP(SendSetting._ConnectType, sendSetting.ConnectType)
                      .ValueP(SendSetting._SendInterval, sendSetting.SendInterval)
                      .ValueP(SendSetting._IPInterval, sendSetting.IPInterval)
                      .ValueP(SendSetting._SmtpInterval, sendSetting.SmtpInterval)
                      .ValueP(SendSetting._DeleteInterval, sendSetting.DeleteInterval)
                      .ValueP(SendSetting._MaxRetryCount, sendSetting.MaxRetryCount)
                      .ValueP(SendSetting._SendRetryCount, sendSetting.SendRetryCount)
                      .ValueP(SendSetting._Status, sendSetting.Status)
                      .ToExec();

            if (delCache.IsNull())
            {
                return(obj == 1);
            }
            Cache2.Remove("TH.Mailer.SendSettingCache_", delCache);
            return(obj == 1);
        }
Exemplo n.º 23
0
        /// <summary>
        /// 获取IP配置修改多条记录
        /// </summary>
        /// <param name="iPCIDList">获取IP配置编号列表,用“,”号分隔</param>
        /// <param name="ipSetting">获取IP配置实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool UpdateByIDList(IEnumerable <Int64> iPCIDList, IpSetting ipSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Update(IpSetting._)
                        .SetP(IpSetting._WebName, ipSetting.WebName)
                        .SetP(IpSetting._IPUrl, ipSetting.IPUrl)
                        .SetP(IpSetting._IPRegex, ipSetting.IPRegex)
                        .SetP(IpSetting._DataEncode, ipSetting.DataEncode)
                        .Where(new Where()
                               .And(IpSetting._IPCID, "(" + iPCIDList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.IpSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 邮件模版删除记录
        /// </summary>
        /// <param name="templateID">邮件模版编号</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">删除成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByID(Int64?templateID, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (templateID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Delete(HtmlTemplate._)
                        .Where(new Where()
                               .AndP(HtmlTemplate._TemplateID, templateID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value != 1)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.HtmlTemplateCache_", delCache);
            return(true);
        }
Exemplo n.º 25
0
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="emailAddress">发送的Email</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">删除成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByID(string emailAddress, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (emailAddress.IsNullEmpty())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Delete(EmailList._)
                        .Where(new Where()
                               .AndP(EmailList._EmailAddress, emailAddress, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value != 1)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.EmailListCache_", delCache);
            return(true);
        }
Exemplo n.º 26
0
        /// <summary>
        /// 天翼连接设置删除记录
        /// </summary>
        /// <param name="tianYiID">天翼连接设置编号</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">删除成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByID(int?tianYiID, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (tianYiID.IsNull())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Delete(TianYiSetting._)
                        .Where(new Where()
                               .AndP(TianYiSetting._TianYiID, tianYiID, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value != 1)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.TianYiSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="iP">IP地址</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">删除成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByID(string iP, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (iP.IsNullEmpty())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Delete(IpHistory._)
                        .Where(new Where()
                               .AndP(IpHistory._IP, iP, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value != 1)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.IpHistoryCache_", delCache);
            return(true);
        }
Exemplo n.º 28
0
        /// <summary>
        /// 修改记录
        /// </summary>
        /// <param name="ipHistory">实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool Update(IpHistory ipHistory, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (ipHistory.IP.IsNullEmpty())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Update(IpHistory._)
                        .SetP(IpHistory._CreateTime, ipHistory.CreateTime)
                        .Where(new Where()
                               .AndP(IpHistory._IP, ipHistory.IP, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.IpHistoryCache_", delCache);
            return(true);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 路由修改多条记录
        /// </summary>
        /// <param name="routeIDList">路由编号列表,用“,”号分隔</param>
        /// <param name="routeSetting">路由实体类</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">修改成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>修改是否成功</returns>
        public static bool UpdateByIDList(IEnumerable <int> routeIDList, RouteSetting routeSetting, string dbkey = "", Where where = null, string[] delCache = null)
        {
            int value = new SQL().Database(dbkey).Update(RouteSetting._)
                        .SetP(RouteSetting._RouteIP, routeSetting.RouteIP)
                        .SetP(RouteSetting._UserName, routeSetting.UserName)
                        .SetP(RouteSetting._RPassword, routeSetting.RPassword)
                        .SetP(RouteSetting._RouteConnect, routeSetting.RouteConnect)
                        .SetP(RouteSetting._RouteDisConnect, routeSetting.RouteDisConnect)
                        .SetP(RouteSetting._RouteMethod, routeSetting.RouteMethod)
                        .Where(new Where()
                               .And(RouteSetting._RouteID, "(" + routeIDList.Join(",") + ")", Operator.In)
                               ).Where(where).ToExec();

            if (value <= 0)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.RouteSettingCache_", delCache);
            return(true);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="smtpServer">SMTP服务器</param>
        /// <param name="smtpPort">SMTP端口</param>
        /// <param name="userName">登录用户名</param>
        /// <param name="where">修改时附加条件,统一的前面要加链接符(and、or等等)</param>
        /// <param name="delCache">删除成功后清理的CACHE key,支持正则</param>
        /// <param name="dbkey">存在数据库连接池中的连接key,为空时使用ConnString连接</param>
        /// <returns>删除是否成功</returns>
        public static bool DeleteByID(string smtpServer, int?smtpPort, string userName, string dbkey = "", Where where = null, string[] delCache = null)
        {
            if (smtpServer.IsNullEmpty() && smtpPort.IsNull() && userName.IsNullEmpty())
            {
                return(false);
            }
            int value = new SQL().Database(dbkey).Delete(SmtpList._)
                        .Where(new Where()
                               .AndP(SmtpList._SmtpServer, smtpServer, Operator.Equal, true)
                               .AndP(SmtpList._SmtpPort, smtpPort, Operator.Equal, true)
                               .AndP(SmtpList._UserName, userName, Operator.Equal, true)
                               ).Where(where).ToExec();

            if (value != 1)
            {
                return(false);
            }
            if (delCache.IsNull())
            {
                return(true);
            }
            Cache2.Remove("TH.Mailer.SmtpListCache_", delCache);
            return(true);
        }