-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWeekendData.cs
More file actions
90 lines (78 loc) · 1.81 KB
/
WeekendData.cs
File metadata and controls
90 lines (78 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using System;
using System.Collections.Generic;
using System.Globalization;
namespace CalendarService
{
/// <summary>
/// Класс с данными по выходным дням.
/// </summary>
public class WeekendData
{
/// <summary>
/// Год.
/// </summary>
public int Year { get; set; }
/// <summary>
/// Список месяцев.
/// </summary>
public List<Month> Months { get; set; }
/// <summary>
/// Информация о праздниках.
/// </summary>
public string HolidayInfo { get; set; }
#region Конструкторы.
public WeekendData(int year, List<Month> months, string holidayInfo)
{
Year = year;
Months = months;
HolidayInfo = holidayInfo;
}
private WeekendData() { }
#endregion
}
/// <summary>
/// Класс с данными по выходням дням за месяц.
/// </summary>
public class Month
{
private string name;
private int number;
/// <summary>
/// Наименование.
/// </summary>
public string Name
{
get => name;
set
{
name = value;
if (DateTime.TryParseExact(value, "MMMM", CultureInfo.CurrentCulture, DateTimeStyles.None, out DateTime month))
number = month.Month;
}
}
/// <summary>
/// Номер.
/// </summary>
public int Number
{
get => number;
set
{
number = value;
name = CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(number);
}
}
/// <summary>
/// Список выходных дней.
/// </summary>
public string[] Weekends { get; set; }
/// <summary>
/// Список праздничных дней.
/// </summary>
public string[] Holidays { get; set; }
/// <summary>
/// Список предпраздничных дней.
/// </summary>
public string[] PreHolidays { get; set; }
}
}