public DEObjectExecutor(DEOperationType opType, DEBase data) : base(opType) { data.NullCheck("data"); data.ClearRelativeData(); this._Data = data; }
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)); }
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; }
public static DEOperationLog ToOperationLog(this DEBase data, DEOperationType opType) { data.NullCheck("data"); DEOperationLog log = DEOperationLog.CreateLogFromEnvironment(); log.ResourceID = data.ID; log.SchemaType = data.SchemaType; log.OperationType = opType; log.Category = data.Schema.Category; log.Subject = string.Format("{0}: {1}", EnumItemDescriptionAttribute.GetDescription(opType), data.Name); log.SearchContent = data.ToFullTextString(); return(log); }
public DEMemberRelativeExecutor(DEOperationType opType, DESchemaObjectBase container, DEBase member) : base(opType, container, member) { }
public DEMemberRelativeExecutorBase(DEOperationType opType, DESchemaObjectBase container, DEBase member) : base(opType, member) { container.NullCheck("container"); container.ClearRelativeData(); if (member != null) { member.ClearRelativeData(); } this._Container = container; this._Relation = PrepareRelationObject(container, member); }
public DEMemberCollectionRelativeExecutor(DEOperationType opType, DEBase container, DESchemaObjectCollection members, DEStandardObjectSchemaType relationType) : base(opType, container, members, relationType) { }