Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp4
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<Patient> patients = new List<Patient>();
- List<Room> rooms = new List<Room>();
- List<Doctor> doctors = new List<Doctor>();
- List<Therapy> therapies = new List<Therapy>();
- List<TherapiesPerPatient> therapiesPerPatient = new List<TherapiesPerPatient>();
- Patient p1 = new Patient("Anna", "Papaiakovou");
- Patient p2 = new Patient("Danai", "Leibaditi");
- Patient p3 = new Patient("Valentina", "Koronaiou");
- Patient p4 = new Patient("Marios", "Karagiorgis");
- Patient p5 = new Patient("Xristoforos", "Tsiolis");
- Patient p6 = new Patient("Panagiotis", "Mpoutaras");
- Patient p7 = new Patient("Antonis", "Siorfanes");
- Patient p8 = new Patient("Kiriakos", "Sirios");
- Patient p9 = new Patient("Alexandros", "Tsiouris");
- Patient p10 = new Patient("Xristos", "Gkatzos");
- Patient p11 = new Patient("Vladi", "slav");
- patients.Add(p1);
- patients.Add(p2);
- patients.Add(p3);
- patients.Add(p4);
- patients.Add(p5);
- patients.Add(p6);
- patients.Add(p7);
- patients.Add(p8);
- patients.Add(p9);
- patients.Add(p10);
- patients.Add(p11);
- Room R1 = new Room("A12");
- Room R2 = new Room("K4.2");
- Room R3 = new Room("A2");
- rooms.Add(R1);
- rooms.Add(R2);
- rooms.Add(R3);
- Doctor d1 = new Doctor("Hector", "Gatsos");
- Doctor d2 = new Doctor("Giorgos", "Prokopakis");
- Doctor d3 = new Doctor("Kiveli", "Diareme");
- Doctor d4 = new Doctor("Lena", "Kapetanaki");
- doctors.Add(d1);
- doctors.Add(d2);
- doctors.Add(d3);
- doctors.Add(d4);
- Therapy T1 = new Therapy("Ximiotherapia", "Tha ginei ximioperathia");
- Therapy T2 = new Therapy("Fisiotherapia", "Tha ginei Fisiotherapia");
- Therapy T3 = new Therapy("Adinatisma", "Tha ginei adinatisma");
- Therapy T4 = new Therapy("Alergies", "Tha ginei tis alergias");
- therapies.Add(T1);
- therapies.Add(T2);
- therapies.Add(T3);
- therapies.Add(T4);
- p1.therapies.Add(T1);
- p1.therapies.Add(T2);
- p2.therapies.Add(T3);
- p3.therapies.Add(T4);
- p4.therapies.Add(T2);
- p5.therapies.Add(T3);
- p6.therapies.Add(T1);
- p7.therapies.Add(T2);
- p8.therapies.Add(T4);
- p8.therapies.Add(T3);
- p9.therapies.Add(T2);
- p10.therapies.Add(T1);
- p10.therapies.Add(T2);
- p11.therapies.Add(T3);
- TherapiesPerPatient TPP1 = new TherapiesPerPatient(p1, p1.therapies);
- TherapiesPerPatient TPP2 = new TherapiesPerPatient(p2, p2.therapies);
- TherapiesPerPatient TPP3 = new TherapiesPerPatient(p3, p3.therapies);
- TherapiesPerPatient TPP4 = new TherapiesPerPatient(p4, p4.therapies);
- TherapiesPerPatient TPP5 = new TherapiesPerPatient(p5, p5.therapies);
- TherapiesPerPatient TPP6 = new TherapiesPerPatient(p6, p6.therapies);
- TherapiesPerPatient TPP7 = new TherapiesPerPatient(p7, p7.therapies);
- TherapiesPerPatient TPP8 = new TherapiesPerPatient(p8, p8.therapies);
- TherapiesPerPatient TPP9 = new TherapiesPerPatient(p9, p9.therapies);
- TherapiesPerPatient TPP10 = new TherapiesPerPatient(p10, p10.therapies);
- TherapiesPerPatient TPP11 = new TherapiesPerPatient(p11, p11.therapies);
- therapiesPerPatient.Add(TPP1);
- therapiesPerPatient.Add(TPP2);
- therapiesPerPatient.Add(TPP3);
- therapiesPerPatient.Add(TPP4);
- therapiesPerPatient.Add(TPP5);
- therapiesPerPatient.Add(TPP6);
- therapiesPerPatient.Add(TPP7);
- therapiesPerPatient.Add(TPP8);
- therapiesPerPatient.Add(TPP9);
- therapiesPerPatient.Add(TPP10);
- therapiesPerPatient.Add(TPP11);
- Console.WriteLine("------therapiesPerPatient--------");
- foreach (var item in therapiesPerPatient)
- {
- item.Output();
- Console.WriteLine();
- }
- Console.WriteLine("---------------------------------");
- Console.WriteLine();
- Console.WriteLine();
- Console.WriteLine();
- Console.WriteLine();
- PatientsDoctors PD1 = new PatientsDoctors(p1, d1);
- PatientsDoctors PD2 = new PatientsDoctors(p1, d2);
- PatientsDoctors PD3 = new PatientsDoctors(p1, d3);
- PatientsDoctors PD4 = new PatientsDoctors(p2, d2);
- PatientsDoctors PD5 = new PatientsDoctors(p2, d4);
- Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@");
- for (int i = 0; i < patients.Count; i++)
- {
- Console.WriteLine(patients[i].LastName);
- for (int j = 0; j < patients[i].doctors.Count; j++)
- {
- patients[i].doctors[j].Output();
- }
- }
- Console.WriteLine("@@@@@@@@@@@@@@@@@@@@@@@");
- //-------------Patients------------
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("Patients");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine($"{ "Name",-15} | { "LastName",-5} ");
- Console.WriteLine("----------------+-----------------");
- foreach (var item in patients)
- {
- item.Output();
- }
- Console.WriteLine("----------------+-----------------");
- Console.WriteLine();
- //---------------------------------
- //-------------Rooms------------
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("Rooms");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine($"{ "Domatio",-15} | { "ID",-5} ");
- Console.WriteLine("----------------+-----------------");
- foreach (var item in rooms)
- {
- item.Output();
- }
- Console.WriteLine("----------------+-----------------");
- Console.WriteLine();
- //---------------------------------
- //-------------Therapies------------
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("Therapies");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine($"{ "Title",-15} | { "Description",-5} ");
- Console.WriteLine("----------------+-----------------");
- foreach (var item in therapies)
- {
- item.Output();
- }
- Console.WriteLine("----------------+-----------------");
- Console.WriteLine();
- //---------------------------------
- //-------------Doctors------------
- Console.ForegroundColor = ConsoleColor.Blue;
- Console.WriteLine("Doctors");
- Console.ForegroundColor = ConsoleColor.White;
- Console.WriteLine($"{ "Name",-15} | { "LastName",-5} ");
- Console.WriteLine("----------------+-----------------");
- foreach (var item in doctors)
- {
- item.Output();
- }
- Console.WriteLine("----------------+-----------------");
- Console.WriteLine();
- //---------------------------------
- }
- }
- class PatientsDoctors
- {
- public List<Doctor> doctors = new List<Doctor>();
- public List<Patient> patients = new List<Patient>();
- public PatientsDoctors(Patient patient, Doctor doctor)
- {
- patient.doctors.Add(doctor);
- doctor.patients.Add(patient);
- doctors = patient.doctors;
- patients = doctor.patients;
- }
- }
- class TherapiesPerPatient
- {
- Patient Patient;
- List<Therapy> Therapies = new List<Therapy>();
- public TherapiesPerPatient(Patient patient, List<Therapy> therapies)
- {
- Patient = patient;
- Therapies = therapies;
- }
- public void Output()
- {
- Console.WriteLine(Patient.Name + " " + Patient.LastName);
- foreach (var item in Therapies)
- {
- item.Output();
- }
- }
- }
- class Patient
- {
- public string Name { get; set; }
- public string LastName { get; set; }
- public List<Therapy> therapies = new List<Therapy>();
- public List<Doctor> doctors = new List<Doctor>();
- public Patient(string name, string lastname)
- {
- Name = name;
- LastName = lastname;
- }
- public void Output()
- {
- Console.WriteLine($"{ Name,-15} | { LastName,-5} ");
- }
- }
- class Room
- {
- public string ID { get; set; }
- public Room(string id)
- {
- ID = id;
- }
- public void Output()
- {
- Console.WriteLine($"{ "Domatio",-15} | { ID,-5} ");
- }
- }
- class Therapy
- {
- public string Title { get; set; }
- public string Description { get; set; }
- public Therapy(string title, string description)
- {
- Title = title;
- Description = description;
- }
- public void Output()
- {
- Console.WriteLine($"{ Title,-15} | { Description,-5} ");
- }
- }
- class Doctor
- {
- public string Name { get; set; }
- public string LastName { get; set; }
- public List<Patient> patients = new List<Patient>();
- public Doctor(string name, string lastName)
- {
- Name = name;
- LastName = lastName;
- }
- public void Output()
- {
- Console.WriteLine($"{ Name,-15} | { LastName,-5} ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement