-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
81 lines (69 loc) · 2.72 KB
/
Copy pathProgram.cs
File metadata and controls
81 lines (69 loc) · 2.72 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
using System;
using System.IO;
using System.Text;
namespace ShwanLessonFive
{
public class Program
{
static void Main(string[] args)
{
#region RunningClub
//RunningClub RC0 = new RunningClub("NoBoringRunners", true, "Vinnytsia");
//RunningClub RC1 = new RunningClub("SuperRunners", false, "Vinnytsia");
//RC0.NumberOfParticipants = 225;
//RC1.NumberOfParticipants = 35;
////RunningClub MergedRC = new RunningClub();
////MergedRC = MergedRC.MergeClubs(RC0, RC1);
////MergedRC.PrintFields(MergedRC);
//RunningClub MergedRC1 = new RunningClub();
//MergedRC1 = RC0 + RC1;
//MergedRC1.PrintFields(MergedRC1);
#endregion
Club club = new Club("NoBorringRunners", true, "Vinnytsia");
club.SaveClubInfoNotify += Club_SaveClubInfoNotify;
club.SaveClubInfo(club);
Console.ReadLine();
}
private static void Club_SaveClubInfoNotify(Club club)
{
string path = "C:\\Users\\Admin\\Desktop";
try
{
if (Directory.Exists(path))
{
if (!Directory.Exists(path + "\\ClubsInfo"))
{
{
Directory.CreateDirectory(path + "\\ClubsInfo");
}
}
}
}
catch (Exception ex) {
Console.WriteLine(ex.Message);
}
using (var sw = new StreamWriter(path + $"\\ClubsInfo\\{club.Name}.txt", false, Encoding.UTF8))
{
sw.WriteLine($"Club name: {club.Name}");
sw.WriteLine($"Club city: {club.City}");
sw.WriteLine($"Number of participants: {club.NumberOfParticipants}");
sw.WriteLine($"Club get participation in events: {club.SocietyActivities}");
}
Console.WriteLine($"Information about \"{club.Name}\" was successfully saved \nto \"" + path
+ $"\\ClubsInfo\\{club.Name}.txt\"");
}
private static void StartSocietyActivitiesEvent(Club club)
{
Console.WriteLine($"The club {club.Name} started it's society activities! \nCongratulations!!!");
}
//private static void CheckSundayEvent()
//{
// bool isSunday = String.Equals(DateTime.Today.DayOfWeek.ToString(), "Sunday");
// if (isSunday)
// {
// Console.WriteLine("Today our club organize an event at 8 am.");
// }
// else Console.WriteLine("The next event will be on Sunday.");
//}
}
}