public PreservationPeriod(string plant, DateTime dueTimeUtc, PreservationPeriodStatus status)
     : base(plant)
 {
     if (status != PreservationPeriodStatus.NeedsUserInput && status != PreservationPeriodStatus.ReadyToBePreserved)
     {
         throw new ArgumentException($"{status} is an illegal initial status for a {nameof(PreservationPeriod)}");
     }
     DueTimeUtc = dueTimeUtc;
     Status     = status;
 }
Пример #2
0
        public TagRequirement(string plant, int intervalWeeks, RequirementDefinition requirementDefinition)
            : base(plant)
        {
            if (requirementDefinition == null)
            {
                throw new ArgumentNullException(nameof(requirementDefinition));
            }

            if (requirementDefinition.Plant != plant)
            {
                throw new ArgumentException($"Can't relate item in {requirementDefinition.Plant} to item in {plant}");
            }

            IntervalWeeks           = intervalWeeks;
            Usage                   = requirementDefinition.Usage;
            RequirementDefinitionId = requirementDefinition.Id;

            _initialPreservationPeriodStatus = requirementDefinition.NeedsUserInput
                ? PreservationPeriodStatus.NeedsUserInput
                : PreservationPeriodStatus.ReadyToBePreserved;
        }