Ejemplo n.º 1
0
        /// <param name="guid"> guid </param>
        public Comment Fetch(Guid guid)
        {
            using (IDataReader reader = DBComments.GetOne(guid))
            {
                if (reader.Read())
                {
                    Comment comment = new Comment();
                    comment.Guid             = new Guid(reader["Guid"].ToString());
                    comment.ParentGuid       = new Guid(reader["ParentGuid"].ToString());
                    comment.SiteGuid         = new Guid(reader["SiteGuid"].ToString());
                    comment.FeatureGuid      = new Guid(reader["FeatureGuid"].ToString());
                    comment.ModuleGuid       = new Guid(reader["ModuleGuid"].ToString());
                    comment.ContentGuid      = new Guid(reader["ContentGuid"].ToString());
                    comment.UserGuid         = new Guid(reader["UserGuid"].ToString());
                    comment.Title            = reader["Title"].ToString();
                    comment.UserComment      = reader["UserComment"].ToString();
                    comment.UserName         = reader["UserName"].ToString();
                    comment.UserEmail        = reader["UserEmail"].ToString();
                    comment.UserUrl          = reader["UserUrl"].ToString();
                    comment.UserIp           = reader["UserIp"].ToString();
                    comment.CreatedUtc       = Convert.ToDateTime(reader["CreatedUtc"]);
                    comment.LastModUtc       = Convert.ToDateTime(reader["LastModUtc"]);
                    comment.ModerationStatus = Convert.ToByte(reader["ModerationStatus"]);
                    comment.ModeratedBy      = new Guid(reader["ModeratedBy"].ToString());
                    comment.ModerationReason = reader["ModerationReason"].ToString();

                    //external properties not stored in mp_Comments
                    comment.UserId     = Convert.ToInt32(reader["UserID"]);
                    comment.PostAuthor = reader["PostAuthor"].ToString();

                    if (comment.PostAuthor.Length == 0)
                    {
                        comment.PostAuthor = comment.UserName;
                    }

                    comment.AuthorEmail = reader["AuthorEmail"].ToString();
                    if (comment.AuthorEmail.Length == 0)
                    {
                        comment.AuthorEmail = comment.UserEmail;
                    }

                    comment.UserRevenue          = Convert.ToDecimal(reader["UserRevenue"]);
                    comment.Trusted              = Convert.ToBoolean(reader["Trusted"]);
                    comment.PostAuthorAvatar     = reader["PostAuthorAvatar"].ToString();
                    comment.PostAuthorWebSiteUrl = reader["PostAuthorWebSiteUrl"].ToString();
                    if (comment.PostAuthorWebSiteUrl.Length == 0)
                    {
                        comment.PostAuthorWebSiteUrl = comment.UserUrl;
                    }

                    return(comment);
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Persists a new instance of Comment.
        /// </summary>
        /// <returns></returns>
        public void Save(Comment comment)
        {
            if (comment == null)
            {
                return;
            }

            if (comment.Guid == Guid.Empty)
            {
                comment.Guid = Guid.NewGuid();

                DBComments.Create(
                    comment.Guid,
                    comment.ParentGuid,
                    comment.SiteGuid,
                    comment.FeatureGuid,
                    comment.ModuleGuid,
                    comment.ContentGuid,
                    comment.UserGuid,
                    comment.Title,
                    comment.UserComment,
                    comment.UserName,
                    comment.UserEmail,
                    comment.UserUrl,
                    comment.UserIp,
                    comment.CreatedUtc,
                    comment.ModerationStatus,
                    comment.ModeratedBy,
                    comment.ModerationReason);
            }
            else
            {
                DBComments.Update(
                    comment.Guid,
                    comment.UserGuid,
                    comment.Title,
                    comment.UserComment,
                    comment.UserName,
                    comment.UserEmail,
                    comment.UserUrl,
                    comment.UserIp,
                    comment.LastModUtc,
                    comment.ModerationStatus,
                    comment.ModeratedBy,
                    comment.ModerationReason);
            }
        }
Ejemplo n.º 3
0
        public List <Comment> GetByContentAsc(Guid contentGuid)
        {
            IDataReader reader = DBComments.GetByContentAsc(contentGuid);

            return(LoadListFromReader(reader));
        }
Ejemplo n.º 4
0
        public List <Comment> GetByParentDesc(Guid parentGuid)
        {
            IDataReader reader = DBComments.GetByParentDesc(parentGuid);

            return(LoadListFromReader(reader));
        }
Ejemplo n.º 5
0
 public int GetCountByModule(Guid moduleGuid, int moderationStatus)
 {
     return(DBComments.GetCountByModule(moduleGuid, moderationStatus));
 }
Ejemplo n.º 6
0
 public int GetCountBySite(Guid siteGuid)
 {
     return(DBComments.GetCountBySite(siteGuid));
 }
Ejemplo n.º 7
0
 public bool DeleteByModule(Guid moduleGuid)
 {
     return(DBComments.DeleteByModule(moduleGuid));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Gets a count of Comment.
 /// </summary>
 public int GetCount(Guid contentGuid, int moderationStatus)
 {
     return(DBComments.GetCount(contentGuid, moderationStatus));
 }
Ejemplo n.º 9
0
 public bool DeleteByFeature(Guid featureGuid)
 {
     return(DBComments.DeleteBySite(featureGuid));
 }
Ejemplo n.º 10
0
 public bool DeleteBySite(Guid siteGuid)
 {
     return(DBComments.DeleteBySite(siteGuid));
 }
Ejemplo n.º 11
0
 public bool DeleteByParent(Guid parentGuid)
 {
     return(DBComments.DeleteByParent(parentGuid));
 }
Ejemplo n.º 12
0
 public bool DeleteByContent(Guid contentGuid)
 {
     return(DBComments.DeleteByContent(contentGuid));
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Deletes an instance of Comment. Returns true on success.
 /// </summary>
 /// <param name="guid"> guid </param>
 /// <returns>bool</returns>
 public bool Delete(Guid guid)
 {
     return(DBComments.Delete(guid));
 }