Beispiel #1
0
        //currently just creates a patient
        private void Patient_Selected(object sender, RoutedEventArgs e)
        {
            //somehow get the patient object from the selected item
            Patient selectedPatient = ((sender as ListBox).SelectedItem as Patient); //placeholder

            if (selectedPatient != null)
            {
                NewApptMonth apptMonthWindow = new NewApptMonth(selectedPatient);
                //apptMonthWindow.Owner = this.Owner; //TODO not sure if i should do this owner stuff
                apptMonthWindow.Show();
                this.Close();
            }
        }
        //press ok on new patient window
        private void OkButtonStyle(object sender, RoutedEventArgs e)
        {
            bool canClose = true;

            //maybe prevent from adding patient with no name

            if (string.IsNullOrEmpty(nameBlock.Text.Trim()))
            {
                canClose = false;
                nameBlock.BorderBrush = new SolidColorBrush(Colors.Red);
            }
            else
            {
                nameBlock.BorderBrush = new SolidColorBrush(Colors.Gray);
            }

            if (canClose)
            {
                //create patient from form data
                Patient newPatient = new Patient(this.nameBlock.Text, this.emailBlock.Text, this.streetBlock.Text, this.cityBlock.Text, this.provBlock.Text, this.countryBlock.Text, this.phoneBlock.Text,
                                                 this.ageBlock.Text, this.bloodBlock.Text, this.billStreetBox.Text, this.billCityBox.Text, this.billProvBox.Text, this.billCountryBox.Text, this.billPhoneBox.Text,
                                                 this.billPostalBox.Text);

                MediSchedData.addPatientToList(newPatient);


                if (fromAppointment)
                {
                    NewApptMonth apptmonthWindow = new NewApptMonth(newPatient);
                    apptmonthWindow.Owner = this.Owner;
                    apptmonthWindow.Show();
                }
                else
                {
                    //maybe open the thing for that patient but probably not
                }

                this.Close();
            }
        }