public searchPatient(editPatient input)
 {
     this.caller  = new editPatient();
     this.caller  = input;
     this.mainCal = ((editPatient)this.caller).caller;
     InitializeComponent();
     displayPatients();
 }
 public searchPatient(pastAppointments input)
 {
     this.caller  = new pastAppointments();
     this.caller  = input;
     this.mainCal = ((pastAppointments)this.caller).caller;
     InitializeComponent();
     displayPatients();
 }
 public searchPatient(mainCalendarDisplayWindow input)
 {
     this.caller  = new mainCalendarDisplayWindow();
     this.caller  = input;
     this.mainCal = (mainCalendarDisplayWindow)this.caller;
     callerMain   = true;
     InitializeComponent();
     displayPatients();
 }
 private void selectButton_Click_1(object sender, RoutedEventArgs e)
 {
     if (caller != null)
     {
         if (caller.GetType() == typeof(editPatient))
         {
             editPatient temp = new editPatient();
             temp = (editPatient)caller;
             if (searchPatLB.SelectedItem != null)
             {
                 patient = (Patient)searchPatLB.SelectedItem;
                 temp.selectedPatient = patient;
                 temp.ShowPatient(patient);
             }
             temp.patientSelected = true;
         }
         else if (caller.GetType() == typeof(mainCalendarDisplayWindow))
         {
             mainCalendarDisplayWindow temp = new mainCalendarDisplayWindow();
             temp = (mainCalendarDisplayWindow)caller;
             if (searchPatLB.SelectedItem != null)
             {
                 temp.selectedPatient = (Patient)searchPatLB.SelectedItem;
             }
             if (temp.selectedPatient != null)
             {
                 temp.bookNewName.Text = "<" + temp.selectedPatient.lastName + "," + temp.selectedPatient.firstName + ">";
                 if (temp.bookNewName.Text != "<patient name>")
                 {
                     temp.bookAddButton.IsEnabled = true;
                 }
             }
         }
         else if (caller.GetType() == typeof(pastAppointments))
         {
             pastAppointments temp = new pastAppointments();
             temp = (pastAppointments)caller;
             if (searchPatLB.SelectedItem != null)
             {
                 patient = (Patient)searchPatLB.SelectedItem;
                 temp.selectedPatient = patient;
                 temp.ShowPatient(patient);
                 temp.pastPatientName.Text = patient.firstName + " " + patient.lastName;
             }
             temp.patientSelected = true;
         }
     }
     else
     {
         var mb = MessageBox.Show("caller.gettype is null");
     }
     this.Close();
 }
        // used for checking the user entered fields, also will return a little information status on the top (changes colour of te)
        public void checkLogin()
        {
            //hardcoded username/password
            //probably want this blank when we're testing
            if ((usernameField.Text == USERNAME) && (passwordField.Password == PASSWORD))
            {
                statusText.Foreground = Brushes.Green;
                statusText.Text       = "Logging in...";

                //opens the main booking window and closes the login screen

                mainCalendarDisplayWindow cal = new mainCalendarDisplayWindow();
                cal.Show();
                this.Hide();
            }

            else
            {
                statusText.Foreground  = Brushes.Red;
                statusText.Text        = "Incorrect username/password";
                passwordField.Password = "";
            }
        }
        private void yesCancel_Click(object sender, RoutedEventArgs e)
        {
            mainCalendarDisplayWindow mainCal = (mainCalendarDisplayWindow)caller;
            DayOfAppointments         dayOfAppt;
            bool containsDate = mainCal.allAppointmentsDictionary.TryGetValue(mainCal.displayDate.ToShortDateString(), out dayOfAppt);

            if (!containsDate)
            {
                var mb = MessageBox.Show("Error: No appointment on this date");
                return; //quit the method on error
            }
            Appointment appt;
            int         doctor   = mainCal.timeslotNametoDoctor(mainCal.currentSlot.Name);
            int         timeslot = mainCal.timeslotNametoIndex(mainCal.currentSlot.Name);

            if (doctor == 0)
            {
                appt = dayOfAppt.d0[timeslot];
                dayOfAppt.d0[timeslot] = null;
                //delete appointment from patient

                int numAppt = 0;
                foreach (Appointment app in appt.patient.appointments)
                {
                    numAppt++;
                }
                for (int i = 0; i < numAppt; i++)
                {
                    Appointment app = appt.patient.appointments[i];
                    if (app.Equals(appt))
                    {
                        appt.patient.appointments.Remove(app);
                    }
                }
            }
            else if (doctor == 1)
            {
                appt = dayOfAppt.d1[timeslot];
                dayOfAppt.d1[timeslot] = null;
                //delete appointment from patient
                int numAppt = 0;
                foreach (Appointment app in appt.patient.appointments)
                {
                    numAppt++;
                }
                for (int i = 0; i < numAppt; i++)
                {
                    Appointment app = appt.patient.appointments[i];
                    if (app.Equals(appt))
                    {
                        appt.patient.appointments.Remove(app);
                    }
                }
            }
            else if (doctor == 2)
            {
                appt = dayOfAppt.d2[timeslot];
                dayOfAppt.d2[timeslot] = null;
                //delete appointment from patient
                int numAppt = 0;
                foreach (Appointment app in appt.patient.appointments)
                {
                    numAppt++;
                }
                for (int i = 0; i < numAppt; i++)
                {
                    Appointment app = appt.patient.appointments[i];
                    if (app.Equals(appt))
                    {
                        appt.patient.appointments.Remove(app);
                    }
                }
            }
            else if (doctor == 3)
            {
                appt = dayOfAppt.d3[timeslot];
                dayOfAppt.d3[timeslot] = null;
                //delete appointment from patient
                int numAppt = 0;
                foreach (Appointment app in appt.patient.appointments)
                {
                    numAppt++;
                }
                for (int i = 0; i < numAppt; i++)
                {
                    Appointment app = appt.patient.appointments[i];
                    if (app.Equals(appt))
                    {
                        appt.patient.appointments.Remove(app);
                    }
                }
            }
            else if (doctor == 4)
            {
                appt = dayOfAppt.d4[timeslot];
                dayOfAppt.d4[timeslot] = null;
                //delete appointment from patient
                int numAppt = 0;
                foreach (Appointment app in appt.patient.appointments)
                {
                    numAppt++;
                }
                for (int i = 0; i < numAppt; i++)
                {
                    Appointment app = appt.patient.appointments[i];
                    if (app.Equals(appt))
                    {
                        appt.patient.appointments.Remove(app);
                    }
                }
            }
            else
            {
                var mb = MessageBox.Show("Error: doctor timeslot in cancelConfirmation");//should never happen
            }

            //update display
            mainCal.refreshDisplayDate();
            mainCal.updateApptInfoBox();

            this.Close();
        }
 public cancelConfirmation(mainCalendarDisplayWindow caller)
 {
     this.caller = caller;
     InitializeComponent();
 }
Exemple #8
0
 public addPatient(mainCalendarDisplayWindow caller)
 {
     this.caller = caller;
     InitializeComponent();
 }
Exemple #9
0
 public editPatient(mainCalendarDisplayWindow caller)
 {
     this.caller = caller;
     InitializeComponent();
     patientSelected = false;
 }
Exemple #10
0
 public pastAppointments(mainCalendarDisplayWindow caller)
 {
     this.caller = caller;
     InitializeComponent();
     patientSelected = false;
 }