|
@@ -90,30 +90,22 @@ namespace Comal.Classes
|
|
|
public ScheduleRollover Rollover { get; set; }
|
|
|
}
|
|
|
|
|
|
- public class NextScheduleDue : CoreAggregate<Entity, Schedule, DateTime>
|
|
|
+ public class ActiveSchedulesFormula<T> : ComplexFormulaGenerator<T, int>
|
|
|
+ where T : Entity
|
|
|
{
|
|
|
- public override Expression<Func<Schedule, DateTime>> Aggregate => x => x.DueDate;
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Minimum;
|
|
|
- public override Filter<Schedule> Filter => new Filter<Schedule>(x => x.IncludeInAggregate).IsEqualTo(true);
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<Schedule, object>>, Expression<Func<Entity, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<Schedule, object>>, Expression<Func<Entity, object>>>()
|
|
|
- {
|
|
|
- { Schedule => Schedule.DocumentID, Entity => Entity.ID }
|
|
|
- };
|
|
|
+ public override IComplexFormulaNode<T, int> GetFormula() =>
|
|
|
+ Count<Schedule, Guid>(x => x.Property(x => x.ID))
|
|
|
+ .WithLink(x => x.DocumentID, x => x.ID);
|
|
|
}
|
|
|
|
|
|
- public class ActiveSchedules : CoreAggregate<Entity, Schedule, Guid>
|
|
|
+ public class NextScheduleFormula<T> : ComplexFormulaGenerator<T, DateTime>
|
|
|
+ where T : Entity
|
|
|
{
|
|
|
- public override Expression<Func<Schedule, Guid>> Aggregate => x => x.ID;
|
|
|
-
|
|
|
- public override AggregateCalculation Calculation => AggregateCalculation.Count;
|
|
|
-
|
|
|
- public override Dictionary<Expression<Func<Schedule, object>>, Expression<Func<Entity, object>>> Links =>
|
|
|
- new Dictionary<Expression<Func<Schedule, object>>, Expression<Func<Entity, object>>>()
|
|
|
- {
|
|
|
- { Schedule => Schedule.DocumentID, Entity => Entity.ID }
|
|
|
- };
|
|
|
+ public override IComplexFormulaNode<T, DateTime> GetFormula() =>
|
|
|
+ Aggregate<Schedule>(AggregateCalculation.Minimum,
|
|
|
+ x => x.Property(x => x.DueDate),
|
|
|
+ new Filter<Schedule>(x => x.IncludeInAggregate).IsEqualTo(true))
|
|
|
+ .WithLink(x => x.DocumentID, x => x.ID);
|
|
|
}
|
|
|
|
|
|
[UserTracking("Task Scheduler")]
|
|
@@ -224,6 +216,7 @@ namespace Comal.Classes
|
|
|
|
|
|
[CheckBoxEditor]
|
|
|
[EditorSequence(15)]
|
|
|
+ [Comment("Include this schedule in the '" + nameof(Equipment.NextSchedule) + "' aggregate and the Planned Maintenance screen.")]
|
|
|
public bool IncludeInAggregate { get; set; } = true;
|
|
|
|
|
|
#endregion
|