Beispiel #1
0
        /// <summary>
        /// 删除标签
        /// </summary>
        /// <param name="tagId">标签Id</param>
        /// <returns>删除成功返回true,否则返回false</returns>
        public bool Delete(long tagId)
        {
            T tag = tagRepository.Get(tagId);

            int affectCount = 0;

            if (tag != null)
            {
                //删除数据前,触发相关事件
                EventBus <T> .Instance().OnBefore(tag, new CommonEventArgs(EventOperationType.Instance().Delete()));

                affectCount = tagRepository.Delete(tag);
                if (affectCount > 0)
                {
                    //删除Logo
                    LogoService logoService = new LogoService(TenantTypeIds.Instance().Tag());
                    logoService.DeleteLogo(tagId);

                    //若删除成功,触发删除后相关事件
                    EventBus <T> .Instance().OnAfter(tag, new CommonEventArgs(EventOperationType.Instance().Delete()));

                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
        /// <summary>
        /// 删除角色
        /// </summary>
        /// <param name="roleName">角色名称</param>
        public void Delete(string roleName)
        {
            Role role = Get(roleName);

            EventBus <Role> .Instance().OnBefore(role, new CommonEventArgs(EventOperationType.Instance().Delete()));

            roleRepository.DeleteByEntityId(roleName);
            logoService.DeleteLogo(roleName);
            EventBus <Role> .Instance().OnAfter(role, new CommonEventArgs(EventOperationType.Instance().Delete()));
        }
Beispiel #3
0
        /// <summary>
        /// 删除广告位示意图
        /// </summary>
        /// <param name="positionId">广告位Id</param>
        public void DeletePositionImage(string positionId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());

            logoService.DeleteLogo(positionId);

            AdvertisingPosition position = GetPosition(positionId);

            if (position == null)
            {
                return;
            }

            position.FeaturedImage = string.Empty;
            advertisingPositionRepository.Update(position);
        }
Beispiel #4
0
        /// <summary>
        /// 删除广告位
        /// </summary>
        /// <param name="positionId"></param>
        /// <returns></returns>
        public bool DeletePosition(string positionId)
        {
            AdvertisingPosition position = advertisingPositionRepository.Get(positionId);
            int result = advertisingPositionRepository.Delete(position);

            if (result > 0)
            {
                LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
                logoService.DeleteLogo(positionId);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 删除广告
        /// </summary>
        /// <param name="advertisingId">广告Id</param>
        /// <returns></returns>
        public bool DeleteAdvertising(long advertisingId)
        {
            Advertising advertising = advertisingRepository.Get(advertisingId);
            int         result      = advertisingRepository.Delete(advertising);

            if (result > 0)
            {
                ClearPositionsFromAdvertising(advertisingId);

                LogoService logoService = new LogoService(TenantTypeIds.Instance().Advertising());
                logoService.DeleteLogo(advertisingId);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 删除广告示意图
        /// </summary>
        /// <param name="advertisingId">广告Id</param>
        public void DeleteAdvertisingImage(long advertisingId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().Advertising());

            logoService.DeleteLogo(advertisingId);

            Advertising advertising = GetAdvertising(advertisingId);

            if (advertising == null)
            {
                return;
            }
            if (advertising.AdvertisingType == AdvertisingType.Image)
            {
                advertising.AttachmentUrl = string.Empty;
            }

            advertisingRepository.Update(advertising);
        }
Beispiel #7
0
 /// <summary>
 /// 删除广告位
 /// </summary>
 /// <param name="positionId"></param>
 /// <returns></returns>
 public bool DeletePosition(string positionId)
 {
     AdvertisingPosition position = advertisingPositionRepository.Get(positionId);
     int result = advertisingPositionRepository.Delete(position);
     if (result > 0)
     {
         LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
         logoService.DeleteLogo(positionId);
         return true;
     }
     else
     {
         return false;
     }
 }
 /// <summary>
 /// 删除Logo
 /// </summary>
 /// <param name="recommendId">推荐Id</param>
 public void DeleteLogo(long recommendId)
 {
     LogoService logoService = new LogoService(TenantTypeIds.Instance().Recommend());
     logoService.DeleteLogo(recommendId);
 }
        /// <summary>
        /// 删除身份认证申请
        /// </summary>
        /// <param name="identificationId">身份认证ID</param>
        /// <returns></returns>
        public bool DeleteIdentification(long identificationId)
        {
            Identification identification = iIdentificationRepository.Get(identificationId);
            if (identification != null)
            {
                EventBus<Identification>.Instance().OnBefore(identification, new CommonEventArgs(EventOperationType.Instance().Delete()));

                //删除身份认证
                iIdentificationRepository.Delete(identification);

                //删除身份认证图片
                LogoService logoService = new LogoService(TenantTypeIds.Instance().Identification());
                logoService.DeleteLogo(identificationId);

                EventBus<Identification>.Instance().OnAfter(identification, new CommonEventArgs(EventOperationType.Instance().Delete()));
                return true;
            }

            return false;
        }
 /// <summary>
 /// 删除Logo
 /// </summary>
 /// <param name="sectionId">帖吧Id</param>
 public void DeleteLogo(long sectionId)
 {
     LogoService logoService = new LogoService(TenantTypeIds.Instance().BarSection());
     logoService.DeleteLogo(sectionId);
     BarSection section = barSectionRepository.Get(sectionId);
     if (section == null)
         return;
     section.LogoImage = string.Empty;
     barSectionRepository.Update(section);
 }
 /// <summary>
 /// 删除Logo
 /// </summary>
 /// <param name="recommendId">群组Id</param>
 public void DeleteLogo(long groupId)
 {
     LogoService logoService = new LogoService(TenantTypeIds.Instance().Group());
     logoService.DeleteLogo(groupId);
     GroupEntity group = Get(groupId);
     if (group == null)
         return;
     group.Logo = string.Empty;
     groupRepository.Update(group);
 }
        /// <summary>
        /// 删除群组
        /// </summary>
        /// <param name="groupId">群组Id</param>
        public void Delete(long groupId)
        {
            //设计要点
            //1、需要删除:群组成员、群组申请、Logo;
            GroupEntity group = groupRepository.Get(groupId);
            if (group == null)
                return;

            CategoryService categoryService = new CategoryService();
            categoryService.ClearCategoriesFromItem(groupId, null, TenantTypeIds.Instance().Group());


            EventBus<GroupEntity>.Instance().OnBefore(group, new CommonEventArgs(EventOperationType.Instance().Delete()));
            int affectCount = groupRepository.Delete(group);
            if (affectCount > 0)
            {
                //删除访客记录
                new VisitService(TenantTypeIds.Instance().Group()).CleanByToObjectId(groupId);
                //用户的创建群组数-1
                OwnerDataService ownerDataService = new OwnerDataService(TenantTypeIds.Instance().User());
                ownerDataService.Change(group.UserId, OwnerDataKeys.Instance().CreatedGroupCount(), -1);
                //删除Logo             
                LogoService logoService = new LogoService(TenantTypeIds.Instance().Group());
                logoService.DeleteLogo(groupId);
                //删除群组下的成员
                DeleteMembersByGroupId(groupId);
                EventBus<GroupEntity>.Instance().OnAfter(group, new CommonEventArgs(EventOperationType.Instance().Delete()));
                EventBus<GroupEntity, AuditEventArgs>.Instance().OnAfter(group, new AuditEventArgs(group.AuditStatus, null));
            }
        }
Beispiel #13
0
        /// <summary>
        /// 删除Logo
        /// </summary>
        /// <param name="recommendId">推荐Id</param>
        public void DeleteLogo(long recommendId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().Recommend());

            logoService.DeleteLogo(recommendId);
        }
Beispiel #14
0
        /// <summary>
        /// 删除广告位示意图
        /// </summary>
        /// <param name="positionId">广告位Id</param>
        public void DeletePositionImage(string positionId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().AdvertisingPosition());
            logoService.DeleteLogo(positionId);

            AdvertisingPosition position = GetPosition(positionId);
            if (position == null)
                return;

            position.FeaturedImage = string.Empty;
            advertisingPositionRepository.Update(position);
        }
Beispiel #15
0
        /// <summary>
        /// 删除广告示意图
        /// </summary>
        /// <param name="advertisingId">广告Id</param>
        public void DeleteAdvertisingImage(long advertisingId)
        {
            LogoService logoService = new LogoService(TenantTypeIds.Instance().Advertising());
            logoService.DeleteLogo(advertisingId);

            Advertising advertising = GetAdvertising(advertisingId);
            if (advertising == null)
                return;
            if (advertising.AdvertisingType == AdvertisingType.Image)
                advertising.AttachmentUrl = string.Empty;

            advertisingRepository.Update(advertising);
        }
Beispiel #16
0
        /// <summary>
        /// 删除广告
        /// </summary>
        /// <param name="advertisingId">广告Id</param>
        /// <returns></returns>
        public bool DeleteAdvertising(long advertisingId)
        {
            Advertising advertising = advertisingRepository.Get(advertisingId);
            int result = advertisingRepository.Delete(advertising);
            if (result > 0)
            {
                ClearPositionsFromAdvertising(advertisingId);

                LogoService logoService = new LogoService(TenantTypeIds.Instance().Advertising());
                logoService.DeleteLogo(advertisingId);

                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// 更新身份认证申请
        /// </summary>
        /// <param name="identification">身份认证实体</param>
        /// <param name="stream">证件扫描件</param>
        /// <returns></returns>
        public bool UpdateIdentification(Identification identification, Stream stream = null)
        {
            EventBus<Identification>.Instance().OnBefore(identification, new CommonEventArgs(EventOperationType.Instance().Update()));

            if (stream != null)
            {
                LogoService logoService = new LogoService(TenantTypeIds.Instance().Identification());

                logoService.DeleteLogo(identification.IdentificationId);
                identification.IdentificationLogo = logoService.UploadLogo(identification.IdentificationId, stream);
            }

            iIdentificationRepository.Update(identification);

            EventBus<Identification>.Instance().OnAfter(identification, new CommonEventArgs(EventOperationType.Instance().Update()));

            return true;
        }
        /// <summary>
        /// 删除认证标识
        /// </summary>
        /// <param name="identificationTypeId">认证标识ID</param>
        /// <returns></returns>
        public bool DeleteIdentificationType(long identificationTypeId)
        {
            IdentificationType identificationType = identificationTypeRepository.Get(identificationTypeId);

            if (identificationType != null)
            {
                EventBus<IdentificationType>.Instance().OnBefore(identificationType, new CommonEventArgs(EventOperationType.Instance().Delete()));

                //删除认证标识和该认证标识下的所有申请
                IdentificationTypeRepository typeRepository = new IdentificationTypeRepository();
                typeRepository.DeleteIdentificationTypes(identificationTypeId);

                //删除认证标识图
                LogoService logoService = new LogoService(TenantTypeIds.Instance().IdentificationType());
                logoService.DeleteLogo(identificationTypeId);

                EventBus<IdentificationType>.Instance().OnAfter(identificationType, new CommonEventArgs(EventOperationType.Instance().Delete()));
                return true;
            }
            return false;
        }