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); }
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 ); } }
/// <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(); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByHrefLang(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.HrefLang.CompareTo(contentMetaLink2.HrefLang); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByCreatedUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.CreatedUtc.CompareTo(contentMetaLink2.CreatedUtc)); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByMedia(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.Media.CompareTo(contentMetaLink2.Media)); }
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(); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareBySortRank(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.SortRank.CompareTo(contentMetaLink2.SortRank); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByType(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.Type.CompareTo(contentMetaLink2.Type); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByRev(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.Rev.CompareTo(contentMetaLink2.Rev); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByMedia(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.Media.CompareTo(contentMetaLink2.Media); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByLastModUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.LastModUtc.CompareTo(contentMetaLink2.LastModUtc); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByRev(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.Rev.CompareTo(contentMetaLink2.Rev)); }
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> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByType(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.Type.CompareTo(contentMetaLink2.Type)); }
/// <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); } }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareBySortRank(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.SortRank.CompareTo(contentMetaLink2.SortRank)); }
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; }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByLastModUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return(contentMetaLink1.LastModUtc.CompareTo(contentMetaLink2.LastModUtc)); }
/// <summary> /// Compares 2 instances of ContentMetaLink. /// </summary> public static int CompareByCreatedUtc(ContentMetaLink contentMetaLink1, ContentMetaLink contentMetaLink2) { return contentMetaLink1.CreatedUtc.CompareTo(contentMetaLink2.CreatedUtc); }