Пример #1
0
        public static OuterEntityCollection FromSchemaObjects(DESchemaObjectCollection schemaObjectCollection)
        {
            schemaObjectCollection.NullCheck <ArgumentNullException>("schemaObjectCollection");

            var result = new OuterEntityCollection();

            schemaObjectCollection.ForEach(p => result.Add((OuterEntity)p));

            return(result);
        }
Пример #2
0
        public void RelationAction(
            DEBase container,
            DESchemaObjectCollection members,
            DEMemberRelationCollection relation,
            bool saveTargetData,
            bool saveMemberData,
            DEStandardObjectSchemaType type
            )
        {
            //取出旧的关系集合
            var oldRelation = DEMemberRelationAdapter.Instance.LoadByContainerID(container.ID, type.ToString());

            //所有旧成员集合
            var oldMemberIDs = oldRelation.Select(p => p.ID).ToList();

            var newMemberIDs = members.Select(m => m.ID).ToList();

            List <string> needDelIDs = new List <string>();

            foreach (var id in oldMemberIDs)
            {
                if (!newMemberIDs.Contains(id))
                {
                    needDelIDs.Add(id);
                }
            }


            //删除关系
            oldRelation.ForEach(p =>
            {
                if (needDelIDs.Contains(p.ID))
                {
                    DEMemberRelationAdapter.Instance.UpdateStatus(p, SchemaObjectStatus.DeletedByContainer);
                }
            });

            if (saveTargetData)
            {
                //容器入库
                DESchemaObjectAdapter.Instance.Update(container);
            }

            if (saveMemberData)
            {
                //删除成员
                needDelIDs.ForEach(id => DESchemaObjectAdapter.Instance.UpdateStatus(DESchemaObjectAdapter.Instance.Load(id), SchemaObjectStatus.Deleted));
                //新成员入库
                members.ForEach(p => DESchemaObjectAdapter.Instance.Update(p));
            }

            //新关系入库

            relation.ForEach(p => DEMemberRelationAdapter.Instance.Update(p));
        }
Пример #3
0
        public static DynamicEntityFieldCollection FromSchemaObjects(DESchemaObjectCollection schemaObjectCollection)
        {
            schemaObjectCollection.NullCheck <ArgumentNullException>("schemaObjectCollection");

            var temp = new DynamicEntityFieldCollection();

            schemaObjectCollection.ForEach(p => temp.Add((DynamicEntityField)p));

            var result = new DynamicEntityFieldCollection();

            result.CopyFrom(temp.OrderBy(p => p.SortNo));

            return(result);
        }
Пример #4
0
        public DEMemberCollectionRelativeExecutorBase(DEOperationType opType, DEBase container, DESchemaObjectCollection members)
            : base(opType, container)
        {
            container.NullCheck("container");
            container.ClearRelativeData();

            members.NullCheck("members");
            members.ForEach(p => p.ClearRelativeData());

            this._Container = container;
            this._Members   = members;

            this.SaveMemberData = true;
        }
Пример #5
0
        private DEMemberRelationCollection PrepareRelationObject(DESchemaObjectBase container, DESchemaObjectCollection members)
        {
            var result = new DEMemberRelationCollection();

            members.ForEach(member =>
            {
                DESimpleRelationBase relation = DEMemberRelationAdapter.Instance.Load(container.ID, member.ID);

                if (relation == null)
                {
                    relation = CreateRelation(container, member, _RelationType);
                }
                else
                {
                    OverrideExistedRelation = true;
                }
                relation.Status = member.Status;
                result.Add(relation);
            });

            return(result);
        }