Esempio n. 1
0
        public bool IsConflicting(DateTime dateTime, Appointment selectedAppointment)
        {
            const int MAX_MINUTES_PER_PATIENT = 20;
            TimeSpan  maxMinsPerAppointment   = new TimeSpan(0, 0, MAX_MINUTES_PER_PATIENT, 0);

            var appointments = appointmentManager.GetAll <Appointment>().ToList();

            appointments.Remove(appointments.Find(x => x.Id == selectedAppointment.Id));

            if (appointments != null)
            {
                foreach (var appointment in appointments)
                {
                    if (dateTime < appointment.DesiredDateTime &&
                        appointment.DesiredDateTime - dateTime < maxMinsPerAppointment ||
                        dateTime > appointment.DesiredDateTime &&
                        dateTime - appointment.DesiredDateTime < maxMinsPerAppointment ||
                        dateTime == appointment.DesiredDateTime
                        )
                    {
                        ErrorMessages.ConflictingWithOtherAppointments();
                        return(true);
                    }
                }
            }

            return(false);
        }
        public override IHttpActionResult Get()
        {
            IEnumerable <AppointmentViewModel> vm = appointmentManager
                                                    .GetAll()
                                                    .OrderByDescending(i => i.Date)
                                                    .ToList()
                                                    .Select(ToViewModel);

            return(Ok(vm));
        }
Esempio n. 3
0
 public IHttpActionResult GetAll()
 {
     try
     {
         var appointments    = _appointmentManager.GetAll <Appointment>();
         var appointmentsDTO = _appointmentFactory.CreateAppointmentDTO(appointments);
         return(Content(HttpStatusCode.OK, appointmentsDTO));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
        public IHttpActionResult GetAll()
        {
            try
            {
                var patients          = _patientManager.GetAll <Patient>();
                var addresses         = _addressManager.GetAll <Address>();
                var emergencyContacts = _emergencyContactManager.GetAll <EmergencyContact>();
                var consultations     = _consultationManager.GetAll <Consultation>();
                var appointments      = _appointmentManager.GetAll <Appointment>();

                var patientsDTO = _patientFactory.CreatePatientDTO(patients, addresses, emergencyContacts, consultations, appointments);

                return(Content(HttpStatusCode.OK, patientsDTO));
            }
            catch (Exception ex)
            {
                return(Content(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Esempio n. 5
0
 public IList <Appointment> GetAllAppointments()
 {
     return(appointmentManager.GetAll <Appointment>());
 }
Esempio n. 6
0
 public List <Appointment> GetAllUsers()
 {
     return(_appointmentManager.GetAll());
 }