예제 #1
0
        private List <ContentMetaLink> LoadLinkListFromReader(IDataReader reader)
        {
            List <ContentMetaLink> contentMetaLinkList = new List <ContentMetaLink>();

            try
            {
                while (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());
                    contentMetaLinkList.Add(contentMetaLink);
                }
            }
            finally
            {
                reader.Close();
            }

            return(contentMetaLinkList);
        }
예제 #2
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);
        }
예제 #3
0
        /// <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
                    );
            }
        }
예제 #4
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByHrefLang(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.HrefLang.CompareTo(contentMetaLink2.HrefLang));
 }
        void grdMetaLinks_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (productGuid == Guid.Empty) { return; }
            if (store == null) { return; }
            Product product = new Product(productGuid);
            if (product.StoreGuid != store.Guid) { return; }

            GridView grid = (GridView)sender;

            Guid guid = new Guid(grid.DataKeys[e.RowIndex].Value.ToString());
            TextBox txtRel = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtRel");
            TextBox txtHref = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtHref");
            TextBox txtHrefLang = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtHrefLang");

            ContentMetaLink meta = null;
            if (guid != Guid.Empty)
            {
                meta = metaRepository.FetchLink(guid);
            }
            else
            {
                meta = new ContentMetaLink();
                if (siteUser != null) { meta.CreatedBy = siteUser.UserGuid; }
                meta.SortRank = metaRepository.GetNextLinkSortRank(product.Guid);
                meta.ModuleGuid = store.ModuleGuid;
            }

            if (meta != null)
            {
                meta.SiteGuid = siteSettings.SiteGuid;
                meta.ContentGuid = product.Guid;
                meta.Rel = txtRel.Text;
                meta.Href = txtHref.Text;
                meta.HrefLang = txtHrefLang.Text;

                if (siteUser != null) { meta.LastModBy = siteUser.UserGuid; }
                metaRepository.Save(meta);

                product.CompiledMeta = metaRepository.GetMetaString(product.Guid);
                product.Save();

            }

            grid.EditIndex = -1;
            grdMetaLinks.Columns[2].Visible = true;
            BindMetaLinks();
            updMetaLinks.Update();
        }
예제 #6
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByHrefLang(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.HrefLang.CompareTo(contentMetaLink2.HrefLang);
 }
예제 #7
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByCreatedUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.CreatedUtc.CompareTo(contentMetaLink2.CreatedUtc));
 }
예제 #8
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByMedia(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.Media.CompareTo(contentMetaLink2.Media));
 }
예제 #9
0
        void grdMetaLinks_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            if (blog == null) { return; }
            if (blog.BlogGuid == Guid.Empty) { return; }

            GridView grid = (GridView)sender;

            Guid guid = new Guid(grid.DataKeys[e.RowIndex].Value.ToString());
            TextBox txtRel = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtRel");
            TextBox txtHref = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtHref");
            TextBox txtHrefLang = (TextBox)grid.Rows[e.RowIndex].Cells[1].FindControl("txtHrefLang");
            SiteUser currentUser = SiteUtils.GetCurrentSiteUser();
            ContentMetaLink meta = null;
            if (guid != Guid.Empty)
            {
                meta = metaRepository.FetchLink(guid);
            }
            else
            {
                meta = new ContentMetaLink();
                Module module = new Module(moduleId);
                meta.ModuleGuid = module.ModuleGuid;
                if (currentUser != null) { meta.CreatedBy = currentUser.UserGuid; }
                meta.SortRank = metaRepository.GetNextLinkSortRank(blog.BlogGuid);
            }

            if (meta != null)
            {
                meta.SiteGuid = siteSettings.SiteGuid;
                meta.ContentGuid = blog.BlogGuid;
                meta.Rel = txtRel.Text;
                meta.Href = txtHref.Text;
                meta.HrefLang = txtHrefLang.Text;

                if (currentUser != null) { meta.LastModBy = currentUser.UserGuid; }
                metaRepository.Save(meta);

                blog.CompiledMeta = metaRepository.GetMetaString(blog.BlogGuid);
                blog.Save();

            }

            grid.EditIndex = -1;
            grdMetaLinks.Columns[2].Visible = true;
            BindMetaLinks();
            updMetaLinks.Update();
        }
예제 #10
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareBySortRank(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.SortRank.CompareTo(contentMetaLink2.SortRank);
 }
예제 #11
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByType(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.Type.CompareTo(contentMetaLink2.Type);
 }
예제 #12
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByRev(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.Rev.CompareTo(contentMetaLink2.Rev);
 }
예제 #13
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByMedia(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.Media.CompareTo(contentMetaLink2.Media);
 }
예제 #14
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByLastModUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.LastModUtc.CompareTo(contentMetaLink2.LastModUtc);
 }
예제 #15
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByRev(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.Rev.CompareTo(contentMetaLink2.Rev));
 }
예제 #16
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;
        }
예제 #17
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByType(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.Type.CompareTo(contentMetaLink2.Type));
 }
예제 #18
0
        /// <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);

            }
        }
예제 #19
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareBySortRank(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.SortRank.CompareTo(contentMetaLink2.SortRank));
 }
예제 #20
0
        private List<ContentMetaLink> LoadLinkListFromReader(IDataReader reader)
        {
            List<ContentMetaLink> contentMetaLinkList = new List<ContentMetaLink>();

            try
            {
                while (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());
                    contentMetaLinkList.Add(contentMetaLink);

                }
            }
            finally
            {
                reader.Close();
            }

            return contentMetaLinkList;
        }
예제 #21
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByLastModUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return(contentMetaLink1.LastModUtc.CompareTo(contentMetaLink2.LastModUtc));
 }
예제 #22
0
 /// <summary>
 /// Compares 2 instances of ContentMetaLink.
 /// </summary>
 public static int CompareByCreatedUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2)
 {
     return contentMetaLink1.CreatedUtc.CompareTo(contentMetaLink2.CreatedUtc);
 }