public ExaminationDTO(ExaminationDTO e)
 {
     this.IdExamination = e.IdExamination;
     this.Type          = e.Type;
     this.DateAndTime   = e.DateAndTime;
     this.doctor        = e.doctor;
     this.room          = e.room;
     this.patientCard   = e.patientCard;
 }
Пример #2
0
        private void Button_Click_10(object sender, RoutedEventArgs e)
        {
            if (appointment < 0)
            {
                MessageBox.Show("Morate selektovati red u tabeli da bi otkazali pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);


                return;
            }

            ec.DeleteScheduledExamination(id);

            TimeSpan ts = new TimeSpan(8, 0, 0);

            if (second.IsSelected)
            {
                ts = new TimeSpan(16, 0, 0);
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(12, 0, 0);
            }
            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            allAppointments = ec.getAllAppointments(selectedDoctor, (DateTime)dataExam.SelectedDate + ts);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);

                appointment = -1;
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
        }
Пример #3
0
        private void Button_Click_6(object sender, RoutedEventArgs e)
        {
            if (appointment < 0)
            {
                MessageBox.Show("Morate selektovati red u tabeli da bi zakazali pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }

            else if (String.IsNullOrEmpty(txtVrsta.Text))
            {
                System.Windows.MessageBox.Show("Morate izabrati vrstu pregleda.", "Upozorenje!",
                                               MessageBoxButton.OK, MessageBoxImage.Warning);

                txtVrsta.Focus();
                return;
            }

            Examination exam = new Examination();

            exam.IdExamination = id;
            exam.DateAndTime   = dt;
            exam.doctor        = (Doctor)textBoxDoctorExam.SelectedItem;
            exam.Type          = TypeOfExamination.Opsti;


            if (txtVrsta.SelectedItem.ToString().Equals("Operacija"))
            {
                exam.Type = TypeOfExamination.Operacija;
            }
            else if (txtVrsta.SelectedItem.ToString().Equals("Specijalisticki"))
            {
                exam.Type = TypeOfExamination.Specijalisticki;
            }


            if (String.IsNullOrEmpty(txtSoba.Text))
            {
                System.Windows.MessageBox.Show("Morate izabrati sobu u kojoj zelite zakazati pregled.", "Upozorenje!",
                                               MessageBoxButton.OK, MessageBoxImage.Warning);

                txtSoba.Focus();
                return;
            }
            string roomStr = txtSoba.SelectedValue.ToString();
            int    roomId  = Int32.Parse(roomStr);

            exam.room = rc.ViewRoomByNumber(roomId);

            string[] ss = showName.Text.Split(' ');

            exam.patientCard = ap.ViewPatientCard(ss[ss.Length - 1]);

            ec.ScheduleExamination(exam);

            TimeSpan ts = new TimeSpan(8, 0, 0);

            if (second.IsSelected)
            {
                ts = new TimeSpan(16, 0, 0);
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(12, 0, 0);
            }
            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            allAppointments = ec.getAllAppointments(selectedDoctor, (DateTime)dataExam.SelectedDate + ts);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
            Notification n = new Notification();
            int          idNotification = nc.getLastId();

            n.Id             = ++idNotification;
            n.Type           = TypeOfNotification.Pregled;
            n.Message        = "Novi termin zakazan " + dt.ToString() + " dr. " + selectedDoctor.Name + " " + selectedDoctor.Surname;
            n.JmbgOfReceiver = patientCard.patient.Jmbg;
            nc.SendNotification(n);

            appointment = -1;
        }
Пример #4
0
        private void Button_Click_5(object sender, RoutedEventArgs e)
        {
            string s = dataExam.SelectedDate.ToString();

            string[] lines = s.Split(' ');
            string   datum = lines[0];

            if (String.IsNullOrEmpty(datum))
            {
                MessageBox.Show("Morate izabrati datum za koji želite zakazati prelged.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                dataExam.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(textBoxDoctorExam.Text))
            {
                MessageBox.Show("Morate izabrati doktora kod kog želite zakazati pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                textBoxDoctorExam.Focus();
                return;
            }
            else if (String.IsNullOrEmpty(txtSmjena.Text))
            {
                MessageBox.Show("Morate izabrati smjenu u kojoj zelite zakazati pregled.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                txtSmjena.Focus();
                return;
            }

            TimeSpan ts = new TimeSpan(FIRST_SHIFT_TIME, 0, 0);
            DateTime dt = (DateTime)dataExam.SelectedDate;

            if (first.IsSelected)
            {
                ts = new TimeSpan(FIRST_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else if (second.IsSelected)
            {
                ts = new TimeSpan(SECOND_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else if (third.IsSelected)
            {
                ts = new TimeSpan(THIRD_SHIFT_TIME, 0, 0);
                dt = dt + ts;
                dt = dt.AddDays(-1);
            }

            List <Examination> allAppointments;
            Doctor             selectedDoctor = (Doctor)textBoxDoctorExam.SelectedItem;

            List <String> typesExam = new List <string>();

            if (selectedDoctor.Type == TypeOfDoctor.drOpstePrakse)
            {
                typesExam.Add(TypeOfExamination.Opsti.ToString());
            }
            else
            {
                typesExam.Add(TypeOfExamination.Operacija.ToString());
                typesExam.Add(TypeOfExamination.Specijalisticki.ToString());
            }
            txtVrsta.DataContext = typesExam;


            allAppointments = ec.getAllAppointments(selectedDoctor, dt);

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination exm in allAppointments)
            {
                string room = "";
                string type = "";
                if (exm.room.Number != 0)
                {
                    room = exm.room.Number.ToString();
                }
                if (room.Equals(""))
                {
                    type = "";
                }
                else
                {
                    type = exm.Type.ToString();
                }
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = exm.IdExamination;
                e1.doctor        = exm.doctor.Name + " " + exm.doctor.Name;
                e1.patientCard   = exm.patientCard.patient.Name + " " + exm.patientCard.patient.Surname + " " + exm.patientCard.patient.Jmbg;
                e1.DateAndTime   = exm.DateAndTime.ToString();
                e1.room          = room;
                e1.Type          = type;

                examDTO.Add(e1);
            }

            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema slobodnih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                return;
            }
            DataGrid4.ItemsSource = examDTO;
        }
        private void btn1_Click(object sender, RoutedEventArgs e)
        {
            string s = data1.SelectedDate.ToString();

            string[] lines = s.Split(' ');
            string   datum = lines[0];

            if (String.IsNullOrEmpty(datum))
            {
                MessageBox.Show("Morate izdabrati datum za koji želite pregledati raspored.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                data1.Focus();
                return;
            }

            //WorkingTime wt = wc.ViewWorkingTime(d.Jmbg);
            WorkShifts ws = wc.getShiftForDoctor(d.Jmbg);
            TimeSpan   ts;
            DateTime   dt = (DateTime)data1.SelectedDate;

            if (ws == WorkShifts.FIRST)
            {
                ts = new TimeSpan(FIRST_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else if (ws == WorkShifts.SECOND)
            {
                ts = new TimeSpan(SECOND_SHIFT_TIME, 0, 0);
                dt = dt + ts;
            }
            else
            {
                ts = new TimeSpan(THIRD_SHIFT_TIME, 0, 0);
                dt = dt + ts;
                dt = dt.AddDays(-1);
            }

            //TimeSpan ts = new TimeSpan(8, 0, 0);
            List <Examination> exams  = new List <Examination>();
            List <Examination> exams2 = new List <Examination>();

            double hours = 0;

            for (int i = 0; i < 16; i++)
            {
                exams  = ser.ViewExaminationsByDoctorAndDate(d, dt.AddHours(hours));
                hours += 0.5;
                if (exams.Count != 0)
                {
                    foreach (Examination e1 in exams)
                    {
                        exams2.Add(e1);
                    }
                }
            }

            List <ExaminationDTO> examDTO = new List <ExaminationDTO>();

            foreach (Examination ee in exams2)
            {
                ExaminationDTO e1 = new ExaminationDTO();
                e1.IdExamination = ee.IdExamination;
                e1.doctor        = ee.doctor.Name + " " + ee.doctor.Surname;
                e1.DateAndTime   = ee.DateAndTime.ToShortTimeString();
                e1.IdExamination = ee.IdExamination;
                e1.patientCard   = ee.patientCard.patient.Name + " " + ee.patientCard.patient.Surname + " " + ee.patientCard.patient.Jmbg;
                e1.Type          = ee.Type.ToString();
                e1.room          = ee.room.Number.ToString();

                examDTO.Add(e1);
            }
            if (examDTO.Count == 0)
            {
                MessageBox.Show("Nema zakazanih pregelda za odabrani datum.", "Upozorenje!",
                                MessageBoxButton.OK, MessageBoxImage.Warning);

                data1.Focus();
                return;
            }

            DataGrid2.ItemsSource = examDTO;
        }