コード例 #1
0
        public RecommendAppointment()
        {
            InitializeComponent();
            this.DataContext      = this;
            doctorController      = new DoctorController();
            appointmentController = new AppointmentController();
            operationController   = new OperationController();
            patientController     = new PatientController();

            List <ListaDoktoriCeloIme> mojaLista = new List <ListaDoktoriCeloIme>();

            listAppointments = appointmentController.GetAll();
            listPatients     = new List <PatientUser>();
            listPatients     = patientController.GetAll();
            listDoctors      = doctorController.GetAll();
            listOperations   = operationController.GetAll();

            foreach (DoctorUser d in listDoctors)
            {
                if (d.isSpecialist == false)
                {
                    StringBuilder l = new StringBuilder();
                    l.Append(d.firstName + " ");
                    l.Append(d.secondName + " ");
                    l.Append(d.id);
                    ListaDoktoriCeloIme a = new ListaDoktoriCeloIme();
                    a.DoctorName = l.ToString();
                    mojaLista.Add(a);
                }
            }

            doctorCombo.ItemsSource = mojaLista;
        }
コード例 #2
0
        private int getNextid1()
        {
            OperationController rp    = new OperationController();
            List <Operation>    lista = rp.GetAll();

            int number = 10;

            foreach (Operation r in lista)
            {
                if (r.id > number)
                {
                    number = r.id;
                }
            }

            number += 1;
            return(number);
        }
コード例 #3
0
ファイル: PatientService.cs プロジェクト: ProbaFirma10/Proba
        public Boolean doesPatientHaveAnOperationAtSpecificTime(TimeSpan time, string date, PatientUser patient)
        {
            OperationController operationController = new OperationController();
            List <Operation>    listOfOperation     = operationController.GetAll();

            if (listOfOperation == null)
            {
                listOfOperation = new List <Operation>();
            }

            foreach (Operation operation in listOfOperation)
            {
                if (operation.patient.id == patient.id && operation.date.Equals(date) && compareTimeForOperation(time, operation.start, operation.end))
                {
                    return(true);
                }
            }
            return(false);
        }
コード例 #4
0
ファイル: PatientService.cs プロジェクト: ProbaFirma10/Proba
        public bool doesPatientHaveAnOperationAtSpecificPeriod(TimeSpan start, TimeSpan end, string dateToString, PatientUser patient)
        {
            bool busy = false;
            OperationController operationController = new OperationController();
            List <Operation>    listOfOperation     = operationController.GetAll();

            foreach (Operation operation in listOfOperation)
            {
                PatientUser dr = operation.patient;
                if (dr.id == patient.id && operation.date.Equals(dateToString))
                {
                    busy = compareTimeForOperation(start, operation.start, operation.end);
                    if (!busy)
                    {
                        busy = compareTimeForOperation(end, operation.start, operation.end);
                    }
                }
            }
            return(busy);
        }
コード例 #5
0
        private void Termini_Click(object sender, RoutedEventArgs e)
        {
            String m = bingPathToAppDir(@"JsonFiles\doctors.json");
            AppointmentController apcon = new AppointmentController();

            List <DoctorAppointment> pregledi  = apcon.GetAll();
            OperationController      opcon     = new OperationController();
            List <Operation>         operacije = opcon.GetAll();
            DoctorRepository         docRepo   = new DoctorRepository(m);
            List <DoctorUser>        doktori   = docRepo.GetAll();
            DoctorUser drOvaj = new DoctorUser();
            String     poruka = "";

            foreach (DoctorUser d1 in doktori)
            {
                if (d1.email.Equals(emailLekarBox.Text.ToString()))
                {
                    drOvaj = d1;
                }
            }
            EmployeesScheduleController schCon   = new EmployeesScheduleController();
            List <Schedule>             raspored = schCon.GetAll();
            Boolean duznost = false;

            foreach (Schedule rasp in raspored)
            {
                if (rasp.employeeid.Equals(drOvaj.id.ToString()))
                {
                    if (DatumBox.Text.Equals(rasp.date))
                    {
                        duznost = true;
                        poruka += "Lekar datuma " + rasp.date + " radi od " + rasp.shift.startTime + " do " + rasp.shift.endTime + ".\n";
                    }
                }
            }
            if (duznost == false)
            {
                poruka += "Lekar nije da duznosti trazenog datuma.";
            }
            if (duznost == true)
            {
                poruka += "Zauzeti termini su: \n";
                foreach (DoctorAppointment d in pregledi)
                {
                    TimeSpan kraj = d.time + new TimeSpan(0, 15, 0);
                    if (d.doctor.id.ToString().Equals(drOvaj.id.ToString()))
                    {
                        if (d.date.Equals(DatumBox.Text))
                        {
                            poruka += " " + d.time + " - " + kraj + "\n";
                        }
                    }
                }
                foreach (Operation d in operacije)
                {
                    if (d.isResponiable.id.ToString().Equals(drOvaj.id.ToString()))
                    {
                        if (d.date.Equals(DatumBox.Text))
                        {
                            poruka += " " + d.start + " - " + d.end + "\n";
                        }
                    }
                }
            }
            MessageBox.Show(poruka, "Raspored lekara za trazeni datum", MessageBoxButton.OK, MessageBoxImage.Information);
        }