-
Notifications
You must be signed in to change notification settings - Fork 0
/
Appointment.cs
64 lines (54 loc) · 1.75 KB
/
Appointment.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
namespace HospitalManagementConsole
{
public class Appointment
{
private string doctorID, patientID, description;
public Appointment(string doctorID, string patientID, string description)
{
this.doctorID = doctorID;
this.patientID = patientID;
this.description = description;
}
// Getter and Setter for DoctorID, PatientID and Description
public string DoctorID
{
get { return doctorID; }
set { doctorID = value; }
}
public string PatientID
{
get { return patientID; }
set { patientID = value; }
}
public string Description
{
get { return description; }
set { description = value; }
}
// Override ToString method to display appointment details, when used in Console.WriteLine
public override string ToString()
{
string[] doctorInfo = File.ReadAllLines($"DB\\Doctors\\{doctorID}.txt");
string doctorName = doctorInfo[0].Split(';')[2];
string[] patientInfo = File.ReadAllLines($"DB\\Patients\\{patientID}.txt");
string patientName = patientInfo[0].Split(';')[2];
return $"{doctorName,-20} | {patientName,-20} | {description,-20}";
}
public string ToSave()
{
return $"{doctorID}|{patientID}|{description}\n";
}
~Appointment()
{
Console.WriteLine("Appointment object destroyed and clearing memory");
GC.Collect();
}
}
}