public ManipulateResourceGroupCommandHandler(IIntegrationEventPublisherServiceService Eventcontext, ILogger <ManipulateResourceGroupCommandHandler> logger) { _ResourceGroupRepository = new ResourceGroupRepository(new TaxatHand_StgContext()); _Eventcontext = Eventcontext; _logger = logger; _context = new CosmosDBContext(); }
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; } } }
public UpdateResourceGroupCommandHandler(IIntegrationEventPublisherServiceService eventcontext, IMapper mapper) { _ResourceGroupRepository = new ResourceGroupRepository(new TaxatHand_StgContext()); _eventcontext = eventcontext; _mapper = mapper; _context = new CosmosDBContext(); }
public void UpdateStatus(int id, int status) { var resourceGroup = ResourceGroupRepository.GetResourceGroup(id); if (resourceGroup != null) { resourceGroup.Yrg_Status = status; ResourceGroupRepository.Update(resourceGroup); } }
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; } } }
public Yw_ResourceGroup GetResourceGroup(int id) { return(ResourceGroupRepository.GetResourceGroup(id)); }
public List <Yw_ResourceGroup> GetPagingResourceGroup(PagingObject paging, int id, string name, int grade, int status) { return(ResourceGroupRepository.GetPagingResourceGroup(paging, id, name, grade, status)); }
public int AddResourceGroup(Yw_ResourceGroup resourceGroup) { return(ResourceGroupRepository.AddResourceGroup(resourceGroup)); }