Class UnitDutyPeriod
- Namespace
- SIMDispatcher.Core.Models
- Assembly
- SIMDispatcher.Core.dll
Represents a duty period for a unit. Duty periods are required if the DutyOptions property is set to OnlyOnPeriods.
public record UnitDutyPeriod : IComparable<UnitDutyPeriod>, IComparable, IEquatable<UnitDutyPeriod>
- Inheritance
-
UnitDutyPeriod
- Implements
- Inherited Members
Properties
Day
Represents the day of the week for the duty period.
public DayOfWeek Day { get; set; }
Property Value
HourEnd
Represents the ending hour of the duty period.
public int HourEnd { get; set; }
Property Value
HourStart
Represents the starting hour of the duty period.
public int HourStart { get; set; }
Property Value
Id
public long? Id { get; set; }
Property Value
- long?
MinuteEnd
Represents the ending minute of the duty period.
public int MinuteEnd { get; set; }
Property Value
MinuteStart
Represents the starting minute of the duty period.
public int MinuteStart { get; set; }
Property Value
Methods
CompareTo(UnitDutyPeriod?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(UnitDutyPeriod? other)
Parameters
other
UnitDutyPeriodAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes other
in the sort order.Zero This instance occurs in the same position in the sort order as other
.Greater than zero This instance follows other
in the sort order.
CompareTo(object?)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
public int CompareTo(object? obj)
Parameters
obj
objectAn object to compare with this instance.
Returns
- int
A value that indicates the relative order of the objects being compared. The return value has these meanings:
Value Meaning Less than zero This instance precedes obj
in the sort order.Zero This instance occurs in the same position in the sort order as obj
.Greater than zero This instance follows obj
in the sort order.
Exceptions
- ArgumentException
obj
is not the same type as this instance.
IsDutyPeriodApplicable(DateTime)
Determines if the duty period is applicable at the specified date and time.
public bool IsDutyPeriodApplicable(DateTime dateTime)
Parameters
dateTime
DateTimeThe date and time to check.
Returns
- bool
True if the duty period is applicable at the specified date and time; otherwise, false.
IsValid()
Checks if the duty period has valid start and end times.
public bool IsValid()
Returns
- bool
True if the duty period has valid start and end times; otherwise, false.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.