Files
GazpromApp/Enums/PeriodType.cs
T
2025-07-05 20:50:36 +03:00

38 lines
910 B
C#

namespace GazpromApp.Enums;
public enum PeriodType
{
Unknown = -1,
Day = 0,
Week = 1,
Month = 2,
Year = 3
}
public static class PeriodTypeExtensions
{
public static string ToDescription(this PeriodType periodType)
{
return periodType switch
{
PeriodType.Day => "День",
PeriodType.Week => "Неделя",
PeriodType.Month => "Месяц",
PeriodType.Year => "Год",
PeriodType.Unknown => "Неизв.",
_ => string.Empty
};
}
public static PeriodType ToPeriodType(this string periodType)
{
return periodType switch
{
"День" => PeriodType.Day,
"Неделя" => PeriodType.Week,
"Месяц" => PeriodType.Month,
"Год" => PeriodType.Year,
_ => PeriodType.Unknown
};
}
}