/* * [Obsolete("Integrated to saving properties")] * public PVContract CreatePV(int albumId, string pvUrl, PVType pvType) { * * ParamIs.NotNullOrEmpty(() => pvUrl); * * VerifyManageDatabase(); * * var result = VideoServiceHelper.ParseByUrl(pvUrl); * * if (!result.IsOk) * throw result.Exception; * * return HandleTransaction(session => { * * var album = session.Load<Album>(albumId); * AuditLog(string.Format("creating a PV for {0}", EntryLinkFactory.CreateEntryLink(album)), session); * * var pv = album.CreatePV(result.Service, result.Id, pvType, string.Empty); * session.Save(pv); * * return new PVContract(pv); * * }); * * }*/ public bool CreateReport(int albumId, AlbumReportType reportType, string hostname, string notes) { ParamIs.NotNull(() => hostname); ParamIs.NotNull(() => notes); return(HandleTransaction(session => { var loggedUserId = PermissionContext.LoggedUserId; var existing = session.Query <AlbumReport>() .FirstOrDefault(r => r.Album.Id == albumId && ((loggedUserId != 0 && r.User.Id == loggedUserId) || r.Hostname == hostname)); if (existing != null) { return false; } var album = session.Load <Album>(albumId); var report = new AlbumReport(album, reportType, GetLoggedUserOrDefault(session), hostname, notes.Truncate(200)); var msg = string.Format("reported {0} as {1} ({2})", EntryLinkFactory.CreateEntryLink(album), reportType, HttpUtility.HtmlEncode(notes)); AuditLog(msg.Truncate(200), session, new AgentLoginData(GetLoggedUserOrDefault(session), hostname)); session.Save(report); return true; }, IsolationLevel.ReadUncommitted)); }
public EntryReportContract(AlbumReport report, ContentLanguagePreference languagePreference) : this((EntryReport)report, languagePreference) { AlbumReportType = report.ReportType; }