public bool IsCriteriaSatisfied(Criteria criteria, int nbOccurrence) { if (criteria.SEntry.IfPart != null && criteria.SEntry.IfPart.Condition != null) { if (!ExpressionParser.IsValid(criteria.SEntry.IfPart.Condition, ExecutionContext)) { return(false); } } foreach (var planItemOnPart in criteria.SEntry.PlanItemOnParts) { var id = BaseCasePlanItemInstance.BuildId(AggregateId, planItemOnPart.SourceRef, nbOccurrence); var source = GetCasePlanItem(id); if (planItemOnPart.StandardEvent != source.LatestTransition) { return(false); } } foreach (var caseItemOnPart in criteria.SEntry.FileItemOnParts) { var id = CaseFileItemInstance.BuildId(AggregateId, caseItemOnPart.SourceRef); var source = GetCaseFileItem(id); if (caseItemOnPart.StandardEvent != source.LatestTransition) { return(false); } } return(true); }
public BaseCasePlanItemInstance TryCreateInstance(BaseCasePlanItemInstance elt) { var evt = new CasePlanItemInstanceCreatedEvent(Guid.NewGuid().ToString(), AggregateId, Version, elt.Id, DateTime.UtcNow); Handle(evt); DomainEvents.Add(evt); var id = BaseCasePlanItemInstance.BuildId(AggregateId, elt.EltId, elt.NbOccurrence + 1); return(GetCasePlanItem(id)); }