예제 #1
0
        /// <summary>
        /// 贴吧所在呈现区域拥有者自动创建贴吧事件
        /// </summary>
        /// <param name="sender">群组实体</param>
        /// <param name="eventArgs">事件参数</param>
        void AutoMaintainBarSectionModule_After(GroupEntity sender, CommonEventArgs eventArgs)
        {
            BarSectionService barSectionService = new BarSectionService();

            if (eventArgs.EventOperationType == EventOperationType.Instance().Create())
            {
                BarSection barSection = BarSection.New();

                barSection.TenantTypeId         = TenantTypeIds.Instance().Group();
                barSection.SectionId            = sender.GroupId;
                barSection.OwnerId              = sender.GroupId;
                barSection.UserId               = sender.UserId;
                barSection.Name                 = sender.GroupName;
                barSection.IsEnabled            = true;
                barSection.LogoImage            = sender.Logo;
                barSection.ThreadCategoryStatus = ThreadCategoryStatus.NotForceEnabled;
                barSectionService.Create(barSection, sender.UserId, null, null);
            }
            else if (eventArgs.EventOperationType == EventOperationType.Instance().Update())
            {
                BarSection barSection = barSectionService.Get(sender.GroupId);
                barSection.UserId    = sender.UserId;
                barSection.Name      = sender.GroupName;
                barSection.LogoImage = sender.Logo;

                IList <long> managerIds = null;
                if (barSection.SectionManagers != null)
                {
                    managerIds = barSection.SectionManagers.Select(n => n.UserId).ToList();
                }
                barSectionService.Update(barSection, sender.UserId, managerIds, null);
            }
            else if (eventArgs.EventOperationType == EventOperationType.Instance().Approved() || eventArgs.EventOperationType == EventOperationType.Instance().Disapproved())
            {
                BarSection barSection = barSectionService.Get(sender.GroupId);
                barSection.AuditStatus = sender.AuditStatus;
                IList <long> managerIds = null;
                if (barSection.SectionManagers != null)
                {
                    managerIds = barSection.SectionManagers.Select(n => n.UserId).ToList();
                }
                barSectionService.Update(barSection, sender.UserId, managerIds, null);
            }
            else
            {
                barSectionService.Delete(sender.GroupId);
            }
        }
예제 #2
0
 public ActionResult DeleteSection(long sectionId)
 {
     barSectionService.Delete(sectionId);
     return(Json(new StatusMessageData(StatusMessageType.Success, "删除成功")));
 }