public bool CanSlotBeBooked(DPFacility facility, DPDoctor doctor, Address address, RealtimeBooking visitBooking) { var doctorMapping = _mappingRepo.GetByForeignAddress(address.Id); var startAt = visitBooking.StartAt.LocalDateTime.ChangeTimeZone(timeZone); var endAt = visitBooking.EndAt.LocalDateTime.ChangeTimeZone(timeZone); if (doctorMapping == null) { return(false); } return(_scheduleManager.IsSlotExist(startAt, endAt, doctorMapping.DoctorFacility)); }
public ActionResult Sync(string id) { var address = addressRepo.GetById(id); var mapping = repo.GetByForeignAddress(id); try { bool result = scheduleManager.PushSlots(mapping.DoctorFacility); return(Json(new { status = result })); } catch (Exception ex) { return(Json(new { status = false, message = ex.Message })); } }
private bool DefaultEventHandler(DPFacility facility, DPDoctor doctor, Address address) { var mapping = _mappingRepo.GetByForeignAddress(address.Id); if (mapping == null) { return(false); } return(true); //noop }
public bool RegisterDpVisit(DPFacility facility, DPDoctor doctor, Address address, Booking visitBooking) { bool result = false; var doctorMapping = _mappingRepo.GetByForeignAddress(address.Id); var existingVisit = _visitRepository.GetByForeignId(visitBooking.Id); if (existingVisit != null) { return(true); } if (doctorMapping != null) { var patient = visitBooking.Patient; var visit = new Visit() { DoctorFacility = doctorMapping.DoctorFacility, DoctorId = doctorMapping.DoctorId, FacilityId = doctorMapping.FacilityId, StartAt = visitBooking.StartAt.LocalDateTime.ChangeTimeZone(timeZone), EndAt = visitBooking.EndAt.LocalDateTime.ChangeTimeZone(timeZone), ForeignVisitId = visitBooking.Id, VisitStatus = VisitStatus.Booked, VisitPatient = new VisitPatient() { Name = patient.Name, Surname = patient.Surname, Phone = patient.Phone, Email = patient.Email, Gender = patient.Gender == null ? Gender.NotSpecified : (patient.Gender == "m" ? Gender.Male : Gender.Female), NIN = patient.Nin, Birthdate = patient.BirthDate } }; var schedule = _scheduleManager.FindDoctorSchedule(doctorMapping.DoctorFacility, visit.StartAt, visit.EndAt, visitBooking.Service.Id); visit.DoctorSchedule = schedule; visit.DoctorScheduleId = schedule.Id; result = BookVisit(visit, true); } return(result); }