public ManipulateResourceGroupCommandHandler(IIntegrationEventPublisherServiceService Eventcontext, ILogger <ManipulateResourceGroupCommandHandler> logger)
 {
     _ResourceGroupRepository = new ResourceGroupRepository(new TaxatHand_StgContext());
     _Eventcontext            = Eventcontext;
     _logger  = logger;
     _context = new CosmosDBContext();
 }
Example #2
0
        public void Delete(int groupId, int resourceType, int resourceId)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    ResourceGroupItemRepository.Delete(groupId, resourceType, resourceId);

                    var resourceGroup = ResourceGroupRepository.GetResourceGroup(groupId);
                    if (resourceGroup != null)
                    {
                        var resourceCount = ResourceGroupItemRepository.GetResourceCount(groupId, resourceType);
                        if (resourceType == (int)ResourceTypeEnum.文本资源)
                        {
                            resourceGroup.Yrg_TextCount = resourceCount;
                        }
                        else if (resourceType == (int)ResourceTypeEnum.多媒体资源)
                        {
                            resourceGroup.Yrg_MediaCount = resourceCount;
                        }
                        else if (resourceType == (int)ResourceTypeEnum.题目)
                        {
                            resourceGroup.Yrg_SubjectCount = resourceCount;
                        }
                        ResourceGroupRepository.Update(resourceGroup);
                    }
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    RollbackTran();
                    throw ex;
                }
            }
        }
Example #3
0
 public UpdateResourceGroupCommandHandler(IIntegrationEventPublisherServiceService eventcontext, IMapper mapper)
 {
     _ResourceGroupRepository = new ResourceGroupRepository(new TaxatHand_StgContext());
     _eventcontext            = eventcontext;
     _mapper  = mapper;
     _context = new CosmosDBContext();
 }
Example #4
0
        public void UpdateStatus(int id, int status)
        {
            var resourceGroup = ResourceGroupRepository.GetResourceGroup(id);

            if (resourceGroup != null)
            {
                resourceGroup.Yrg_Status = status;
                ResourceGroupRepository.Update(resourceGroup);
            }
        }
Example #5
0
        public void AddResourceGroupItem(Yw_ResourceGroupItem entity)
        {
            using (TransactionScope scope = new TransactionScope())
            {
                try
                {
                    var resourceGroupItem = ResourceGroupItemRepository.GetResourceGroupItem(entity.Ygi_GroupId, entity.Ygi_ResourceType, entity.Ygi_ResourceId);
                    if (resourceGroupItem != null)
                    {
                        throw new AbhsException(ErrorCodeEnum.AlreadyExistResourceItem, AbhsErrorMsg.ConstAlreadyExistResourceItem);
                    }

                    ResourceGroupItemRepository.AddResourceGroupItem(entity);

                    var resourceGroup = ResourceGroupRepository.GetResourceGroup(entity.Ygi_GroupId);

                    if (resourceGroup != null)
                    {
                        var resourceCount = ResourceGroupItemRepository.GetResourceCount(entity.Ygi_GroupId, entity.Ygi_ResourceType);
                        if (entity.Ygi_ResourceType == (int)ResourceTypeEnum.文本资源)
                        {
                            resourceGroup.Yrg_TextCount = resourceCount;
                        }
                        else if (entity.Ygi_ResourceType == (int)ResourceTypeEnum.多媒体资源)
                        {
                            resourceGroup.Yrg_MediaCount = resourceCount;
                        }
                        else if (entity.Ygi_ResourceType == (int)ResourceTypeEnum.题目)
                        {
                            resourceGroup.Yrg_SubjectCount = resourceCount;
                        }
                        ResourceGroupRepository.Update(resourceGroup);
                    }
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    RollbackTran();
                    throw ex;
                }
            }
        }
Example #6
0
 public Yw_ResourceGroup GetResourceGroup(int id)
 {
     return(ResourceGroupRepository.GetResourceGroup(id));
 }
Example #7
0
 public List <Yw_ResourceGroup> GetPagingResourceGroup(PagingObject paging, int id, string name, int grade, int status)
 {
     return(ResourceGroupRepository.GetPagingResourceGroup(paging, id, name, grade, status));
 }
Example #8
0
 public int AddResourceGroup(Yw_ResourceGroup resourceGroup)
 {
     return(ResourceGroupRepository.AddResourceGroup(resourceGroup));
 }