示例#1
0
 internal Program(ProgramConfig programConfig)
 {
     Id   = Guid.NewGuid();
     Name = programConfig.Name;
     foreach (var config in programConfig.CycleConfigs)
     {
         _cycles.AddRange(WateringCycle.ToWateringCycles(this, config));
     }
 }
示例#2
0
 internal bool ConflictsWith(WateringCycle cycle)
 {
     if (EndMinuteOfWeek > StartMinuteOfWeek && cycle.EndMinuteOfWeek > cycle.StartMinuteOfWeek)
     {
         return(RangeOverlaps(StartMinuteOfWeek, EndMinuteOfWeek, cycle.StartMinuteOfWeek, cycle.EndMinuteOfWeek));
     }
     else if (EndMinuteOfWeek > StartMinuteOfWeek && cycle.EndMinuteOfWeek < cycle.StartMinuteOfWeek)
     {
         return(cycle.EndMinuteOfWeek >= StartMinuteOfWeek || cycle.StartMinuteOfWeek <= EndMinuteOfWeek);
     }
     else if (EndMinuteOfWeek < StartMinuteOfWeek && cycle.EndMinuteOfWeek > cycle.StartMinuteOfWeek)
     {
         return(cycle.StartMinuteOfWeek <= EndMinuteOfWeek || cycle.EndMinuteOfWeek >= StartMinuteOfWeek);
     }
     else
     {
         return(true);
     }
 }