public static void FillPost(IDataReader dr, BSPost bsPost)
    {
        bsPost.Title        = dr["Title"].ToString();
        bsPost.PostID       = Convert.ToInt32(dr["PostID"]);
        bsPost.Code         = dr["Code"].ToString();
        bsPost.Content      = dr["Content"].ToString();
        bsPost.State        = (PostStates)Convert.ToInt16(dr["State"]);
        bsPost.AddComment   = Convert.ToBoolean(dr["AddComment"]);
        bsPost.Categories   = bsPost.GetCategoriesHtml();
        bsPost.Tags         = bsPost.GetTagsHtml();
        bsPost.CommentCount = bsPost.GetComments(CommentStates.Approved).Count;
        bsPost.ReadCount    = Convert.ToInt32(dr["ReadCount"]);
        bsPost.UserID       = Convert.ToInt32(dr["UserID"]);
        bsPost.UserName     = BSUser.GetUser(bsPost.UserID).UserName;
        bsPost.Date         = Convert.ToDateTime(dr["CreateDate"]);
        bsPost.UpdateDate   = dr["ModifyDate"] == DBNull.Value
                              ? Convert.ToDateTime(dr["CreateDate"])
                              : Convert.ToDateTime(dr["ModifyDate"]);
        bsPost.Link         = BSHelper.GetLink(bsPost);
        bsPost.Type         = (PostTypes)Convert.ToInt16(dr["Type"]);
        bsPost.Show         = (PostVisibleTypes)Convert.ToInt16(dr["Show"]);
        bsPost.ParentID     = Convert.ToInt32(dr["ParentID"]);
        bsPost.LanguageCode = Convert.ToString(dr["LanguageCode"]);

        bsPost.Metas = BSMeta.GetMetas(bsPost.PostID);
    }
Example #2
0
    public static void FillPost(IDataReader dr, BSPost bsPost)
    {
        bsPost.Title = dr["Title"].ToString();
        bsPost.PostID = Convert.ToInt32(dr["PostID"]);
        bsPost.Code = dr["Code"].ToString();
        bsPost.Content = dr["Content"].ToString();
        bsPost.State = (PostStates)Convert.ToInt16(dr["State"]);
        bsPost.AddComment = Convert.ToBoolean(dr["AddComment"]);
        bsPost.Categories = bsPost.GetCategoriesHtml();
        bsPost.Tags = bsPost.GetTagsHtml();
        bsPost.CommentCount = bsPost.GetComments(CommentStates.Approved).Count;
        bsPost.ReadCount = Convert.ToInt32(dr["ReadCount"]);
        bsPost.UserID = Convert.ToInt32(dr["UserID"]);
        bsPost.UserName = BSUser.GetUser(bsPost.UserID).UserName;
        bsPost.Date = Convert.ToDateTime(dr["CreateDate"]);
        bsPost.UpdateDate = dr["ModifyDate"] == DBNull.Value
                              ? Convert.ToDateTime(dr["CreateDate"])
                              : Convert.ToDateTime(dr["ModifyDate"]);
        bsPost.Link = BSHelper.GetLink(bsPost);
        bsPost.Type = (PostTypes)Convert.ToInt16(dr["Type"]);
        bsPost.Show = (PostVisibleTypes)Convert.ToInt16(dr["Show"]);
        bsPost.ParentID = Convert.ToInt32(dr["ParentID"]);
        bsPost.LanguageCode = Convert.ToString(dr["LanguageCode"]);

        bsPost.Metas = BSMeta.GetMetas(bsPost.PostID);
    }