/// <summary> /// Shows the edit details. /// </summary> /// <param name="shortLink">The shortLink.</param> private void ShowEditDetails(Rock.Model.PageShortLink shortLink) { SetEditMode(true); LoadSites(); ddlSite.SetValue(shortLink.SiteId); tbToken.Text = shortLink.Token; tbUrl.Text = shortLink.Url; }
/// <summary> /// Clones this PageShortLink object to a new PageShortLink object /// </summary> /// <param name="source">The source.</param> /// <param name="deepCopy">if set to <c>true</c> a deep copy is made. If false, only the basic entity properties are copied.</param> /// <returns></returns> public static PageShortLink Clone(this PageShortLink source, bool deepCopy) { if (deepCopy) { return(source.Clone() as PageShortLink); } else { var target = new PageShortLink(); target.CopyPropertiesFrom(source); return(target); } }
/// <summary> /// Gets the unique token. /// </summary> /// <param name="siteId">The site identifier.</param> /// <param name="length">The length.</param> /// <returns></returns> public string GetUniqueToken(int siteId, int length) { string token = PageShortLink.GetRandomToken(length); while (this.Queryable().AsNoTracking() .Any(t => t.SiteId == siteId && t.Token == token)) { token = PageShortLink.GetRandomToken(length); } return(token); }
/// <summary> /// Copies the properties from another PageShortLink object to this PageShortLink object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this PageShortLink target, PageShortLink source) { target.Id = source.Id; target.ForeignGuid = source.ForeignGuid; target.ForeignKey = source.ForeignKey; target.SiteId = source.SiteId; target.Token = source.Token; target.Url = source.Url; target.CreatedDateTime = source.CreatedDateTime; target.ModifiedDateTime = source.ModifiedDateTime; target.CreatedByPersonAliasId = source.CreatedByPersonAliasId; target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; target.Guid = source.Guid; target.ForeignId = source.ForeignId; }
/// <summary> /// Shows the readonly details. /// </summary> /// <param name="shortLink">The shortLink.</param> private void ShowReadonlyDetails(Rock.Model.PageShortLink shortLink) { SetEditMode(false); hfShortLinkId.SetValue(shortLink.Id); lSite.Text = shortLink.Site.Name; lToken.Text = shortLink.Token; lUrl.Text = shortLink.Url; var url = shortLink.Site.DefaultDomainUri.ToString(); string link = url.EnsureTrailingForwardslash() + shortLink.Token; btnCopy.Attributes["data-clipboard-text"] = link; }