1 | namespace IndianHealthService.ClinicalScheduling
|
---|
2 | {
|
---|
3 | using System;
|
---|
4 | using System.Collections;
|
---|
5 | /// <summary>
|
---|
6 | /// Managers Appointment objects CGAppointment using an array list internally.
|
---|
7 | /// </summary>
|
---|
8 | /// <remarks>
|
---|
9 | /// Really needs to be refactored to use generics
|
---|
10 | /// </remarks>
|
---|
11 | [Serializable]
|
---|
12 | public class CGAppointments : IEnumerable, ICloneable
|
---|
13 | {
|
---|
14 | private Hashtable apptList = new Hashtable();
|
---|
15 |
|
---|
16 | public void AddAppointment(CGAppointment appt)
|
---|
17 | {
|
---|
18 | if (this.apptList.ContainsKey(appt.AppointmentKey))
|
---|
19 | {
|
---|
20 | this.apptList.Remove(appt.AppointmentKey);
|
---|
21 | }
|
---|
22 | this.apptList.Add(appt.AppointmentKey, appt);
|
---|
23 | }
|
---|
24 |
|
---|
25 | public void ClearAllAppointments()
|
---|
26 | {
|
---|
27 | this.apptList.Clear();
|
---|
28 | }
|
---|
29 |
|
---|
30 | public CGAppointment GetAppointment(int nKey)
|
---|
31 | {
|
---|
32 | return (CGAppointment) this.apptList[nKey];
|
---|
33 | }
|
---|
34 |
|
---|
35 | public IEnumerator GetEnumerator()
|
---|
36 | {
|
---|
37 | return this.apptList.GetEnumerator();
|
---|
38 | }
|
---|
39 |
|
---|
40 | public void RemoveAppointment(int nKey)
|
---|
41 | {
|
---|
42 | this.apptList.Remove(nKey);
|
---|
43 | }
|
---|
44 |
|
---|
45 | public int AppointmentCount
|
---|
46 | {
|
---|
47 | get
|
---|
48 | {
|
---|
49 | return this.apptList.Count;
|
---|
50 | }
|
---|
51 | }
|
---|
52 |
|
---|
53 | public Hashtable AppointmentTable
|
---|
54 | {
|
---|
55 | get
|
---|
56 | {
|
---|
57 | return this.apptList;
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 |
|
---|
62 | /// <summary>
|
---|
63 | /// Returns a deep copy of CGAppointments
|
---|
64 | /// </summary>
|
---|
65 | /// <returns></returns>
|
---|
66 | public object Clone()
|
---|
67 | {
|
---|
68 | CGAppointments newappts = new CGAppointments();
|
---|
69 | foreach (DictionaryEntry d in this.apptList)
|
---|
70 | {
|
---|
71 | newappts.apptList.Add(d.Key, d.Value);
|
---|
72 | }
|
---|
73 |
|
---|
74 | return newappts;
|
---|
75 | }
|
---|
76 | }
|
---|
77 | }
|
---|
78 |
|
---|