Exemple #1
0
        public bool CreateMany(IList <ProcessStage> entities)
        {
            var result = true;

            using (UnitOfWork.Build(_processStageRepository.DbContext))
            {
                result = _processStageRepository.CreateMany(entities);
                foreach (var entity in entities)
                {
                    //依赖于实体
                    _dependencyBatchBuilder.Append(WorkFlowDefaults.ModuleName, entity.WorkFlowId, EntityDefaults.ModuleName, entity.EntityId);
                    //依赖于字段
                    var st = new List <ProcessStep>().DeserializeFromJson(entity.Steps);
                    if (st.NotEmpty())
                    {
                        var attrNames  = st.Select(x => x.AttributeName).ToArray();
                        var attributes = _attributeFinder.FindByName(entity.EntityId, attrNames);
                        var attrIds    = attributes.Select(x => x.AttributeId).ToArray();
                        _dependencyBatchBuilder.Append(WorkFlowDefaults.ModuleName, entity.WorkFlowId, AttributeDefaults.ModuleName, attrIds);
                    }
                }
                _dependencyBatchBuilder.Save();
            }

            return(result);
        }
Exemple #2
0
 public bool Create(Domain.Attribute entity)
 {
     //引用类型
     if (entity.TypeIsLookUp() || entity.TypeIsOwner() || entity.TypeIsCustomer())
     {
         var referenced = _attributeRepository.Find(x => x.EntityId == entity.ReferencedEntityId.Value && x.AttributeTypeName == AttributeTypeIds.PRIMARYKEY);
         //依赖于被引用实体
         _dependencyBatchBuilder.Append(AttributeDefaults.ModuleName, entity.AttributeId, EntityDefaults.ModuleName, entity.ReferencedEntityId.Value)
         .Append(AttributeDefaults.ModuleName, entity.AttributeId, AttributeDefaults.ModuleName, referenced.AttributeId)
         .Save();
     }
     //选项类型
     else if (entity.TypeIsPickList())
     {
         if (entity.OptionSet != null && entity.OptionSet.IsPublic)
         {
             //依赖于公共选项集
             _dependencyBatchBuilder.Append(AttributeDefaults.ModuleName, entity.AttributeId, OptionSetDefaults.ModuleName, entity.OptionSetId.Value)
             .Save();
         }
     }
     return(true);
 }
Exemple #3
0
        public bool Create(params Domain.RibbonButton[] entities)
        {
            var wsIds = entities.Where(x => x.JsLibrary.IsNotEmpty() && x.JsLibrary.StartsWith("$webresource:"))?.Select(x => new { x.RibbonButtonId, WebResourceId = new Guid(x.JsLibrary.Replace("$webresource:", "")) })?.ToList();

            if (wsIds.NotEmpty())
            {
                //依赖于web资源
                foreach (var item in wsIds)
                {
                    _dependencyBatchBuilder.Append(RibbonButtonDefaults.ModuleName, item.RibbonButtonId, WebResourceDefaults.ModuleName, item.WebResourceId);
                }
                _dependencyBatchBuilder.Save();
            }
            return(true);
        }
Exemple #4
0
        public bool CreateMany(IList <WorkFlowStep> entities)
        {
            var result = true;

            using (UnitOfWork.Build(_workFlowStepRepository.DbContext))
            {
                _workFlowStepRepository.CreateMany(entities);
                //依赖于表单
                foreach (var item in entities)
                {
                    if (!item.FormId.Equals(Guid.Empty))
                    {
                        _dependencyBatchBuilder.Append(WorkFlowDefaults.ModuleName, item.WorkFlowId, FormDefaults.ModuleName, item.FormId);
                    }
                }
                _dependencyBatchBuilder.Save();
            }

            return(result);
        }