[622] | 1 | namespace IndianHealthService.ClinicalScheduling
|
---|
| 2 | {
|
---|
| 3 | using System;
|
---|
| 4 | using System.Collections;
|
---|
| 5 | /// <summary>
|
---|
[1095] | 6 | /// Managers Appointment objects CGAppointment using an array list internally.
|
---|
[622] | 7 | /// </summary>
|
---|
[1095] | 8 | /// <remarks>
|
---|
| 9 | /// Really needs to be refactored to use generics
|
---|
| 10 | /// </remarks>
|
---|
[622] | 11 | [Serializable]
|
---|
[1073] | 12 | public class CGAppointments : IEnumerable, ICloneable
|
---|
[622] | 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 | }
|
---|
[1073] | 60 |
|
---|
[1075] | 61 |
|
---|
[1095] | 62 | /// <summary>
|
---|
| 63 | /// Returns a deep copy of CGAppointments
|
---|
| 64 | /// </summary>
|
---|
| 65 | /// <returns></returns>
|
---|
[1073] | 66 | public object Clone()
|
---|
| 67 | {
|
---|
[1075] | 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;
|
---|
[1073] | 75 | }
|
---|
[622] | 76 | }
|
---|
| 77 | }
|
---|
| 78 |
|
---|