Exemple #1
0
 /// <summary>
 /// 创建新的 blog_article 对象。
 /// </summary>
 /// <param name="id">id 属性的初始值。</param>
 /// <param name="typeid">typeid 属性的初始值。</param>
 /// <param name="cateid">cateid 属性的初始值。</param>
 /// <param name="catepath">catepath 属性的初始值。</param>
 /// <param name="articleid">articleid 属性的初始值。</param>
 /// <param name="parentid">parentid 属性的初始值。</param>
 /// <param name="layer">layer 属性的初始值。</param>
 /// <param name="subcount">subcount 属性的初始值。</param>
 /// <param name="userid">userid 属性的初始值。</param>
 /// <param name="username">username 属性的初始值。</param>
 /// <param name="title">title 属性的初始值。</param>
 /// <param name="summary">summary 属性的初始值。</param>
 /// <param name="content">content 属性的初始值。</param>
 /// <param name="viewcount">viewcount 属性的初始值。</param>
 /// <param name="orderid">orderid 属性的初始值。</param>
 /// <param name="replypermit">replypermit 属性的初始值。</param>
 /// <param name="status">status 属性的初始值。</param>
 /// <param name="ip">ip 属性的初始值。</param>
 /// <param name="favor">favor 属性的初始值。</param>
 /// <param name="against">against 属性的初始值。</param>
 /// <param name="iscommend">iscommend 属性的初始值。</param>
 /// <param name="istop">istop 属性的初始值。</param>
 /// <param name="createdate">createdate 属性的初始值。</param>
 /// <param name="lastreplydate">lastreplydate 属性的初始值。</param>
 /// <param name="lastreplyuser">lastreplyuser 属性的初始值。</param>
 /// <param name="lang">lang 属性的初始值。</param>
 /// <param name="articletypeid">articletypeid 属性的初始值。</param>
 /// <param name="rename">rename 属性的初始值。</param>
 /// <param name="isindextop">isindextop 属性的初始值。</param>
 public static blog_article Createblog_article(global::System.Int64 id, global::System.Int32 typeid, global::System.Int32 cateid, global::System.String catepath, global::System.Int64 articleid, global::System.Int64 parentid, global::System.Int32 layer, global::System.Int32 subcount, global::System.Int64 userid, global::System.String username, global::System.String title, global::System.String summary, global::System.String content, global::System.Int32 viewcount, global::System.Int32 orderid, global::System.Byte replypermit, global::System.Byte status, global::System.String ip, global::System.Int32 favor, global::System.Int32 against, global::System.Byte iscommend, global::System.Byte istop, global::System.DateTime createdate, global::System.DateTime lastreplydate, global::System.String lastreplyuser, global::System.String lang, global::System.Int32 articletypeid, global::System.String rename, global::System.Byte isindextop)
 {
     blog_article blog_article = new blog_article();
     blog_article.id = id;
     blog_article.typeid = typeid;
     blog_article.cateid = cateid;
     blog_article.catepath = catepath;
     blog_article.articleid = articleid;
     blog_article.parentid = parentid;
     blog_article.layer = layer;
     blog_article.subcount = subcount;
     blog_article.userid = userid;
     blog_article.username = username;
     blog_article.title = title;
     blog_article.summary = summary;
     blog_article.content = content;
     blog_article.viewcount = viewcount;
     blog_article.orderid = orderid;
     blog_article.replypermit = replypermit;
     blog_article.status = status;
     blog_article.ip = ip;
     blog_article.favor = favor;
     blog_article.against = against;
     blog_article.iscommend = iscommend;
     blog_article.istop = istop;
     blog_article.createdate = createdate;
     blog_article.lastreplydate = lastreplydate;
     blog_article.lastreplyuser = lastreplyuser;
     blog_article.lang = lang;
     blog_article.articletypeid = articletypeid;
     blog_article.rename = rename;
     blog_article.isindextop = isindextop;
     return blog_article;
 }
Exemple #2
0
        private void SendNoteReplyEmail(blog_article note)
        {
            if (Configinfo.IfSendReplyEmail == 2)
            {
                return;
            }
            if (note.parentid == 0)
            {
                return;
            }
            var parentItem = MyService.GetArticleById(note.parentid);
            if (parentItem.userid == 0 && string.IsNullOrEmpty(parentItem.title.Trim()))
            {
                return;
            }
            var email = parentItem.title.Trim();
            if (parentItem.userid > 0)
            {
                var user = MyService.GetUserInfoById(parentItem.userid);

                if (string.IsNullOrEmpty(user.email.Trim()) || !(user.isSendEmail ?? false))
                {
                    return;
                }
                email = user.email.Trim();
            }
            if (!Utils.IsValidEmail(email))
            { return; }
            var authorinfo = note.username.Trim();
            if (note.userid > 0)
            {
                authorinfo = "<a href=\"" + WebUtils.GetWebRootPath() + "/u/" + HttpUtility.UrlEncode(note.username, System.Text.Encoding.UTF8) + "\" target=\"_blank\">" + authorinfo + "</a>";
            }
            var emailCulture = Configinfo.IfIndependentContentViaLang == 1 ? res.Lang : Configinfo.DefaultLang;
            var etitle = "[" + Configinfo.Webtitle + " " + ResourceProvider.R(emailCulture, "Note.Reply.EmailTemplateTitle") + "]";
            var emailFormat = ResourceProvider.R(emailCulture, "Note.Reply.EmailTemplate");

            var category = MyService.GetCategoryById(note.cateid);

            var econtent = string.Format(emailFormat,
                              Utils.CutString(parentItem.content.ExRemoveHtml(), 100, "..."),
                              authorinfo,
                              note.createdate.ToString("yyyy/MM/dd HH:mm"),
                              note.content,
                              WebUtils.GetCateUrl(category) + "?f="+note.orderid
                              );
            new SendDelegate(WebUtils.SendSysMail).BeginInvoke(email, etitle, econtent, null, null);
        }
Exemple #3
0
 private static IEnumerable<blog_article> GetFloorArticles(IQueryable<blog_article> allData,blog_article article,List<blog_article> resultData)
 {
     if (article!=null && article.parentid > 0)
     {
         var parentArticle = allData.FirstOrDefault(x => x.id == article.parentid);
         if (parentArticle != null && parentArticle.status == 1)
         {
             resultData.Add(parentArticle);
         }
         else
         {
             resultData.Add(null);
         }
         return GetFloorArticles(allData, parentArticle, resultData);
     }
     resultData.Reverse();
     return resultData;
 }
Exemple #4
0
 /// <summary>
 /// 用于向 blog_article EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToblog_article(blog_article blog_article)
 {
     base.AddObject("blog_article", blog_article);
 }
Exemple #5
0
        public void UpdateArticle(blog_article aritcle)
        {
            var query = _entity.blog_article.FirstOrDefault(m => m.id == aritcle.id);
            if (query == null) return;
            query.typeid = aritcle.typeid;
            query.cateid = aritcle.cateid;
            query.catepath = aritcle.catepath;
            query.articleid = aritcle.articleid;
            query.parentid = aritcle.parentid;
            query.layer = aritcle.layer;
            query.subcount = aritcle.subcount;
            query.userid = aritcle.userid;
            query.username = aritcle.username;
            query.title = aritcle.title;
            query.summary = aritcle.summary;
            query.content = aritcle.content;
            query.viewcount = aritcle.viewcount;
            query.orderid = aritcle.orderid;
            query.replypermit = aritcle.replypermit;
            query.status = aritcle.status;
            query.ip = aritcle.ip;
            query.favor = aritcle.favor;
            query.against = aritcle.against;
            query.createdate = aritcle.createdate;
            query.istop = aritcle.istop;
            query.iscommend = aritcle.iscommend;
            query.status = aritcle.status;

            _entity.SaveChanges();
        }
Exemple #6
0
 public void RemoveArticle(blog_article article)
 {
     _entity.fun_articledel(article.id);
 }
Exemple #7
0
 public void DelArticle(blog_article article)
 {
     DelBaseArticle(article.id);
 }
Exemple #8
0
 public static blog_article Article()
 {
     var article = new blog_article();
     return article;
 }
Exemple #9
0
 public static string GetYqUrl(blog_article article)
 {
     string url;
     var articleurl = article.rename.Trim().Length > 0 ? article.rename.Trim() : article.articleid.ToString();
     if (article.typeid == 1)
     {
         if (Configinfo.IfWebStatic == 1 && GetCurrentTheme() == GetLangTemplate(Configinfo.DefaultLang))
         {
             url = GetWebRootPath()+"/" + GetStaticFolder(article.createdate, resModelWeb.Lang).Trim('/') + "/" + articleurl + ".html";
         }
         else
         {
             url = GetYqUrl(articleurl, 1);
         }
     }
     else
     {
         url = GetYqUrl(articleurl, article.typeid);
     }
     return url;
 }