public SongReport(Song song, SongReportType reportType, User user, string hostname, string notes) : base(user, hostname, notes) { Song = song; ReportType = reportType; }
public bool CreateReport(int songId, SongReportType reportType, string hostname, string notes) { ParamIs.NotNull(() => hostname); ParamIs.NotNull(() => notes); return(HandleTransaction(session => { var loggedUserId = PermissionContext.LoggedUserId; var existing = session.Query <SongReport>() .FirstOrDefault(r => r.Song.Id == songId && ((loggedUserId != 0 && r.User.Id == loggedUserId) || r.Hostname == hostname)); if (existing != null) { return false; } var song = session.Load <Song>(songId); var report = new SongReport(song, reportType, GetLoggedUserOrDefault(session), hostname, notes.Truncate(EntryReport.MaxNotesLength)); var msg = string.Format("reported {0} as {1} ({2})", EntryLinkFactory.CreateEntryLink(song), reportType, HttpUtility.HtmlEncode(notes)); AuditLog(msg.Truncate(200), session, new AgentLoginData(GetLoggedUserOrDefault(session), hostname)); session.Save(report); return true; }, IsolationLevel.ReadUncommitted)); }
private (bool created, SongReport report) CallCreateReport(SongReportType reportType, int?versionNumber = null, Song song = null, DateTime?created = null) { song ??= _song; var result = _queries.CreateReport(song.Id, reportType, "39.39.39.39", "It's Miku, not Rin", versionNumber); var report = _repository.Load <SongReport>(result.reportId); if (created != null) { report.Created = created.Value; } return(result.created, report); }
public bool CreateReport(int songId, SongReportType 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, report => report.Entry.Id == songId, (song, reporter, notesTruncated) => new SongReport(song, reportType, reporter, hostname, notesTruncated, versionNumber), () => reportType != SongReportType.Other ? enumTranslations.SongReportTypeNames[reportType] : null, songId, reportType, hostname, notes); })); }
public SongReport(Song song, SongReportType reportType, User user, string hostname, string notes) : base(user, hostname, notes) { Song = song; ReportType = reportType; }
private (bool created, SongReport report) CallCreateReport(SongReportType reportType, int?versionNumber = null) { var result = queries.CreateReport(song.Id, reportType, "39.39.39.39", "It's Miku, not Rin", versionNumber); return(result.created, repository.Load <SongReport>(result.reportId)); }
public void CreateReport(int songId, SongReportType reportType, string notes) { Service.CreateReport(songId, reportType, CfHelper.GetRealIp(Request), notes ?? string.Empty); }
public void CreateReport(int songId, SongReportType reportType, string notes, int?versionNumber) { queries.CreateReport(songId, reportType, WebHelper.GetRealHost(Request), notes ?? string.Empty, versionNumber); }
public void CreateReport(int songId, SongReportType reportType, string notes) { Service.CreateReport(songId, reportType, CfHelper.GetRealIp(Request), notes ?? string.Empty); }