public int this[ModeratorActions key] { get { try { return (int) collection[key]; } catch { return 0; } } set { collection[key] = value; total += value; } }
public abstract AuditSet GetAuditHistoryForUser(int userID, ModeratorActions action, int pageIndex, int pageSize, bool returnRecordCount);
public static AuditSet GetAuditHistoryForUser(int userID, ModeratorActions action, int pageIndex, int pageSize, bool returnRecordCount) { return GetAuditHistoryForUser( userID, action, pageIndex, pageSize, returnRecordCount, true, false ); }
public static UserModerationAction ModeratorActionToUserAction(ModeratorActions action) { UserModerationAction uAction = UserModerationAction.ForumAction; switch (action) { case ModeratorActions.ApprovePost: case ModeratorActions.EditPost: case ModeratorActions.MovePost: case ModeratorActions.DeletePost: case ModeratorActions.LockPost: case ModeratorActions.UnlockPost: case ModeratorActions.MergePost: case ModeratorActions.SplitPost: case ModeratorActions.PostIsAnnouncement: case ModeratorActions.PostIsNotAnnoucement: case ModeratorActions.UnApprovePost: uAction = UserModerationAction.MessageAction; break; case ModeratorActions.EditUser: case ModeratorActions.UnmoderateUser: case ModeratorActions.ModerateUser: case ModeratorActions.BanUser: case ModeratorActions.UnbanUser: case ModeratorActions.ResetPassword: case ModeratorActions.ChangePassword: uAction = UserModerationAction.ForumAction; break; } return uAction; }
/// <summary> /// Returns moderation audit entries for provided user ID and moderator action. /// Records are returned in a controled amount through records pagination. /// </summary> /// <param name="userID">A valid user ID as an integer.</param> /// <param name="action">Filter audit trail by moderation action.</param> /// <param name="pageIndex">Number of the current page.</param> /// <param name="pageSize">Number of records contained by the current page.</param> /// <param name="returnRecordCount">Returns also total number of entries if true.</param> /// <param name="cacheable">Store in cache also if true.</param> /// <param name="flush">Reset previous cached version if true.</param> /// <returns>Collection of audit entries incapsulated into ModerationAuditSet.</returns> public static AuditSet GetAuditHistoryForUser(int userID, ModeratorActions action, int pageIndex, int pageSize, bool returnRecordCount, bool cacheable, bool flush) { string cacheKey = string.Format( "AuditHistoryForUser-{0}-{1}-{2}-{3}-{4}", userID, action.ToString(), CSContext.Current.SiteSettings.SettingsID, pageIndex, pageSize ); HttpContext context = HttpContext.Current; AuditSet collection; if (flush) { CSCache.Remove(cacheKey); context.Items[cacheKey] = null; } // Get the summary from context // collection = context.Items[cacheKey] as AuditSet; if(collection != null) return collection; // Get the summary from cache // collection = CSCache.Get(cacheKey) as AuditSet; if (collection == null) { collection = CommonDataProvider.Instance().GetAuditHistoryForUser( userID, action, pageIndex, pageSize, returnRecordCount ); // Does not need to be cached. Revisit API in 1.2 - SW // if (cacheable) // CSCache.Insert(cacheKey, collection, 10 * CSCache.MinuteFactor ); } context.Items[cacheKey] = collection; return collection; }
/// <summary> /// Gets a localized description for provided ModeratorAction. /// </summary> public static string FormatModeratorAction(ModeratorActions action) { return ResourceManager.GetString( "Utility_ModeratorActions_" + action.ToString() ); }