示例#1
0
        /**************************************
        *      Delete开头的函数删除数据      *
        **************************************/

        /// <summary>
        /// 删除记录
        /// </summary>
        /// <param name="operatorID">操作者ID</param>
        /// <param name="doingID">所要删除的记录ID</param>
        public bool DeleteDoing(int operatorID, int doingID)
        {
            if (ValidateUserID(operatorID) == false)
            {
                return(false);
            }

            Doing doing = DoingBO.Instance.GetDoing(doingID);

            if (ValidateDoingDeletePermission(operatorID, doing) == false)
            {
                return(false);
            }

            DoingDao.Instance.DeleteDoing(doingID);

            ClearCachedEveryoneData();

            ClearCachedUserData(doing.UserID);

            FeedBO.Instance.DeleteFeed(AppActionType.UpdateDoing, doing.UserID);

            Logs.LogManager.LogOperation(
                new Doing_DeleteDoing(
                    operatorID,
                    UserBO.Instance.GetUser(operatorID).Name,
                    IPUtil.GetCurrentIP(),
                    doingID,
                    doing.UserID,
                    UserBO.Instance.GetUser(doing.UserID).Name
                    )
                );

            return(true);
        }
示例#2
0
        /// <summary>
        /// 后台批量删除记录
        /// </summary>
        /// <param name="doingIDs"></param>
        public bool DeleteDoings(int operatorID, int[] doingIDs, bool isUpdatePoint)
        {
            bool result = ProcessDeleteDoings(operatorID, isUpdatePoint, delegate(Guid[] excludeRoleIDs)
            {
                return(DoingDao.Instance.DeleteDoings(operatorID, doingIDs, excludeRoleIDs));
            });

            if (result)
            {
                Logs.LogManager.LogOperation(
                    new Doing_DeleteDoingByIDs(
                        operatorID,
                        UserBO.Instance.GetUser(operatorID).Name,
                        IPUtil.GetCurrentIP(),
                        doingIDs
                        )
                    );
            }

            return(result);
        }
示例#3
0
        public bool CreateClub(int operatorID, int categoryID, string clubName, out int newClubID)
        {
            newClubID = 0;

            if (ValidateUserID(operatorID) == false)
            {
                return(false);
            }

            if (ValidateClubCategoryID(categoryID) == false)
            {
                return(false);
            }

            if (ValidateClubName(clubName) == false)
            {
                return(false);
            }

            //TODO:检查是否达到创建群组数上限

            bool   isApproced = true;
            string operatorIP = IPUtil.GetCurrentIP();

            CreateClubResult result = ClubDao.Instance.CreateClub(operatorID, categoryID, clubName, isApproced, operatorIP, out newClubID);

            //TODO:创建动态

            if (result == CreateClubResult.HasSameNameClub)
            {
                //TODO:抛错
                return(false);
            }

            return(true);
        }
示例#4
0
        /// <summary>
        /// 添加版主
        /// </summary>
        /// <param name="operatorUserID"></param>
        /// <param name="userID"></param>
        /// <param name="forumIds"></param>
        /// <param name="modetatorsType"></param>
        public void AddModerators(AuthUser operatorUser, ModeratorCollection moderators)
        {
            //AuthUser user = UserBO.Instance.GetUser(operatorUserID);
            //if (user == null)
            //    return;
            if (!AllSettings.Current.BackendPermissions.Can(operatorUser, BackendPermissions.Action.Manage_Moderator))
            {
                ThrowError <NoPermissionManageModerator>(new NoPermissionManageModerator());
                return;
            }

            foreach (Moderator m in moderators)
            {
                if (m.IsNew)
                {
                    m.AppointorID = operatorUser.UserID;
                    m.IsNew       = false;
                }
            }

            if (moderators.Count == 0)
            {
                return;
            }

            if (ForumDaoV5.Instance.AddModerators(moderators))
            {
                this.ClearModeratorCache();
                //User operatorUser = UserBO.Instance.GetUser(operatorUserID);

                foreach (Moderator m in moderators)
                {
                    Logs.LogManager.LogOperation(new Logs.ModeratorAppoint(operatorUser.UserID, operatorUser.Username, m.UserID, m.User.Username, m.ForumID, m.Name, IPUtil.GetCurrentIP()));
                }
            }
        }
示例#5
0
        public void UpdateSystemNotify(int operatorUserID, string subject, int notifyID, string Content, IEnumerable <Guid> receiveRoles, IEnumerable <int> receiveUserIDs, DateTime beginDate, DateTime endDate)
        {
            if (subject == string.Empty)
            {
                subject = string.Format("{0:yyyy-MM-dd HH:mm}", DateTimeUtil.Now);
            }

            if (AllSettings.Current.BackendPermissions.Can(operatorUserID, BackendPermissions.Action.Manage_SystemNotify))
            {
                if (ValidateSystemNotifyData(Content, receiveRoles, receiveUserIDs, beginDate, endDate))
                {
                    SystemNotify notify = NotifyDao.Instance.UpdateSystemNotify(notifyID, subject, Content, receiveRoles, receiveUserIDs, beginDate, endDate, operatorUserID, IPUtil.GetCurrentIP());
                    SystemNotifyProvider.Update();

                    if (OnSystemNotifyUpdated != null)
                    {
                        OnSystemNotifyUpdated(notify);
                    }
                }
            }
            else
            {
                ThrowError(new NoPermissionManageSystemNoyify());
            }
        }