Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp4
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13.  
  14. List<Patient> patients = new List<Patient>();
  15. List<Room> rooms = new List<Room>();
  16. List<Doctor> doctors = new List<Doctor>();
  17. List<Therapy> therapies = new List<Therapy>();
  18. List<TherapiesPerPatient> therapiesPerPatient = new List<TherapiesPerPatient>();
  19.  
  20. Patient p1 = new Patient("Anna", "Papaiakovou");
  21. Patient p2 = new Patient("Danai", "Leibaditi");
  22. Patient p3 = new Patient("Valentina", "Koronaiou");
  23. Patient p4 = new Patient("Marios", "Karagiorgis");
  24. Patient p5 = new Patient("Xristoforos", "Tsiolis");
  25. Patient p6 = new Patient("Panagiotis", "Mpoutaras");
  26. Patient p7 = new Patient("Antonis", "Siorfanes");
  27. Patient p8 = new Patient("Kiriakos", "Sirios");
  28. Patient p9 = new Patient("Alexandros", "Tsiouris");
  29. Patient p10 = new Patient("Xristos", "Gkatzos");
  30. Patient p11 = new Patient("Vladi", "slav");
  31. patients.Add(p1);
  32. patients.Add(p2);
  33. patients.Add(p3);
  34. patients.Add(p4);
  35. patients.Add(p5);
  36. patients.Add(p6);
  37. patients.Add(p7);
  38. patients.Add(p8);
  39. patients.Add(p9);
  40. patients.Add(p10);
  41. patients.Add(p11);
  42.  
  43. Room R1 = new Room("A12");
  44. Room R2 = new Room("K4.2");
  45. Room R3 = new Room("A2");
  46. rooms.Add(R1);
  47. rooms.Add(R2);
  48. rooms.Add(R3);
  49.  
  50.  
  51. Doctor d1 = new Doctor("Hector", "Gatsos");
  52. Doctor d2 = new Doctor("Giorgos", "Prokopakis");
  53. Doctor d3 = new Doctor("Kiveli", "Diareme");
  54. Doctor d4 = new Doctor("Lena", "Kapetanaki");
  55. doctors.Add(d1);
  56. doctors.Add(d2);
  57. doctors.Add(d3);
  58. doctors.Add(d4);
  59.  
  60.  
  61. Therapy T1 = new Therapy("Ximiotherapia", "Tha ginei ximioperathia");
  62. Therapy T2 = new Therapy("Fisiotherapia", "Tha ginei Fisiotherapia");
  63. Therapy T3 = new Therapy("Adinatisma", "Tha ginei adinatisma");
  64. Therapy T4 = new Therapy("Alergies", "Tha ginei tis alergias");
  65. therapies.Add(T1);
  66. therapies.Add(T2);
  67. therapies.Add(T3);
  68. therapies.Add(T4);
  69.  
  70.  
  71. p1.therapies.Add(T1);
  72. p1.therapies.Add(T2);
  73.  
  74. p2.therapies.Add(T3);
  75. p3.therapies.Add(T4);
  76. p4.therapies.Add(T2);
  77. p5.therapies.Add(T3);
  78. p6.therapies.Add(T1);
  79. p7.therapies.Add(T2);
  80. p8.therapies.Add(T4);
  81. p8.therapies.Add(T3);
  82. p9.therapies.Add(T2);
  83. p10.therapies.Add(T1);
  84. p10.therapies.Add(T2);
  85. p11.therapies.Add(T3);
  86.  
  87. TherapiesPerPatient TPP1 = new TherapiesPerPatient(p1, p1.therapies);
  88. TherapiesPerPatient TPP2 = new TherapiesPerPatient(p2, p2.therapies);
  89. TherapiesPerPatient TPP3 = new TherapiesPerPatient(p3, p3.therapies);
  90. TherapiesPerPatient TPP4 = new TherapiesPerPatient(p4, p4.therapies);
  91. TherapiesPerPatient TPP5 = new TherapiesPerPatient(p5, p5.therapies);
  92. TherapiesPerPatient TPP6 = new TherapiesPerPatient(p6, p6.therapies);
  93. TherapiesPerPatient TPP7 = new TherapiesPerPatient(p7, p7.therapies);
  94. TherapiesPerPatient TPP8 = new TherapiesPerPatient(p8, p8.therapies);
  95. TherapiesPerPatient TPP9 = new TherapiesPerPatient(p9, p9.therapies);
  96. TherapiesPerPatient TPP10 = new TherapiesPerPatient(p10, p10.therapies);
  97. TherapiesPerPatient TPP11 = new TherapiesPerPatient(p11, p11.therapies);
  98.  
  99.  
  100. therapiesPerPatient.Add(TPP1);
  101. therapiesPerPatient.Add(TPP2);
  102. therapiesPerPatient.Add(TPP3);
  103. therapiesPerPatient.Add(TPP4);
  104. therapiesPerPatient.Add(TPP5);
  105. therapiesPerPatient.Add(TPP6);
  106. therapiesPerPatient.Add(TPP7);
  107. therapiesPerPatient.Add(TPP8);
  108. therapiesPerPatient.Add(TPP9);
  109. therapiesPerPatient.Add(TPP10);
  110. therapiesPerPatient.Add(TPP11);
  111.  
  112. Console.WriteLine("------therapiesPerPatient--------");
  113. foreach (var item in therapiesPerPatient)
  114. {
  115. item.Output();
  116. Console.WriteLine();
  117. }
  118.  
  119. Console.WriteLine("---------------------------------");
  120.  
  121.  
  122. Console.WriteLine();
  123. Console.WriteLine();
  124. Console.WriteLine();
  125. Console.WriteLine();
  126.  
  127.  
  128.  
  129. PatientsDoctors PD1 = new PatientsDoctors(p1, d1);
  130. PatientsDoctors PD2 = new PatientsDoctors(p1, d2);
  131. PatientsDoctors PD3 = new PatientsDoctors(p1, d3);
  132.  
  133. PatientsDoctors PD4 = new PatientsDoctors(p2, d2);
  134. PatientsDoctors PD5 = new PatientsDoctors(p2, d4);
  135.  
  136.  
  137. Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@");
  138.  
  139. for (int i = 0; i < patients.Count; i++)
  140. {
  141. Console.WriteLine(patients[i].LastName);
  142. for (int j = 0; j < patients[i].doctors.Count; j++)
  143. {
  144. patients[i].doctors[j].Output();
  145. }
  146. }
  147.  
  148. Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@");
  149.  
  150.  
  151.  
  152. //-------------Patients------------
  153. Console.ForegroundColor = ConsoleColor.Blue;
  154. Console.WriteLine("Patients");
  155. Console.ForegroundColor = ConsoleColor.White;
  156. Console.WriteLine($"{ "Name",-15} | { "LastName",-5} ");
  157. Console.WriteLine("----------------+-----------------");
  158. foreach (var item in patients)
  159. {
  160. item.Output();
  161. }
  162.  
  163. Console.WriteLine("----------------+-----------------");
  164. Console.WriteLine();
  165. //---------------------------------
  166.  
  167. //-------------Rooms------------
  168. Console.ForegroundColor = ConsoleColor.Blue;
  169. Console.WriteLine("Rooms");
  170. Console.ForegroundColor = ConsoleColor.White;
  171. Console.WriteLine($"{ "Domatio",-15} | { "ID",-5} ");
  172. Console.WriteLine("----------------+-----------------");
  173. foreach (var item in rooms)
  174. {
  175. item.Output();
  176. }
  177. Console.WriteLine("----------------+-----------------");
  178. Console.WriteLine();
  179. //---------------------------------
  180.  
  181. //-------------Therapies------------
  182. Console.ForegroundColor = ConsoleColor.Blue;
  183. Console.WriteLine("Therapies");
  184. Console.ForegroundColor = ConsoleColor.White;
  185. Console.WriteLine($"{ "Title",-15} | { "Description",-5} ");
  186. Console.WriteLine("----------------+-----------------");
  187. foreach (var item in therapies)
  188. {
  189. item.Output();
  190. }
  191. Console.WriteLine("----------------+-----------------");
  192. Console.WriteLine();
  193. //---------------------------------
  194.  
  195. //-------------Doctors------------
  196. Console.ForegroundColor = ConsoleColor.Blue;
  197. Console.WriteLine("Doctors");
  198. Console.ForegroundColor = ConsoleColor.White;
  199. Console.WriteLine($"{ "Name",-15} | { "LastName",-5} ");
  200. Console.WriteLine("----------------+-----------------");
  201. foreach (var item in doctors)
  202. {
  203. item.Output();
  204. }
  205. Console.WriteLine("----------------+-----------------");
  206. Console.WriteLine();
  207. //---------------------------------
  208.  
  209. }
  210. }
  211.  
  212.  
  213. class PatientsDoctors
  214. {
  215. public List<Doctor> doctors = new List<Doctor>();
  216. public List<Patient> patients = new List<Patient>();
  217.  
  218.  
  219. public PatientsDoctors(Patient patient, Doctor doctor)
  220. {
  221. patient.doctors.Add(doctor);
  222. doctor.patients.Add(patient);
  223.  
  224. doctors = patient.doctors;
  225. patients = doctor.patients;
  226. }
  227.  
  228.  
  229.  
  230. }
  231.  
  232. class TherapiesPerPatient
  233. {
  234. Patient Patient;
  235. List<Therapy> Therapies = new List<Therapy>();
  236.  
  237. public TherapiesPerPatient(Patient patient, List<Therapy> therapies)
  238. {
  239. Patient = patient;
  240. Therapies = therapies;
  241. }
  242.  
  243. public void Output()
  244. {
  245. Console.WriteLine(Patient.Name + " " + Patient.LastName);
  246. foreach (var item in Therapies)
  247. {
  248. item.Output();
  249. }
  250. }
  251. }
  252.  
  253.  
  254.  
  255. class Patient
  256. {
  257. public string Name { get; set; }
  258. public string LastName { get; set; }
  259.  
  260. public List<Therapy> therapies = new List<Therapy>();
  261. public List<Doctor> doctors = new List<Doctor>();
  262.  
  263. public Patient(string name, string lastname)
  264. {
  265. Name = name;
  266. LastName = lastname;
  267. }
  268.  
  269. public void Output()
  270. {
  271. Console.WriteLine($"{ Name,-15} | { LastName,-5} ");
  272. }
  273.  
  274. }
  275.  
  276. class Room
  277. {
  278. public string ID { get; set; }
  279.  
  280. public Room(string id)
  281. {
  282. ID = id;
  283. }
  284.  
  285. public void Output()
  286. {
  287. Console.WriteLine($"{ "Domatio",-15} | { ID,-5} ");
  288. }
  289. }
  290.  
  291. class Therapy
  292. {
  293. public string Title { get; set; }
  294. public string Description { get; set; }
  295.  
  296. public Therapy(string title, string description)
  297. {
  298. Title = title;
  299. Description = description;
  300. }
  301. public void Output()
  302. {
  303. Console.WriteLine($"{ Title,-15} | { Description,-5} ");
  304. }
  305. }
  306.  
  307. class Doctor
  308. {
  309. public string Name { get; set; }
  310. public string LastName { get; set; }
  311.  
  312. public List<Patient> patients = new List<Patient>();
  313.  
  314. public Doctor(string name, string lastName)
  315. {
  316. Name = name;
  317. LastName = lastName;
  318. }
  319.  
  320. public void Output()
  321. {
  322. Console.WriteLine($"{ Name,-15} | { LastName,-5} ");
  323. }
  324.  
  325. }
  326. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement