forked from ddrilling/AsbCloudServer
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using System;
|
|
|
|
namespace AsbCloudApp.Data
|
|
{
|
|
/// <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; }
|
|
|
|
/// <summary>
|
|
/// Смещение часового пояса
|
|
/// </summary>
|
|
public TimeSpan Offset => TimeSpan.FromHours(Hours);
|
|
|
|
/// <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.##})";
|
|
}
|
|
} |