예제 #1
0
        public FillInAQuestionarie()
        {
            InitializeComponent();

            this.DataContext   = this;
            doctorController   = new DoctorController();
            questionController = new QuestionController();
            listDoctors        = doctorController.GetAll();

            List <ListaDoktoriIme> listDoctorsBinding = new List <ListaDoktoriIme>();

            foreach (DoctorUser d in listDoctors)
            {
                StringBuilder l = new StringBuilder();
                l.Append(d.firstName + " ");
                l.Append(d.secondName + " ");
                l.Append(d.id);
                ListaDoktoriIme a = new ListaDoktoriIme();
                a.DoctorName = l.ToString();
                listDoctorsBinding.Add(a);
            }

            doctorCombo.ItemsSource = listDoctorsBinding;

            QuestionList = questionController.GetAll();
        }
예제 #2
0
        public AskAQuestion()
        {
            InitializeComponent(); this.DataContext = this;
            doctorController = new DoctorController();
            listDoctors      = doctorController.GetAll();
            List <ListaDoktoriIme> listDoctorsBinding = new List <ListaDoktoriIme>();

            Patient           = new PatientUser();
            patientController = new PatientController();
            listPatients      = patientController.GetAll();

            foreach (DoctorUser d in listDoctors)
            {
                StringBuilder l = new StringBuilder();
                l.Append(d.firstName + " ");
                l.Append(d.secondName + " ");
                l.Append(d.id);
                ListaDoktoriIme a = new ListaDoktoriIme();
                a.DoctorName = l.ToString();
                listDoctorsBinding.Add(a);
            }

            Patient = patientController.GetByid(int.Parse(myProperty));

            doctorCombo.ItemsSource = listDoctorsBinding;
        }
예제 #3
0
        private void confirmButton_Click(object sender, RoutedEventArgs e)
        {
            ListaDoktoriIme name = (ListaDoktoriIme)doctorCombo.SelectedValue;

            if (name == null)
            {
                MessageBox.Show("Please choose the doctor!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }



            else
            {
                String imeDr = name.DoctorName;

                String[] delovi = imeDr.Split(' ');

                int idDoktor = int.Parse(delovi[2]);

                DoctorUser doktorUpitnik = doctorController.GetByid(idDoktor);


                StringBuilder sb = new StringBuilder();
                sb.Append("Questionarie: \n");
                foreach (Question q in QuestionList)
                {
                    sb.Append(q.name + "  /  mark:  " + q.answer + "\n");
                }
                DoctorNotification upitnik = new DoctorNotification(sb.ToString());
                Console.WriteLine(upitnik);
                if (doktorUpitnik.specialNotifications == null)
                {
                    doktorUpitnik.specialNotifications = new List <DoctorNotification>();
                }
                doktorUpitnik.specialNotifications.Add(upitnik);
                doctorController.Update(doktorUpitnik);


                MessageBox.Show("Thank you!\nQuestionarie is successfully sent.");
            }
        }
예제 #4
0
        private void sendButton_Click(object sender, RoutedEventArgs e)
        {
            ListaDoktoriIme name = (ListaDoktoriIme)doctorCombo.SelectedValue;

            if (name == null)
            {
                MessageBox.Show("Please choose the doctor!", "Error", MessageBoxButton.OK, MessageBoxImage.Error);

                return;
            }


            else if (textBloxk.Text.Equals(""))
            {
                MessageBox.Show("Please enter the question.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                helpButton.Focus();
                return;
            }
            else
            {
                String imeDr = name.DoctorName;

                String[] delovi = imeDr.Split(' ');

                int        idDoktor = int.Parse(delovi[2]);
                DoctorUser doctor   = doctorController.GetByid(idDoktor);
                if (doctor.specialNotifications == null)
                {
                    doctor.specialNotifications = new List <DoctorNotification>();
                }
                List <DoctorNotification> obavestenja = doctor.specialNotifications;
                obavestenja.Add(new DoctorNotification("Patient - " + Patient.id + " -  " + textBloxk.Text));
                doctor.specialNotifications = obavestenja;
                Boolean isDoctorOk = doctorController.Update(doctor);
                if (isDoctorOk == false)
                {
                }
                else
                {
                    MessageBox.Show("Your question is sent.");
                }
            }
        }