public void BookAppointment()
        {
            if (Timeslot == null)
            {
                Alert("No Avaliability.", "No appointments are avaliable today. Please book a reservation appointment to be seen on another day.");
                return;
            }

            int    doctorID = int.Parse(Timeslot[0].ToString());
            string timeslot = Timeslot[1].ToString();

            if (PatientDBConverter.PatientHasAppointment(patientID))
            {
                Alert("Appointment not booked", "You already have an appointment booked today. Please check your emails for notificaitons or speak to the receptionist.");
                MessengerInstance.Unregister(this);
                MessengerInstance.Send <string>("DecideHomeView");
                return;
            }

            PatientDBConverter.BookAppointment(timeslot, doctorID, patientID, false);
            AppointmentLogic.ScheduleWalkInNotification(TimeSpan.Parse(timeslot), patientID);

            var dialog = new SuccessBoxViewModel("Appointment Booked.",      //MOVE THIS
                                                 "Appointment has been successfully booked. Please keep an eye on your emails for updates on when we can see you.");
            var result = _dialogService.OpenDialog(dialog);

            MessengerInstance.Unregister(this);
            MessengerInstance.Send <string>("DecideHomeView");
        }
        // Interacts with Data Layer Model to book appointment
        public void BookAppointment()
        {
            if (TimeslotIndex.Equals(-1))
            {
                Alert("No timeslot selected.", "Please select a timeslot for your appointment");
                return;
            }
            if (PatientDBConverter.PatientHasAppointment(patientID, SelectedDate.ToShortDateString()))
            {
                Alert("Appointment Not Booked.",
                      "You already have a GP appointment for this day. Please speak to the receptionist for details on your appointment or select another day.");
                return;
            }
            string selectedTimeslot    = AvaliableTimes.Rows[(int)TimeslotIndex][1].ToString();
            int    reservationDoctorID = int.Parse(AvaliableTimes.Rows[(int)TimeslotIndex][0].ToString());


            if (string.IsNullOrWhiteSpace(Comment))
            {
                Comment = "";
            }

            PatientDBConverter.BookAppointment(selectedTimeslot, reservationDoctorID, patientID, true, Comment, SelectedDate.ToShortDateString());

            // Sends email Success
            EmailConfirmation.ReservationConfirmationEmail(patientID, SelectedDate, selectedTimeslot);

            var dialog = new SuccessBoxViewModel("Appointment Booked.",      //MOVE THIS
                                                 "Appointment has been successfully booked. Please keep an eye on your emails for updates on when we can see you.");
            var result = _dialogService.OpenDialog(dialog);

            MessengerInstance.Unregister(this);
            MessengerInstance.Send <string>("DecideHomeView");
        }
Esempio n. 3
0
        private void BookAppointment()
        {
            if (RequiredNotComplete())
            {
                return;
            }

            PatientUser patient = new PatientUser(Firstname, Middlename, Lastname, (DateTime)DOB, int.Parse(DoorNumber), Postcode);
            int         patientID;

            // Verifies if patient records existing in patient DB, if multiple records are found, below situation is handelled using
            // appropirate dialog boxes.
            string verifiedExistance = VerifyPatientDetails(patient);

            if (verifiedExistance.Equals("NoRecord"))
            {
                return;
            }
            // If multiple records are found, user is asked to input their patient ID to uniquely identify them.
            // If incorrect input format is detected i.e. non-numerical, or a patient ID not corrosponding to inputted details is entered,
            // the user is shown an alert message and redirected to partner with a receptionist for assistance.
            else if (verifiedExistance.Equals("MultipleRecords"))
            {
                Alert("Multiple Records Found.",
                      "Multple Records were found with your details. Please type in your Patient ID or speak to the receptionist for assistance with booking an appointment.");
                string inputtedID = PatientIDBox();
                if (string.IsNullOrWhiteSpace(inputtedID) || !inputtedID.All(char.IsDigit))
                {
                    Alert("Incorrect ID.", "Patient ID must be numerical. Please speak to a receptionist.");
                    return;
                }
                verifiedExistance = VerifyPatientDetails(patient, int.Parse(inputtedID));
                if (verifiedExistance.Equals("FoundRecord"))
                {
                    patientID = int.Parse(inputtedID);
                }
                else
                {
                    Alert("Could Not Find record.", "Could not find record matching details under inputted ID, please speak to a receptionist for assistance.");
                    return;
                }
            }
            else
            {
                patientID = PatientDBConverter.GetPatientID(patient);
            }

            if (PatientDBConverter.PatientHasAppointment(patientID))
            {
                Alert("Appointment Found!", "An existing appointment was found. Please cancel or check-in for your existing appointment to proceed.");
                return;
            }

            PatientDBConverter.BookEmergencyAppointment(patientID);
            Success("Appointment Booked.", "Emergency appointment has been booked. Please ask patient to be seated, the next avaliable doctor will take the session.");
            MessengerInstance.Send <string>("ReceptionistHomeView");
        }