public ArtistReport(Artist artist, ArtistReportType reportType, User user, string hostname, string notes) : base(user, hostname, notes) { Artist = artist; ReportType = reportType; }
public bool CreateReport(int artistId, ArtistReportType reportType, string hostname, string notes) { ParamIs.NotNull(() => hostname); ParamIs.NotNull(() => notes); return(HandleTransaction(session => { var loggedUserId = PermissionContext.LoggedUserId; var existing = session.Query <ArtistReport>() .FirstOrDefault(r => r.Artist.Id == artistId && ((loggedUserId != 0 && r.User.Id == loggedUserId) || r.Hostname == hostname)); if (existing != null) { return false; } var artist = session.Load <Artist>(artistId); var report = new ArtistReport(artist, reportType, GetLoggedUserOrDefault(session), hostname, notes.Truncate(200)); var msg = string.Format("reported {0} as {1} ({2})", EntryLinkFactory.CreateEntryLink(artist), reportType, HttpUtility.HtmlEncode(notes)); AuditLog(msg.Truncate(200), session, new AgentLoginData(GetLoggedUserOrDefault(session), hostname)); session.Save(report); return true; }, IsolationLevel.ReadUncommitted)); }
private (bool created, ArtistReport report) CallCreateReport(ArtistReportType reportType, int?versionNumber = null, Artist artist = null) { artist ??= _artist; var result = _queries.CreateReport(artist.Id, reportType, "39.39.39.39", "It's Miku, not Rin", versionNumber); var report = _repository.Load <ArtistReport>(result.reportId); return(result.created, report); }
public (bool created, int reportId) CreateReport(int artistId, ArtistReportType reportType, string hostname, string notes, int?versionNumber) { ParamIs.NotNull(() => hostname); ParamIs.NotNull(() => notes); return(HandleTransaction(ctx => { return new Model.Service.Queries.EntryReportQueries().CreateReport(ctx, PermissionContext, entryLinkFactory, (artist, reporter, notesTruncated) => new ArtistReport(artist, reportType, reporter, hostname, notesTruncated, versionNumber), () => reportType != ArtistReportType.Other ? enumTranslations.ArtistReportTypeNames[reportType] : null, artistId, reportType, hostname, notes, reportType != ArtistReportType.OwnershipClaim); })); }
public void CreateReport(int artistId, ArtistReportType reportType, string notes) { Service.CreateReport(artistId, reportType, CfHelper.GetRealIp(Request), notes ?? string.Empty); }
public void CreateReport(int artistId, ArtistReportType reportType, string notes, int?versionNumber) { queries.CreateReport(artistId, reportType, WebHelper.GetRealHost(Request), notes ?? string.Empty, versionNumber); }