Exemplo n.º 1
0
        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);
        }
 protected void FeedCasePlanItem(BaseCasePlanItemInstance elt)
 {
     elt.NbOccurrence    = NbOccurrence;
     elt.RepetitionRule  = (RepetitionRule)RepetitionRule?.Clone();
     elt.EntryCriterions = EntryCriterions.Select(_ => (Criteria)_.Clone()).ToList();
     elt.ExitCriterions  = ExitCriterions.Select(_ => (Criteria)_.Clone()).ToList();
 }
Exemplo n.º 3
0
        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));
        }
        public CriteriaResult IsExitCriteriaSatisfied(BaseCasePlanItemInstance elt)
        {
            if (elt.ExitCriterions == null || !elt.ExitCriterions.Any())
            {
                return(CriteriaResult.NotSatisifed());
            }

            var res = elt.ExitCriterions.Select(c => IsCriteriaSatisfied(c)).FirstOrDefault(c => c.IsSatisfied);

            return(res == null?CriteriaResult.NotSatisifed() : res);
        }
Exemplo n.º 5
0
 public bool IsExitCriteriaSatisfied(BaseCasePlanItemInstance elt)
 {
     return(elt.ExitCriterions != null && elt.ExitCriterions.Any() && elt.ExitCriterions.Any(_ => IsCriteriaSatisfied(_, elt.NbOccurrence)));
 }
Exemplo n.º 6
0
 public bool IsRepetitionRuleSatisfied(BaseCasePlanItemInstance elt)
 {
     return(elt.RepetitionRule != null && ExpressionParser.IsValid(elt.RepetitionRule.Condition.Body, ExecutionContext));
 }
Exemplo n.º 7
0
 public bool IsEntryCriteriaSatisfied(BaseCasePlanItemInstance elt)
 {
     return(elt.EntryCriterions == null || !elt.EntryCriterions.Any() || elt.EntryCriterions.Any(_ => IsCriteriaSatisfied(_, elt.NbOccurrence)));
 }