Ejemplo n.º 1
0
        /// <summary>
        /// 修改公告信息
        /// </summary>
        /// <param name="Id">公告信息Id</param>
        /// <param name="company">公司Id</param>
        /// <param name="role">发布角色</param>
        /// <param name="status">审核状态</param>
        /// <param name="view">公告信息</param>
        /// <param name="operatorAccount">操作员帐号</param>
        public static void Update(Guid id, AnnounceView view, PublishRole role, string operatorAccount)
        {
            var announceModel = AnnounceService.Query(id);

            if (announceModel == null)
            {
                throw new ArgumentException("公告信息不存在");
            }
            var model = new Domain.Announce(id);

            model.AnnounceType = view.AnnounceType;
            model.Content      = view.Content;
            model.Title        = view.Title;
            model.PublishRole  = role;
            model.AnnunceScope = view.AnnounceScope;
            var repository = Factory.CreateAnnounceReposity();

            repository.Update(model);
            // 记录日志
            OperatorRole operatorRole    = getOperatorRole(role);
            string       originalContent = string.Format("公告Id:{0},公告标题:{1},公告类型:{2},公告内容:{3}", id, announceModel.Title, announceModel.AnnounceType, announceModel.Content);
            string       newContent      = string.Format("公告Id:{0},公告标题:{1},公告类型:{2},公告内容:{3}", id, view.Title, view.AnnounceType, view.Content);

            saveUpdateLog("公告内容", originalContent, newContent, operatorRole, id.ToString(), operatorAccount);
        }
Ejemplo n.º 2
0
        static OperatorRole getOperatorRole(PublishRole role)
        {
            switch (role)
            {
            case PublishRole.平台:
                return(OperatorRole.Platform);

            case PublishRole.用户:
                return(OperatorRole.Provider);

            default:
                throw new NotSupportedException(role.ToString());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 删除公告信息
        /// </summary>
        /// <param name="Ids">公告信息Ids</param>
        /// <param name="operatorAccount">操作员帐号</param>
        public static void Delete(IEnumerable <Guid> ids, PublishRole role, string operatorAccount)
        {
            string content = "";

            foreach (var id in ids)
            {
                var model = AnnounceService.Query(id);
                content += string.Format("标题:{0},内容:{1},公告类型:{2},发布时间:{3};", model.Title, model.Content, model.AnnounceType, model.PublishTime.Date.ToString("yyyy-MM-dd HH:mm:ss"));
            }
            var repository = Factory.CreateAnnounceReposity();

            repository.Delete(ids);
            // 记录日志
            OperatorRole operatorRole = getOperatorRole(role);

            saveDeleteLog("公告", content, operatorRole, ids.Join(",", item => item.ToString()), operatorAccount);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 审核状态
        /// </summary>
        /// <param name="Id">公告信息Id</param>
        /// <param name="status">审核状态</param>
        /// <param name="operatorAccount">操作员帐号</param>
        public static void UpdateAduiteStatus(Guid id, AduiteStatus status, PublishRole role, string operatorAccount)
        {
            var announceModel = AnnounceService.Query(id);

            if (announceModel == null)
            {
                throw new ArgumentException("公告信息不存在");
            }
            var model      = AnnounceService.QueryAduiteStatus(id);
            var repository = Factory.CreateAnnounceReposity();

            repository.UpdateStatus(id, status);
            // 记录日志
            var          view            = AnnounceService.Query(id);
            string       originalContent = string.Format("公告Id:{0},标题:{1},公告类型:{2},内容:{3},审核状态:{4}", id, view.Title, view.AnnounceType, view.Content, model);
            string       newContent      = string.Format("公告Id:{0},标题:{1},公告类型:{2},内容:{3},审核状态:{1}", id, view.Title, view.AnnounceType, view.Content, status);
            OperatorRole operatorRole    = getOperatorRole(role);

            saveUpdateLog("审核状态", originalContent, newContent, operatorRole, id.ToString(), operatorAccount);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 批量更改状态
        /// </summary>
        /// <param name="ids"></param>
        /// <param name="status"></param>
        /// <param name="role"></param>
        /// <param name="operatorAccount"></param>
        public static void UpdateAuditStatuses(IEnumerable <Guid> ids, AduiteStatus status, PublishRole role, string operatorAccount)
        {
            string content = "";

            foreach (var id in ids)
            {
                var model = AnnounceService.Query(id);
                if (model == null)
                {
                    throw new ArgumentException("公告信息不存在");
                }
                var orginalStatus = QueryAduiteStatus(id);
                content += string.Format("公告Id:{0},标题:{1},内容:{2},公告类型:{3},发布时间:{4},审核状态:{5};", id, model.Title, model.Content, model.AnnounceType, model.PublishTime.Date.ToString("yyyy-MM-dd HH:mm:ss"), orginalStatus);
            }
            var repository = Factory.CreateAnnounceReposity();

            repository.UpdateStatuses(ids, status);
            // 记录日志
            string newContent = "";

            foreach (var id in ids)
            {
                var model = AnnounceService.Query(id);
                newContent += string.Format("公告Id:{0},标题:{1},内容:{2},公告类型:{3},发布时间:{4},审核状态:{5};", id, model.Title, model.Content, model.AnnounceType, model.PublishTime.Date.ToString("yyyy-MM-dd HH:mm:ss"), status);
            }
            OperatorRole operatorRole = getOperatorRole(role);

            saveUpdateLog("审核状态", content, newContent, operatorRole, ids.Join(",", item => item.ToString()), operatorAccount);
        }