Beispiel #1
0
 public AlbumModel GetAlbum(blog_varticle varticle)
 {
     var album = new AlbumModel();
     if (varticle != null)
     {
         album.Varticle = varticle;
         AlbumPhotoModel cover;
         album.ImageList = GetAlbumPhotoList(varticle.content, out cover);
         album.Cover = cover;
         album.ImgCount = album.ImageList.Count();
         album.Category = GetCategoryById(varticle.cateid);
     }
     return album;
 }
Beispiel #2
0
 public long AddArticle(blog_varticle varticle)
 {
     string lang;
     var obj = varticle;
     if (obj.parentid > 0)
     {
         lang = obj.layer == 0 ? GetArticleById(obj.parentid).lang : GetArticleById(obj.articleid).lang;
     }
     else
     {
         lang = WebUtils.GetCurrentLangStr();
     }
     obj.lang = lang;
     _entity.blog_varticle.AddObject(obj);
     _entity.SaveChanges();
     return obj.id;
 }
Beispiel #3
0
        public static blog_varticle VArticle()
        {
            var varticle = new blog_varticle
                               {
                                   articleid = 0,
                                   typeid = 0,
                                   cateid = 0,
                                   catepath = string.Empty,
                                   title = string.Empty,
                                   summary = string.Empty,
                                   content = string.Empty,
                                   tags = string.Empty,
                                   layer = 0,
                                   orderid = 1,
                                   parentid = 0,
                                   replypermit = 1,
                                   seodescription = string.Empty,
                                   seokeywords = string.Empty,
                                   seometas = string.Empty,
                                   seotitle = string.Empty,
                                   rename = string.Empty,
                                   status = 1,
                                   userid = 0,
                                   username = string.Empty,
                                   iscommend = 2,
                                   istop = 2,
                                   isindextop = 2,
                                   articletypeid = 0,
                                   viewcount = 0,
                                   createdate = DateTime.Now,
                                   lastreplydate = DateTime.Now,
                                   ip = Utils.GetIp()
                               };

            return varticle;
        }
Beispiel #4
0
 private ArticleViewModel ConvertToArticleViewModel(blog_varticle varticle)
 {
     return new ArticleViewModel
     {
         WebTitle = WebUtils.MyString(varticle.seotitle, varticle.title),
         WebPath = MyService.GetCategoryPathUrl(varticle.catepath),
         Seo = WebUtils.GetSeoInfo(varticle),
         ArticleInfo = varticle,
         Category = MyService.GetCategoryById(varticle.cateid)
     };
 }
Beispiel #5
0
 /// <summary>
 /// 用于向 blog_varticle EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToblog_varticle(blog_varticle blog_varticle)
 {
     base.AddObject("blog_varticle", blog_varticle);
 }
Beispiel #6
0
 /// <summary>
 /// 创建新的 blog_varticle 对象。
 /// </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>
 /// <param name="seotitle">seotitle 属性的初始值。</param>
 /// <param name="seodescription">seodescription 属性的初始值。</param>
 /// <param name="seokeywords">seokeywords 属性的初始值。</param>
 /// <param name="seometas">seometas 属性的初始值。</param>
 /// <param name="tags">tags 属性的初始值。</param>
 public static blog_varticle Createblog_varticle(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, global::System.String seotitle, global::System.String seodescription, global::System.String seokeywords, global::System.String seometas, global::System.String tags)
 {
     blog_varticle blog_varticle = new blog_varticle();
     blog_varticle.id = id;
     blog_varticle.typeid = typeid;
     blog_varticle.cateid = cateid;
     blog_varticle.catepath = catepath;
     blog_varticle.articleid = articleid;
     blog_varticle.parentid = parentid;
     blog_varticle.layer = layer;
     blog_varticle.subcount = subcount;
     blog_varticle.userid = userid;
     blog_varticle.username = username;
     blog_varticle.title = title;
     blog_varticle.summary = summary;
     blog_varticle.content = content;
     blog_varticle.viewcount = viewcount;
     blog_varticle.orderid = orderid;
     blog_varticle.replypermit = replypermit;
     blog_varticle.status = status;
     blog_varticle.ip = ip;
     blog_varticle.favor = favor;
     blog_varticle.against = against;
     blog_varticle.iscommend = iscommend;
     blog_varticle.istop = istop;
     blog_varticle.createdate = createdate;
     blog_varticle.lastreplydate = lastreplydate;
     blog_varticle.lastreplyuser = lastreplyuser;
     blog_varticle.lang = lang;
     blog_varticle.articletypeid = articletypeid;
     blog_varticle.rename = rename;
     blog_varticle.isindextop = isindextop;
     blog_varticle.seotitle = seotitle;
     blog_varticle.seodescription = seodescription;
     blog_varticle.seokeywords = seokeywords;
     blog_varticle.seometas = seometas;
     blog_varticle.tags = tags;
     return blog_varticle;
 }
Beispiel #7
0
        public void UpdateVArticle(blog_varticle varticle)
        {
            var obj = _entity.blog_varticle.FirstOrDefault(m => m.id == varticle.id);
            if (obj == null) return;
            obj.title = varticle.title;
            obj.cateid = varticle.cateid;
            obj.catepath = varticle.catepath;
            obj.summary = varticle.summary;
            obj.content = varticle.content;
            obj.tags = varticle.tags;
            obj.seodescription = varticle.seodescription;
            obj.seokeywords = varticle.seokeywords;
            obj.seometas = varticle.seometas;
            obj.seotitle = varticle.seotitle;
            obj.rename = varticle.rename;
            obj.status = varticle.status;
            obj.replypermit = varticle.replypermit;
            obj.iscommend = varticle.iscommend;
            obj.istop = varticle.istop;
            obj.isindextop = varticle.isindextop;

            _entity.SaveChanges();
        }
Beispiel #8
0
        public void UpdateArticle(blog_varticle varitcle)
        {
            var query = _entity.blog_article.FirstOrDefault(m => m.id == varitcle.id);
            if (query == null) return;
            query.typeid = varitcle.typeid;
            query.cateid = varitcle.cateid;
            query.catepath = varitcle.catepath;
            query.articleid = varitcle.articleid;
            query.parentid = varitcle.parentid;
            query.layer = varitcle.layer;
            query.subcount = varitcle.subcount;
            query.userid = varitcle.userid;
            query.username = varitcle.username;
            query.title = varitcle.title;
            query.summary = varitcle.summary;
            query.content = varitcle.content;
            query.viewcount = varitcle.viewcount;
            query.orderid = varitcle.orderid;
            query.replypermit = varitcle.replypermit;
            query.status = varitcle.status;
            query.ip = varitcle.ip;
            query.favor = varitcle.favor;
            query.against = varitcle.against;
            query.createdate = varitcle.createdate;
            query.istop = varitcle.istop;
            query.iscommend = varitcle.iscommend;
            query.status = varitcle.status;

            _entity.SaveChanges();
        }
Beispiel #9
0
 public blog_varticle GetPreviewVArticle(blog_varticle varticle, int tid, int cid = 0, string field = "")
 {
     var re = new blog_varticle();
     var query = GetVArticles(tid, cid, 0);
     if (field != "")
     {
         switch (field)
         {
             case "lastpost":
                 re = query.Where(m => m.lastreplydate < varticle.lastreplydate).OrderByDescending(m => m.lastreplydate).FirstOrDefault();
                 break;
         }
     }
     else
     {
         re = query.Where(m => m.id < varticle.id).OrderByDescending(m => m.id).FirstOrDefault();
     }
     return re;
 }
Beispiel #10
0
 public blog_varticle GetPreviewVArticle(blog_varticle varticle)
 {
     return GetPreviewVArticle(varticle, varticle.typeid);
 }
Beispiel #11
0
 public blog_varticle GetNextVArticle(blog_varticle varticle)
 {
     return GetNextVArticle(varticle, varticle.typeid);
 }
Beispiel #12
0
 public static string GetYqUrl(blog_varticle varticle)
 {
     string url;
     if (varticle.typeid == 1)
     {
         var pageId = varticle.articleid;
         if (Configinfo.IfWebStatic == 1 && GetCurrentTheme() == GetLangTemplate(Configinfo.DefaultLang))
         {
             url = GetWebRootPath() +"/"+ GetStaticFolder(varticle.createdate, resModelWeb.Lang).Trim('/') + "/";
             if (varticle.rename.Trim().Length > 0)
             { url += varticle.rename.Trim() + ".html"; }
             else
             { url += pageId + ".html"; }
         }
         else
         {
             url = GetYqUrl(varticle.url, 1);
         }
     }
     else
     {
         var articleurl = varticle.rename.Trim().Length > 0 ? varticle.rename.Trim() : varticle.articleid.ToString();
         url = GetYqUrl(articleurl, varticle.typeid);
     }
     return url;
 }
Beispiel #13
0
 public static string GetSeoInfo(blog_varticle varticle)
 {
     var metaDescription = string.IsNullOrWhiteSpace(varticle.seodescription) ? "" : "<meta content=\"" + varticle.seodescription + "\" name=\"Description\" />\r\n";
     var metaKeywords = string.IsNullOrWhiteSpace(varticle.seokeywords) ? "" : "<meta content=\"" + varticle.seokeywords + "\" name=\"keywords\" />\r\n";
     var metaInfo = string.IsNullOrWhiteSpace(varticle.seometas) ? "" : varticle.seometas + "\r\n";
     return metaDescription + metaKeywords + metaInfo;
 }
Beispiel #14
0
 public static string GetArticleUrl(blog_varticle varticle)
 {
     return !string.IsNullOrWhiteSpace(varticle.rename) ? "/article/" + varticle.rename : "/archive/" + varticle.id;
 }