예제 #1
0
        /// <summary>
        /// 添加短信模板
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        internal bool AddSMSTempletContent(SMSTemplet content)
        {
            bool ok = false;

            try
            {
                ok = SMSTempletDB.Add(content);
                if (ok)
                {
                    CacheManager <SMSTemplet> .Instance.Set(content.TempletID, content);
                }
            }
            catch
            {
            }
            return(ok);
        }
예제 #2
0
        /// <summary>
        /// 修改模板内容
        /// </summary>
        /// <param name="content"></param>
        /// <returns></returns>
        internal bool UpdateSMSTemplet(SMSTemplet content)
        {
            bool ok = false;

            try
            {
                ok = SMSTempletDB.UpdateContent(content);
                if (ok)
                {
                    CacheManager <SMSTemplet> .Instance.Set(content.TempletID, content);
                }
                return(ok);
            }
            catch (Exception ex)
            {
            }
            return(false);
        }
예제 #3
0
        internal bool DelSMSTemplet(string templetID)
        {
            bool ok = false;

            try
            {
                ok = SMSTempletDB.Del(templetID);
                if (ok)
                {
                    CacheManager <SMSTemplet> .Instance.Del(templetID);
                }
                return(ok);
            }
            catch (Exception ex)
            {
            }
            return(false);
        }
예제 #4
0
        public void LoadAccountCache()
        {
            List <SMS.Model.EnterpriseUser> list = EnterpriseUserDB.GetEnterprises();

            foreach (var v in list)
            {
                if (!string.IsNullOrEmpty(v.Signature))
                {
                    v.Signature = v.Signature.Substring(1, v.Signature.Length - 2);
                }
                CacheManager <SMS.Model.EnterpriseUser> .Instance.Set(v.AccountCode, v);
            }


            List <SMSTemplet> sc = SMSTempletDB.GetSMSTempets();

            foreach (var v in sc)
            {
                CacheManager <SMSTemplet> .Instance.Set(v.TempletID, v);
            }
        }
예제 #5
0
        /// <summary>
        /// 获取模板内容
        /// </summary>
        /// <param name="templetID"></param>
        /// <returns></returns>
        internal SMSTemplet GetSMSTemplet(string templetID)
        {
            SMSTemplet content = CacheManager <SMSTemplet> .Instance.Get(templetID);

            if (content == null)
            {
                //数据库操作
                try
                {
                    content = SMSTempletDB.GetSMSTempetContent(templetID);
                    if (content != null)
                    {
                        CacheManager <SMSTemplet> .Instance.Set(content.TempletID, content);
                    }
                }
                catch (Exception ex)
                {
                    return(null);
                }
            }
            return(content);
        }