Пример #1
0
 public AppointmentTO(Appointment mdo)
 {
     this.id = mdo.Id;
     this.timestamp = mdo.Timestamp;
     this.title = mdo.Title;
     this.status = mdo.Status;
     this.text = mdo.Text;
     if (mdo.Facility != null)
     {
         this.facility = new TaggedText(mdo.Facility.Id, mdo.Facility.Name);
     }
     if (mdo.Clinic != null)
     {
         this.clinic = new HospitalLocationTO(mdo.Clinic);
         if (mdo.Clinic.Facility != null)
         {
             this.clinic.facility = new SiteTO();
             this.clinic.facility.name = mdo.Clinic.Facility.Name;
         }
     }
     this.labDateTime = mdo.LabDateTime;
     this.xrayDateTime = mdo.XrayDateTime;
     this.ekgDateTime = mdo.EkgDateTime;
     this.purpose = mdo.Purpose;
     this.type = mdo.Type;
     this.currentStatus = mdo.CurrentStatus;
 }
Пример #2
0
 public TaggedAppointmentArray(string tag, Appointment mdo)
 {
     this.tag = tag;
     if (mdo == null)
     {
         this.count = 0;
         return;
     }
     this.appts = new AppointmentTO[1];
     this.appts[0] = new AppointmentTO(mdo);
     this.count = 1;
 }
Пример #3
0
        public TaggedAppointmentArray(string tag, IList<Appointment> mdos)
        {
            if (mdos == null || mdos.Count == 0)
            {
                this.count = 0;
                return;
            }

            Appointment[] appts = new Appointment[mdos.Count];
            mdos.CopyTo(appts, 0);

            initialize(tag, appts);
        }
Пример #4
0
 void initialize(string tag, Appointment[] mdos)
 {
     this.tag = tag;
     if (mdos == null)
     {
         this.count = 0;
         return;
     }
     this.appts = new AppointmentTO[mdos.Length];
     for (int i = 0; i < mdos.Length; i++)
     {
         this.appts[i] = new AppointmentTO(mdos[i]);
     }
     this.count = appts.Length;
 }
Пример #5
0
 public TaggedAppointmentArray(string tag, Appointment[] mdos)
 {
     this.tag = tag;
     if (mdos == null)
     {
         this.count = 0;
         return;
     }
     this.appts = new AppointmentTO[mdos.Length];
     for (int i = 0; i < mdos.Length; i++)
     {
         this.appts[i] = new AppointmentTO(mdos[i]);
     }
     this.count = appts.Length;
 }
Пример #6
0
 public TaggedAppointmentArray(string tag, Appointment[] mdos)
 {
     initialize(tag, mdos);
 }
Пример #7
0
        public AppointmentTO makeAppointment(string clinicId, string appointmentTimestamp, string purpose, string purposeSubcategory,
            string appointmentLength, string appointmentType)
        {
            AppointmentTO result = new AppointmentTO();

            if (!_mySession.ConnectionSet.IsAuthorized)
            {
                result.fault = new FaultTO("Connections not ready for operation", "Need to login?");
            }
            else if (String.IsNullOrEmpty(clinicId))
            {
                result.fault = new FaultTO("Missing clinic ID");
            }
            else if (String.IsNullOrEmpty(appointmentTimestamp))
            {
                result.fault = new FaultTO("Missing appointment timestamp");
            }
            else if (String.IsNullOrEmpty(appointmentType))
            {
                result.fault = new FaultTO("Missing appointment type");
            }
            else if (String.IsNullOrEmpty(appointmentLength))
            {
                result.fault = new FaultTO("Missing appointment length");
            }
            else if (String.IsNullOrEmpty(purpose))
            {
                result.fault = new FaultTO("Missing appointment purpose");
            }

            if (result.fault != null)
            {
                return result;
            }

            try
            {
                Appointment appt = new Appointment()
                {
                    AppointmentType = new AppointmentType() { ID = appointmentType },
                    Clinic = new HospitalLocation() { Id = clinicId },
                    Length = appointmentLength,
                    Purpose = purpose,
                    PurposeSubcategory = purposeSubcategory,
                    Timestamp = appointmentTimestamp
                };
                appt = new EncounterApi().makeAppointment(_mySession.ConnectionSet.BaseConnection, appt);
                result = new AppointmentTO(appt);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }

            return result;
        }