Ejemplo n.º 1
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;
                }
            }
        }
Ejemplo n.º 2
0
        public void UpdateStatus(int id, int status)
        {
            var resourceGroup = ResourceGroupRepository.GetResourceGroup(id);

            if (resourceGroup != null)
            {
                resourceGroup.Yrg_Status = status;
                ResourceGroupRepository.Update(resourceGroup);
            }
        }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
0
 public Yw_ResourceGroup GetResourceGroup(int id)
 {
     return(ResourceGroupRepository.GetResourceGroup(id));
 }