Example #1
0
        public void AddWorkShiftNoEmployeeAssigned()
        {
            // Work shift data
            #region
            string shiftName = "Work Shift 1";
            string from      = "08:00";
            string to        = "12:00";
            #endregion

            Home.GoTo();
            Home.LoginAsAdmin();

            // Create a work shift
            Menu.Admin.Job.WorkShifts.GoTo();
            WorkShifts.AddWorkShift(shiftName, from, to);

            Menu.Admin.Job.WorkShifts.GoTo();
            Assert.IsTrue(WorkShifts.WorkShiftCorrectlyAdded(shiftName, from, to), $"The work shift {shiftName} was not correctly added.");

            //Cleanup
            Menu.Admin.Job.WorkShifts.GoTo();
            WorkShifts.DeleteWorkShift(shiftName);

            Home.Logout();
        }
 public WorkingTime(Users.Doctor doctor, WorkShifts workShift, DateTime start, DateTime end)
 {
     if (doctor == null)
     {
         this.doctor = new Users.Doctor();
     }
     else
     {
         this.doctor = new Users.Doctor(doctor);
     }
     this.WorkShift = workShift;
     this.StartDate = start;
     this.EndDate   = end;
 }
        private bool isDoctorWorkInFirstShift(Doctor doctor)
        {
            if (doctor == null)
            {
                return(false);
            }

            WorkShifts workShifts = workingTimeController.getShiftForDoctor(doctor.Jmbg);

            if (workShifts == WorkShifts.FIRST)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #4
0
        public void DeleteWorkShiftEmployeesAssigned()
        {
            // Work shift data
            #region
            string shiftName = "Work Shift 2";
            string from      = "08:00";
            string to        = "12:00";
            #endregion

            Home.GoTo();
            Home.LoginAsAdmin();

            // Add employees
            Menu.PIM.EmployeeList.GoTo();
            EmployeeList.AddEmployeeViaButton(_firstName1, _middleName1, _lastName1, _createLoginDetails);
            Menu.PIM.EmployeeList.GoTo();
            EmployeeList.AddEmployeeViaButton(_firstName2, _middleName2, _lastName2, _createLoginDetails);

            // Create a work shift and assign employees to work it
            Menu.Admin.Job.WorkShifts.GoTo();
            WorkShifts.AddWorkShift(shiftName, from, to);

            // Assign employees - the list takes first + middle + last
            string employee1 = _firstName1 + " " + _middleName1 + " " + _lastName1;
            string employee2 = _firstName2 + " " + _middleName2 + " " + _lastName2;

            // Assign some employees
            string[] employees = { employee1, employee2 };
            WorkShifts.AssignEmployeeToWorkShift(shiftName, employees);

            // Remove employees from work shift
            WorkShifts.DeleteEmployeeFromWorkShift(shiftName, employees);

            Assert.IsTrue(WorkShifts.WorkShiftEmployeesCorrectlyRemoved(shiftName, employees), $"The employees were not correctly added.");

            // Cleanup
            Menu.PIM.EmployeeList.GoTo();
            EmployeeList.DeleteEmployee(_firstName1, _middleName1, _lastName1);
            EmployeeList.DeleteEmployee(_firstName2, _middleName2, _lastName2);
            Menu.Admin.Job.WorkShifts.GoTo();
            WorkShifts.DeleteWorkShift(shiftName);

            Home.Logout();
        }
        private void shiftAndDoctorChange()
        {
            if (first.IsSelected)
            {
                workShifts = WorkShifts.FIRST;
            }
            else if (second.IsSelected)
            {
                workShifts = WorkShifts.SECOND;
            }
            else
            {
                workShifts = WorkShifts.THIRD;
            }

            doctors = workingTimeController.ViewDoctorsWhoWork((DateTime)dpDate.SelectedDate, workShifts);
            cmbDoctors.DataContext = doctors;

            setFirstDoctor();
        }
Example #6
0
        private void buttonRecommendAppointment_Click(object sender, RoutedEventArgs e)
        {
            if (comboBoxDoctor.Text.Equals("") || startDatePicker.Text.Equals("") || endDatePicker.Text.Equals(""))
            {
                ValidationMessageWindow validationWindow = new ValidationMessageWindow();
                validationWindow.Show();
            }
            else
            {
                doctor = (Doctor)comboBoxDoctor.SelectedItem;
                DateTime sDate = (DateTime)startDatePicker.SelectedDate;
                DateTime eDate = (DateTime)endDatePicker.SelectedDate;

                if (DateTime.Compare(sDate, eDate) >= 0)
                {
                    DateMessageWindow dateMessageWindow = new DateMessageWindow();
                    dateMessageWindow.caption.Text = "Pažnja, datum početka mora biti pre datuma kraja vremenskog intervala!";
                    dateMessageWindow.Show();
                }
                else
                {
                    string   dateStart = sDate.ToShortDateString();
                    string   dateEnd   = eDate.ToShortDateString();
                    string   time;
                    DateTime startDate;
                    DateTime endDate;

                    workShifts = workingTimeController.getShiftForDoctor(doctor.Jmbg);

                    if (priorityDoctor.IsChecked == true)
                    {
                        if (workShifts == WorkShifts.FIRST)
                        {
                            time                 = "8:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }
                        else if (workShifts == WorkShifts.SECOND)
                        {
                            time                 = "4:00 PM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }
                        else
                        {
                            time                 = "12:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDoctor(doctor, startDate, endDate);
                        }


                        recommendedDate.Text = recommendExamination.DateAndTime.ToShortDateString();

                        recommendedTime.Text = recommendExamination.DateAndTime.ToShortTimeString();

                        buttonMakeAppointment.IsEnabled = true;
                    }
                    else
                    {
                        if (workShifts == WorkShifts.FIRST)
                        {
                            time                 = "8:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }
                        else if (workShifts == WorkShifts.SECOND)
                        {
                            time                 = "4:00 PM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }
                        else
                        {
                            time                 = "12:00 AM";
                            startDate            = Convert.ToDateTime(dateStart + " " + time, CultureInfo.InvariantCulture);
                            endDate              = Convert.ToDateTime(dateEnd + " " + time, CultureInfo.InvariantCulture);
                            recommendExamination = examinationController.AppointmentRecommendationByDate(doctor, startDate, endDate);
                        }


                        recommendedDate.Text = recommendExamination.DateAndTime.ToShortDateString();

                        recommendedTime.Text = recommendExamination.DateAndTime.ToShortTimeString();

                        buttonMakeAppointment.IsEnabled = true;
                    }
                }
            }
        }
        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;
        }