private bool ProcessDeleteDoings(int operatorID, bool isUpdatePoint, DeleteDoingsCallback deleteAction) { if (ValidateDoingAdminPermission(operatorID) == false) { return(false); } Guid[] excludeRoleIDs = ManagePermission.GetNoPermissionTargetRoleIds(operatorID, PermissionTargetType.Content); DeleteResult deleteResult = null; if (isUpdatePoint) { bool succeed = DoingPointAction.Instance.UpdateUsersPoints(delegate(PointActionManager.TryUpdateUserPointState state, out PointResultCollection <DoingPointType> pointResults) { pointResults = null; if (state != PointActionManager.TryUpdateUserPointState.CheckSucceed) { return(false); } deleteResult = deleteAction(excludeRoleIDs); if (deleteResult != null && deleteResult.Count > 0) { pointResults = new PointResultCollection <DoingPointType>(); foreach (DeleteResultItem item in deleteResult) { pointResults.Add(item.UserID, item.UserID == operatorID ? DoingPointType.DoingWasDeletedBySelf : DoingPointType.DoingWasDeletedByAdmin, item.Count); } return(true); } return(false); }); } else { deleteResult = deleteAction(excludeRoleIDs); } if (deleteResult != null && deleteResult.Count > 0) { ClearCachedEveryoneData(); foreach (DeleteResultItem item in deleteResult) { ClearCachedUserData(item.UserID); } } return(true); }
private bool ProcessDeleteComments(int operatorID, bool isUpdatePoint, DeleteCommentsCallback deleteAction) { Guid[] excludeRoleIDs = ManagePermission.GetNoPermissionTargetRoleIds(operatorID, PermissionTargetType.Content); DeleteResult deleteResult = null; if (isUpdatePoint) { bool succeed = CommentPointAction.Instance.UpdateUsersPoints(delegate(PointActionManager.TryUpdateUserPointState state, out PointResultCollection <CommentPointType> pointResults) { pointResults = null; if (state != PointActionManager.TryUpdateUserPointState.CheckSucceed) { return(false); } deleteResult = deleteAction(excludeRoleIDs); if (deleteResult != null && deleteResult.Count > 0) { pointResults = new PointResultCollection <CommentPointType>(); foreach (DeleteResultItem item in deleteResult) { pointResults.Add(item.UserID, item.UserID == operatorID ? CommentPointType.DeleteCommentBySelf : CommentPointType.DeleteCommentByAdmin, item.Count); } return(true); } return(false); }); } else { deleteResult = deleteAction(excludeRoleIDs); } return(true); }