-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
85 lines (70 loc) · 1.81 KB
/
Program.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Stoiko2
{
class Program
{
static void Menu()
{
Console.WriteLine("Read:\t1");
Console.WriteLine("Add:\t2");
Console.WriteLine("Sort:\t3");
Console.WriteLine("Remove:\t4");
Console.WriteLine("Find:\t5");
Console.WriteLine("Update:\t6");
}
static void Main(string[] args)
{
Console.WriteLine("Filename: ");
string filename = Validation.ValidationFile(Console.ReadLine());
Collection<House> hCollection = new Collection<House>(@"C:\Users\Максим\source\repos\Stoiko2\" + filename);
while (true)
{
Menu();
string choice = Console.ReadLine();
switch (choice)
{
case "1":
hCollection.ReadFromFile();
break;
case "2":
hCollection.Add(House.Parse(Console.ReadLine()));
break;
case "3":
Console.WriteLine("Criteria: ");
string crit = Console.ReadLine();
hCollection.Sort(crit);
break;
case "4":
Console.WriteLine("id: ");
string crit2 = Console.ReadLine();
hCollection.Remove(crit2);
break;
case "5":
Console.WriteLine("id: ");
string crit3 = Console.ReadLine();
List<House> result = hCollection.Find(crit3);
foreach (House item in result)
{
Console.WriteLine(item.ToString());
}
Console.ReadKey();
break;
case "6":
Console.WriteLine("id: ");
string crit4 = Console.ReadLine();
House newHum = House.Parse(Console.ReadLine());
hCollection.Update(crit4, newHum);
break;
default:
break;
}
Console.Clear();
Console.WriteLine(hCollection.ToString());
}
}
}
}