DD.WellWorkover.Cloud/AsbCloudApp/Data/SimpleTimezoneDto.cs

45 lines
1.2 KiB
C#

namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// âðåìåííàÿ çîíà
/// </summary>
public class SimpleTimezoneDto
{
/// <summary>
/// ñìåùåíèå â ÷àñàõ îòíîñèòåëüíî UTC
/// </summary>
public double Hours { get; set; }
/// <summary>
/// èäåíòèôèêàòîð ÷àñîâîé çîíû
/// </summary>
public string? TimezoneId { get; set; }
/// <summary>
/// çàïðåò íà ïåðåîïðåäåëåíèå
/// </summary>
public bool IsOverride { get; set; }
/// <inheritdoc/>
public override bool Equals(object? obj)
{
if (obj is SimpleTimezoneDto tTimeZone
&& tTimeZone.Hours == Hours
&& tTimeZone.TimezoneId == TimezoneId
&& tTimeZone.IsOverride == IsOverride)
return true;
return false;
}
/// <inheritdoc/>
public override int GetHashCode()
=> Hours.GetHashCode()
| TimezoneId?.GetHashCode()??-1
| IsOverride.GetHashCode();
/// <inheritdoc/>
public override string ToString()
=> $"{TimezoneId} (UTC+{Hours:00.##})";
}
}