public static void UpdateOperationsGroupComplex(OperationsGroup group) { UpdateOperationGroup(group); for (int i = group.Tags.Count - 1; i > -1; i--) { RelTag tag = group.Tags[i]; if (tag.IsMarkForDeletion && !tag.IsDirty) { DeleteRelation(tag, group); continue; } if (tag.IsDirty) { InsertRelation(tag, group); } } foreach (var operation in group.Operations) { operation.SetFrequency(group.Frequency); operation.SetImportance(group.Importance); UpdateOperationTags(operation, group.Tags); UpdateOperationComplex(operation); } }
public RelTag ConvertToBusinessLogicEntity(DalOperationsGroupTag dataEntity) { var result1 = new RelTag(dataEntity.Id, _tags.First(t => t.Id == dataEntity.TagId), dataEntity.OperationsGroupId); result1.IsDirty = false; return(result1); }
public (RelTag, RelOperation) ConvertToBusinessLogicEntity(DalOperationTags dataEntity) { var result1 = new RelTag(dataEntity.Id, _tags.First(t => t.Id == dataEntity.TagId), dataEntity.OperationId); var result2 = new RelOperation(dataEntity.Id, _operations.First(o => o.Id == dataEntity.OperationId), dataEntity.TagId); result1.IsDirty = false; result2.IsDirty = false; return(result1, result2); }
private static int InsertRelation(RelTag tag, OperationsGroup group) { if (tag.IsDirty) { var newId = OperationsGroupRelationAdapter.Insert(OperationsGroupRelationMapper.ConvertToDALEntity(tag, group)); tag.UpdateId(newId); tag.IsDirty = false; } return(tag.Id.Value); }
private static int InsertRelation(RelTag tag, Operation operation) { if (tag.IsDirty) { var newId = OperationTagRelationAdapter.Insert(RelationMapper.ConvertToDALEntity(tag, operation)); tag.UpdateId(newId); tag.IsDirty = false; var relOperation = tag.Tag.Operations.Where(o => o.Operation == operation).First(); relOperation.UpdateId(newId); relOperation.IsDirty = false; } return(tag.Id.Value); }
public DalOperationTags ConvertToDALEntity(RelTag businessEntity1, Operation businessEntity2) { var result = new DalOperationTags(businessEntity1.Id, businessEntity2.Id, businessEntity1.Tag.Id); return(result); }
private static void DeleteRelation(RelTag tag, Operation operation) { operation.RemoveTag(tag); OperationTagRelationAdapter.Delete(RelationMapper.ConvertToDALEntity(tag, operation)); }
private static void DeleteRelation(RelTag tag, OperationsGroup group) { group.RemoveTag(tag); OperationsGroupRelationAdapter.Delete(OperationsGroupRelationMapper.ConvertToDALEntity(tag, group)); }