Exemplo n.º 1
0
        public void deleteAppointment(Appointment st)
        {
            var original = Appointments.Find(a => a.AppointmentID == st.AppointmentID);

            if (original != null && Encoding.ASCII.GetString(original.timestamp) == Encoding.ASCII.GetString(st.timestamp))
            {
                var at = Attendances.First(a => a.AppointmentID == st.AppointmentID);
                Attendances.Remove(at);
            }
            else
            {
                throw new Exception("Your appointment version is not actualy");
            }
        }
Exemplo n.º 2
0
        public void updateAppointment(Appointment st)
        {
            var original = Appointments.Find(a => a.AppointmentID == st.AppointmentID);

            if (original != null && Encoding.ASCII.GetString(original.timestamp) == Encoding.ASCII.GetString(st.timestamp))
            {
                original.Title           = st.Title;
                original.AppointmentDate = st.AppointmentDate;
                original.StartTime       = st.StartTime;
                original.EndTime         = st.EndTime;
                original.Description     = st.Description;
            }
            else
            {
                throw new Exception("Your appointment version is not actualy");
            }
        }
Exemplo n.º 3
0
 public static int InsertAppointment(Appointment appointment)
 {
     if (appointment.Id == 0)
     {
         appointment.Id = GetNewAppointmentId();
         Appointments.Add(appointment);
     }
     else
     {
         var app = Appointments.Find(a => a.Id == appointment.Id);
         app.Subject           = appointment.Subject;
         app.PatientId         = appointment.PatientId;
         app.StaffId           = appointment.StaffId;
         app.ServiceProvidedId = appointment.ServiceProvidedId;
         app.From = appointment.From;
         app.To   = appointment.To;
     }
     return(appointment.Id);
 }