Class Unit
- Namespace
- SIMDispatcher.Core.Models
- Assembly
- SIMDispatcher.Core.dll
Represents a unit within the area of a dispatch center.
public class Unit : IComparable<Unit>, IComparable, IEquatable<Unit>
- Inheritance
-
Unit
- Implements
- Inherited Members
Properties
Callsign
The (long) callsign of the unit.
[Display(Description = "Callsign", ResourceType = typeof(UnitLocalization))]
public string? Callsign { get; set; }
Property Value
CallsignGps
The callsign displayed on maps if IsEquippedWithGps is set to true.
[Display(Description = "CallsignGps", ResourceType = typeof(UnitLocalization))]
public string? CallsignGps { get; set; }
Property Value
CallsignShort
A short callsign variant of the unit.
[Display(Description = "CallsignShort", ResourceType = typeof(UnitLocalization))]
public string? CallsignShort { get; set; }
Property Value
CallsignVerbal
The verbal callsign of the unit.
[Display(Description = "CallsignVerbal", ResourceType = typeof(UnitLocalization))]
public string? CallsignVerbal { get; set; }
Property Value
Category
The category of the unit.
[Display(Description = "Category", ResourceType = typeof(UnitLocalization))]
public UnitCategory Category { get; set; }
Property Value
Remarks
By setting a value to CategoryOverride, this can be cosmetically overridden.
CategoryOverride
The overridden category of the unit.
[Display(Description = "CategoryOverride", ResourceType = typeof(UnitLocalization))]
public string? CategoryOverride { get; set; }
Property Value
CommandcenterId
The identifier of the command center to which the unit belongs.
[Display(Description = "CommandcenterId", ResourceType = typeof(UnitLocalization))]
public long CommandcenterId { get; set; }
Property Value
DispatchGroups
The dispatch groups associated with the unit. DispatchGroupsDispatchGroups
[Display(Description = "DispatchGroups", ResourceType = typeof(UnitLocalization))]
public string? DispatchGroups { get; set; }
Property Value
DispatchOption
The dispatch option of the unit, determining how the unit is automatically suggested by the system.
[Display(Description = "DispatchOption", ResourceType = typeof(UnitLocalization))]
public UnitDispatchOption DispatchOption { get; set; }
Property Value
DoctorOption
The doctor option of the unit.
[Display(Description = "DoctorOption", ResourceType = typeof(UnitLocalization))]
public UnitDoctorOption DoctorOption { get; set; }
Property Value
Remarks
If set to PickUpAtPoi, the doctor is picked up at the specified doctor pickup POI after dispatch.
DoctorPickupPoi
The point of interest (POI) where the doctor is picked up then value is set to PickUpAtPoi.
[Display(Description = "DoctorPickupPoi", ResourceType = typeof(UnitLocalization))]
public Poi? DoctorPickupPoi { get; set; }
Property Value
DutyOptions
Determines the duty options of the unit, including its availability and reaction to dispatch.
[Display(Description = "DutyOptions", ResourceType = typeof(UnitLocalization))]
public UnitDutyOptions DutyOptions { get; set; }
Property Value
Remarks
If set to OnlyOnPeriods, unit duty periods in DutyPeriods are required.
DutyPeriods
The list of duty periods associated with the unit.
[Display(Description = "DutyPeriods", ResourceType = typeof(UnitLocalization))]
public List<UnitDutyPeriod>? DutyPeriods { get; set; }
Property Value
Remarks
Required if DutyOptions is set to OnlyOnPeriods.
Equipments
The list of equipment associated with the unit.
[Display(Description = "Equipments", ResourceType = typeof(UnitLocalization))]
public List<UnitEquipment>? Equipments { get; set; }
Property Value
ExternalAvailablePercent
The external availability percentage of the unit when referenced by another dispatch center. This value determines the unit's potential availability.
[Display(Description = "ExternalAvailablePercent", ResourceType = typeof(UnitLocalization))]
public int ExternalAvailablePercent { get; set; }
Property Value
Id
public long Id { get; set; }
Property Value
IsEquippedWithGps
Indicates whether the unit is equipped with GPS. This property determines whether the unit's geographical information is displayed on maps. It also affects automatic suggestions:
- If
, suggestions use the Poi location for calculating the nearest units.false
- If
and unit status is OnDutyAlongWay, suggestions use the real GPS location to calculate the distance to the operation location.true
[Display(Description = "IsEquippedWithGps", ResourceType = typeof(UnitLocalization))]
public bool IsEquippedWithGps { get; set; }
Property Value
IsFirstResponder
Indicates whether the unit is a first responder. This property affects suggestions and the unit's behavior on operation sites.
[Display(Description = "IsFirstResponder", ResourceType = typeof(UnitLocalization))]
public bool IsFirstResponder { get; set; }
Property Value
IsNotVolunteerUnit
Indicates whether the unit is not a volunteer unit. Dispatch times will affect based on this value.
[Display(Description = "IsNotVolunteerUnit", ResourceType = typeof(UnitLocalization))]
public bool IsNotVolunteerUnit { get; set; }
Property Value
IsStartingWithStatus6
Indicates whether the unit starts in a new session with status NotOnDuty. This property affects the visual representation only and does not affect the actual duty status of the unit. To control the unit's duty status, use the DutyOptions property. The unit will react to dispatches based on its duty status as determined by the DutyOptions.
[Display(Description = "IsStartingWithStatus6", ResourceType = typeof(UnitLocalization))]
public bool IsStartingWithStatus6 { get; set; }
Property Value
Poi
The point of interest (POI) where the unit is located.
[Display(Description = "Poi", ResourceType = typeof(UnitLocalization))]
public Poi? Poi { get; set; }
Property Value
Radiogroup
The radio group associated with the unit. Is null
if not set.
[Display(Description = "Radiogroup", ResourceType = typeof(UnitLocalization))]
public Radiogroup? Radiogroup { get; set; }
Property Value
StatusPages
[Display(Description = "StatusPages", ResourceType = typeof(UnitLocalization))]
public List<StatuspageUnit>? StatusPages { get; set; }
Property Value
Methods
CompareTo(Unit?)
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(Unit? other)
Parameters
other
UnitAn 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.
Equals(Unit?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Unit? other)
Parameters
other
UnitAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetCategory()
Gets the display category of the unit.
public string GetCategory()
Returns
- string
The display category.
GetCommanderLevel()
Gets the commander level based on the unit category.
public int GetCommanderLevel()
Returns
- int
The commander level.
GetCurrentDutyPeriod(DateTime)
Gets the current duty period based on the provided time.
public UnitDutyPeriod? GetCurrentDutyPeriod(DateTime currentTime)
Parameters
currentTime
DateTimeThe current time.
Returns
- UnitDutyPeriod
The current duty period if applicable; otherwise, null.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
HasInvalidDutyPeriods()
Checks if there are any invalid duty periods.
public bool HasInvalidDutyPeriods()
Returns
- bool
True if there are any invalid duty periods; otherwise, false.
HasOverlappingDutyPeriods()
Checks for overlapping duty periods.
public bool HasOverlappingDutyPeriods()
Returns
- bool
True if there are any overlapping duty periods; otherwise, false.
IsAbleToTransportPatients()
Checks if the unit is able to transport patients.
public bool IsAbleToTransportPatients()
Returns
- bool
True if the unit is able to transport patients; otherwise, false.
IsAmbulance()
Checks if the unit is an ambulance.
public bool IsAmbulance()
Returns
- bool
True if the unit is an ambulance; otherwise, false.
IsAmbulanceNonUrgent()
Checks if the unit is a non-urgent ambulance.
public bool IsAmbulanceNonUrgent()
Returns
- bool
True if the unit is a non-urgent ambulance; otherwise, false.
IsAmbulanceUrgent()
Checks if the unit is an urgent ambulance.
public bool IsAmbulanceUrgent()
Returns
- bool
True if the unit is an urgent ambulance; otherwise, false.
IsDoctor()
Checks if the unit is a doctor.
public bool IsDoctor()
Returns
- bool
True if the unit is a doctor; otherwise, false.
IsFirefighter()
Checks if the unit is a firefighter.
public bool IsFirefighter()
Returns
- bool
True if the unit is a firefighter; otherwise, false.
IsHelicopter()
Checks if the unit is a helicopter.
public bool IsHelicopter()
Returns
- bool
True if the unit is a helicopter; otherwise, false.
TimeUntilActiveShiftEnd(DateTime)
Returns the time until the end of the currently active shift, if any.
public TimeSpan? TimeUntilActiveShiftEnd(DateTime currentTime)
Parameters
currentTime
DateTimeThe current date and time.
Returns
- TimeSpan?
The time span until the end of the currently active shift, or
null
if there are no active shifts.
TimeUntilNextShiftStart(DateTime)
Returns the time until the start of the next shift after the current time.
public TimeSpan? TimeUntilNextShiftStart(DateTime currentTime)
Parameters
currentTime
DateTimeThe current date and time.
Returns
- TimeSpan?
The time span until the start of the next shift, or
null
if there are no upcoming shifts.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
ToString(string)
public string ToString(string format)
Parameters
format
string