示例#1
0
        public ContentMetaLink FetchLink(Guid guid)
        {
            using (IDataReader reader = DBContentMetaLink.GetOne(
                       guid))
            {
                if (reader.Read())
                {
                    ContentMetaLink contentMetaLink = new ContentMetaLink();
                    contentMetaLink.Guid        = new Guid(reader["Guid"].ToString());
                    contentMetaLink.SiteGuid    = new Guid(reader["SiteGuid"].ToString());
                    contentMetaLink.ModuleGuid  = new Guid(reader["ModuleGuid"].ToString());
                    contentMetaLink.ContentGuid = new Guid(reader["ContentGuid"].ToString());
                    contentMetaLink.Rel         = reader["Rel"].ToString();
                    contentMetaLink.Href        = reader["Href"].ToString();
                    contentMetaLink.HrefLang    = reader["HrefLang"].ToString();
                    contentMetaLink.Rev         = reader["Rev"].ToString();
                    contentMetaLink.Type        = reader["Type"].ToString();
                    contentMetaLink.Media       = reader["Media"].ToString();
                    contentMetaLink.SortRank    = Convert.ToInt32(reader["SortRank"]);
                    contentMetaLink.CreatedUtc  = Convert.ToDateTime(reader["CreatedUtc"]);
                    contentMetaLink.CreatedBy   = new Guid(reader["CreatedBy"].ToString());
                    contentMetaLink.LastModUtc  = Convert.ToDateTime(reader["LastModUtc"]);
                    contentMetaLink.LastModBy   = new Guid(reader["LastModBy"].ToString());

                    return(contentMetaLink);
                }
            }

            return(null);
        }
        /// <summary>
        /// Persists a new instance of ContentMetaLink.
        /// </summary>
        /// <returns></returns>
        public void Save(ContentMetaLink contentMetaLink)
        {
            if (contentMetaLink == null)
            {
                return;
            }

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

                DBContentMetaLink.Create(
                    contentMetaLink.Guid,
                    contentMetaLink.SiteGuid,
                    contentMetaLink.ModuleGuid,
                    contentMetaLink.ContentGuid,
                    contentMetaLink.Rel,
                    contentMetaLink.Href,
                    contentMetaLink.HrefLang,
                    contentMetaLink.Rev,
                    contentMetaLink.Type,
                    contentMetaLink.Media,
                    contentMetaLink.SortRank,
                    contentMetaLink.CreatedUtc,
                    contentMetaLink.CreatedBy
                    );
            }
            else
            {
                DBContentMetaLink.Update(
                    contentMetaLink.Guid,
                    contentMetaLink.Rel,
                    contentMetaLink.Href,
                    contentMetaLink.HrefLang,
                    contentMetaLink.Rev,
                    contentMetaLink.Type,
                    contentMetaLink.Media,
                    contentMetaLink.SortRank,
                    contentMetaLink.LastModUtc,
                    contentMetaLink.LastModBy
                    );
            }
        }
示例#3
0
        /// <summary>
        /// gets the next sort rank
        /// </summary>
        /// <param name="contentGuid"></param>
        /// <returns>int</returns>
        public int GetNextLinkSortRank(Guid contentGuid)
        {
            int nextSort = DBContentMetaLink.GetMaxSortRank(contentGuid) + 2;

            return(nextSort);
        }
示例#4
0
 /// <summary>
 /// Deletes ContentMeta. Returns true on success.
 /// </summary>
 /// <param name="contentGuid"> contentGuid </param>
 /// <returns>bool</returns>
 public bool DeleteByContent(Guid contentGuid)
 {
     DBContentMetaLink.DeleteByContent(contentGuid);
     return(DBContentMeta.DeleteByContent(contentGuid));
 }
示例#5
0
 /// <summary>
 /// Deletes ContentMeta. Returns true on success.
 /// </summary>
 /// <param name="moduleGuid"> moduleGuid </param>
 /// <returns>bool</returns>
 public bool DeleteByModule(Guid moduleGuid)
 {
     DBContentMetaLink.DeleteByModule(moduleGuid);
     return(DBContentMeta.DeleteByModule(moduleGuid));
 }
示例#6
0
 /// <summary>
 /// Deletes ContentMeta. Returns true on success.
 /// </summary>
 public bool DeleteBySite(Guid siteGuid)
 {
     DBContentMetaLink.DeleteBySite(siteGuid);
     return(DBContentMeta.DeleteBySite(siteGuid));
 }
示例#7
0
 /// <summary>
 /// Deletes an instance of ContentMeta. Returns true on success.
 /// </summary>
 public bool DeleteLink(Guid guid)
 {
     return(DBContentMetaLink.Delete(guid));
 }
示例#8
0
        public List <ContentMetaLink> FetchLinksByContent(Guid contentGuid)
        {
            IDataReader reader = DBContentMetaLink.GetByContent(contentGuid);

            return(LoadLinkListFromReader(reader));
        }