public ThumbItemViewModel(string url, string thumbUrl, string caption, IEntryBase entry = null) { Url = url; ThumbUrl = thumbUrl; Caption = caption; Entry = entry; }
public ObjectRefContract(IEntryBase entry) { ParamIs.NotNull(() => entry); Id = entry.Id; NameHint = entry.DefaultName; }
public EntryRefContract(IEntryBase entryBase) { ParamIs.NotNull(() => entryBase); EntryType = entryBase.EntryType; Id = entryBase.Id; }
public EntryRef(IEntryBase entryBase) { ParamIs.NotNull(() => entryBase); EntryType = entryBase.EntryType; Id = entryBase.Id; }
public EntryRevertedContract(IEntryBase entryBase, IEnumerable<string> warnings) { ParamIs.NotNull(() => entryBase); ParamIs.NotNull(() => warnings); Id = entryBase.Id; Warnings = warnings.ToArray(); }
public EntryRevertedContract(IEntryBase entryBase, IEnumerable <string> warnings) { ParamIs.NotNull(() => entryBase); ParamIs.NotNull(() => warnings); Id = entryBase.Id; Warnings = warnings.ToArray(); }
private string GetArtistString(IEntryBase entry, ContentLanguagePreference languagePreference) { if (entry is Album) return ((Album)entry).ArtistString[languagePreference]; else if (entry is Song) return ((Song)entry).ArtistString[languagePreference]; else return null; }
private static bool IsVerifiedFor(IUserPermissionContext permissionContext, IEntryBase entry) { return (entry != null && entry.EntryType == EntryType.Artist && permissionContext.IsLoggedIn && permissionContext.LoggedUser.VerifiedArtist && permissionContext.LoggedUser.OwnedArtistEntries.Any(a => a.Artist.Id == entry.Id)); }
public TrashedEntry(IEntryBase entry, XDocument data, User user) : this() { ParamIs.NotNull(() => entry); Data = data; EntryType = entry.EntryType; Name = entry.DefaultName; User = user; }
public string CreateEntryLink(IEntryBase entry) { if (entry.EntryType == EntryType.Tag) { var url = VocaUriBuilder.MergeUrls(baseUrl, string.Format("Tag/Details/{0}", entry.DefaultName)); return(string.Format("<a href=\"{0}\">{1}</a>", url, entry.DefaultName)); } return(CreateEntryLink(entry.EntryType, entry.Id, entry.DefaultName)); }
public string CreateEntryLink(IEntryBase entry) { if (entry.EntryType == EntryType.Tag) { var url = VocaUriBuilder.MergeUrls(baseUrl, string.Format("Tag/Details/{0}", entry.DefaultName)); return string.Format("<a href=\"{0}\">{1}</a>", url, entry.DefaultName); } return CreateEntryLink(entry.EntryType, entry.Id, entry.DefaultName); }
public TrashedEntry(IEntryBase entry, XDocument data, User user, string notes = "") : this() { ParamIs.NotNull(() => entry); Data = data; EntryId = entry.Id; EntryType = entry.EntryType; Name = entry.DefaultName; User = user; Notes = notes; }
private string GetMime(IEntryBase entry) { var album = entry as Album; if (album != null && album.CoverPictureData != null) return album.CoverPictureMime; var artist = entry as Artist; if (artist != null && artist.Picture != null) return artist.PictureMime; return string.Empty; }
private string GetArtistString(IEntryBase entry, ContentLanguagePreference languagePreference) { if (entry is Album) { return(((Album)entry).ArtistString[languagePreference]); } else if (entry is Song) { return(((Song)entry).ArtistString[languagePreference]); } else { return(null); } }
private static bool IsVerifiedFor(IUserPermissionContext userContext, IEntryBase entry) { if (entry == null || !userContext.IsLoggedIn || !userContext.LoggedUser.VerifiedArtist || !userContext.LoggedUser.Active) { return(false); } if (IsDirectlyVerifiedFor(userContext, entry)) { return(true); } var entryWithArtists = entry as IEntryWithArtists; return(entryWithArtists != null && entryWithArtists.ArtistList.Any(a => !ArtistHelper.IsVoiceSynthesizer(a.ArtistType) && IsDirectlyVerifiedFor(userContext, a))); }
public string GetEntrySubTypeName(IEntryBase entryBase, IEnumTranslations enumTranslations, CultureInfo culture) { switch (entryBase) { case Album a: return(enumTranslations.Translation(a.DiscType, culture)); case Artist a: return(enumTranslations.Translation(a.ArtistType, culture)); case Song s: return(enumTranslations.Translation(s.SongType, culture)); } return(string.Empty); }
private string GetMime(IEntryBase entry) { var album = entry as Album; if (album != null && album.CoverPictureData != null) { return(album.CoverPictureMime); } var artist = entry as Artist; if (artist != null && artist.Picture != null) { return(artist.PictureMime); } return(string.Empty); }
public EntryWithTagUsagesContract(IEntryBase entry, IEnumerable<TagUsage> tagUsages) : base(entry) { TagUsages = tagUsages.Select(u => new TagUsageWithVotesContract(u)).ToArray(); }
public EntryWithTagUsagesContract(IEntryBase entry, IEnumerable <TagUsage> tagUsages, ContentLanguagePreference languagePreference, IUserPermissionContext userContext, IUserIconFactory userIconFactory) : base(entry) { CanRemoveTagUsages = EntryPermissionManager.CanRemoveTagUsages(userContext, entry); TagUsages = tagUsages.Select(u => new TagUsageWithVotesContract(u, languagePreference, userIconFactory)).ToArray(); }
private string GetSongThumbUrl(IEntryBase entry) { return(entry is Song ? VideoServiceHelper.GetThumbUrl(((Song)entry).PVs.PVs) : string.Empty); }
public string CreateEntryLink(IEntryBase entry) { return string.Empty; }
public static string EntryLink(IEntryBase entry) { ParamIs.NotNull(() => entry); return GetCode(string.Format("{0}={1}", entry.EntryType, entry.Id), entry.DefaultName); }
/*private readonly UrlHelper url; * * public EntryAnchorFactory(UrlHelper url) { * * ParamIs.NotNull(() => url); * * this.url = url; * * } * * public string CreateEntryLink(IEntryBase entry) { * * return string.Format("<a href=\"{0}\">{1}</a>", * url.Action("Details", entry.EntryType.ToString(), new { id = entry.Id }), * entry.DefaultName); * * * }*/ public string CreateEntryLink(IEntryBase entry) { return(string.Format("<a href=\"{0}\">{1}</a>", string.Format("/{0}/Details/{1}", entry.EntryType, entry.Id), entry.DefaultName)); }
public string GetHtml(IEntryBase entry, string propertyName, string rawValue) { var key = Key(entry, propertyName); return cache.GetHtml(rawValue, key); }
public static string SongDetails(this UrlHelper urlHelper, IEntryBase song, int?albumId = null) { ParamIs.NotNull(() => song); return(urlHelper.Action("Details", "Song", new { id = song.Id, albumId })); }
public EntryBaseContract(IEntryBase entry) : base(entry) { DefaultName = entry.DefaultName; }
public static ObjectRefContract Create(IEntryBase entry) { return(entry != null ? new ObjectRefContract(entry) : null); }
/*private readonly UrlHelper url; public EntryAnchorFactory(UrlHelper url) { ParamIs.NotNull(() => url); this.url = url; } public string CreateEntryLink(IEntryBase entry) { return string.Format("<a href=\"{0}\">{1}</a>", url.Action("Details", entry.EntryType.ToString(), new { id = entry.Id }), entry.DefaultName); }*/ public string CreateEntryLink(IEntryBase entry) { return string.Format("<a href=\"{0}\">{1}</a>", string.Format("/{0}/Details/{1}", entry.EntryType, entry.Id), entry.DefaultName); }
public string CreateEntryLink(IEntryBase entry, string?slug = null) { return(CreateEntryLink(entry.EntryType, entry.Id, entry.DefaultName, slug)); }
public static string GetFullEntryUrl(this IEntryLinkFactory entryLinkFactory, IEntryBase entryBase, string slug = null) { return(entryLinkFactory.GetFullEntryUrl(entryBase.EntryType, entryBase.Id, slug)); }
public EntryThumb(IEntryBase entry, string mime) { Entry = entry; Mime = mime; }
private string GetSongThumbUrl(IEntryBase entry) { return (entry is Song ? VideoServiceHelper.GetThumbUrl(((Song)entry).PVs.PVs) : string.Empty); }
protected string CreateEntryLink(IEntryBase entry) { return(EntryLinkFactory.CreateEntryLink(entry)); }
public static string GenerateEntryLink(IEntryBase entry) { ParamIs.NotNull(() => entry); return(BBElement.GetCode(string.Format("{0}={1}", entry.EntryType, entry.Id), entry.DefaultName)); }
public string CreateEntryLink(IEntryBase entry) { return(string.Empty); }
private string Key(IEntryBase entry, string propertyName) { return string.Format("{0}.{1}.{2}", entry.EntryType, entry.Id, propertyName); }
public EntryThumb(IEntryBase entry, string mime, ImagePurpose purpose) { Entry = entry; Mime = mime; Purpose = purpose; }
public static string EntryDetails(this UrlHelper urlHelper, IEntryBase entryBase) { ParamIs.NotNull(() => entryBase); return(EntryDetails(urlHelper, entryBase.EntryType, entryBase.Id, null)); }
/// <summary> /// Returns a release event if it can be uniquely identified (by either name or ID). /// Otherwise attempts to create a new event based on given name. /// Makes an intelligent guess to create either standalone event or series event. /// This also makes sure no event with a duplicate name is created. /// </summary> /// <param name="ctx">Database context.</param> /// <param name="userContext">User context.</param> /// <param name="contract">Release event data.</param> /// <param name="forEntry">Which entry the release event will be created for. Optional, can be null.</param> /// <returns>The release event. Can be null if no name or ID is specified. Returned event can be either a new event or existing event.</returns> public ReleaseEvent FindOrCreate(IDatabaseContext ctx, IUserPermissionContext userContext, IReleaseEvent contract, IEntryBase forEntry) { if (contract == null || (contract.Id == 0 && string.IsNullOrWhiteSpace(contract.Name))) { return(null); } var existing = ctx.NullSafeLoad <ReleaseEvent>(contract); if (existing != null) { return(existing); } var searchResult = new ReleaseEventSearch(ctx).Find(contract.Name, userContext.LanguagePreference); if (searchResult.IsKnownEvent) { return(ctx.Load <ReleaseEvent>(searchResult.EventId)); } var series = ctx.NullSafeLoad <ReleaseEventSeries>(searchResult.Series); ReleaseEvent newEvent; LocalizedStringContract[] names; if (series == null) { var nameValue = searchResult.EventName.EmptyToNull() ?? contract.Name; var name = new LocalizedStringContract(nameValue, ContentLanguageSelection.English); names = new[] { name }; newEvent = new ReleaseEvent(string.Empty, null, ContentLanguageSelection.English); } else { names = new LocalizedStringContract[0]; newEvent = new ReleaseEvent(string.Empty, null, series, searchResult.SeriesNumber, searchResult.SeriesSuffix, ContentLanguageSelection.Unspecified, false); } ctx.Save(newEvent); new UpdateEventNamesQuery().UpdateNames(ctx, newEvent, series, false, searchResult.SeriesNumber, searchResult.SeriesSuffix, names); var eventDiff = new ReleaseEventDiff(ReleaseEventEditableFields.OriginalName | ReleaseEventEditableFields.Names); var archivedVersion = ArchivedReleaseEventVersion.Create(newEvent, eventDiff, ctx.OfType <User>().CreateAgentLoginData(userContext), EntryEditEvent.Created, "Created for " + forEntry); ctx.Save(archivedVersion); return(newEvent); }
public static string GetFullEntryUrl(this IEntryLinkFactory entryLinkFactory, IEntryBase entryBase) { return(entryLinkFactory.GetFullEntryUrl(entryBase.EntryType, entryBase.Id)); }
public string CreateEntryLink(IEntryBase entry, string slug) { return(entry?.ToString()); }
public static string GetFullEntryUrl(this IEntryLinkFactory entryLinkFactory, IEntryBase entryBase) { return entryLinkFactory.GetFullEntryUrl(entryBase.EntryType, entryBase.Id); }