Esempio n. 1
0
        public void AddNewMedicalExamination(IAddMedicalExaminationView inForm)
        {
            _form = inForm;

            List <ExaminationType> typesList = _serviceFactory.CreateExaminationTypeService(_unitOfWork).GetAll();

            if (inForm.ShowViewModal(typesList))
            {
                try
                {
                    bool            emergency       = inForm.Emergency;
                    ExaminationType examinationType = inForm.ExaminationType;
                    string          PatientId       = inForm.PatientId;
                    string          FirstName       = inForm.PatientFirstName;
                    string          LastName        = inForm.PatientLastName;
                    string          OIB             = inForm.PatientOIB;
                    string          address         = inForm.Address;
                    string          city            = inForm.City;
                    string          zipCode         = inForm.ZipCode;
                    DateTime        DateOfBirth;
                    DateTime.TryParseExact(inForm.PatientDateOfBirth, "dd.MM.yyyy", null, DateTimeStyles.None, out DateOfBirth);

                    var patientService = _serviceFactory.createPatientService(_unitOfWork);

                    var patient = patientService.GetByOIB(OIB);

                    if (patient == null)
                    {
                        patient = patientService.Add(FirstName, LastName, OIB, DateOfBirth, PatientId, address, city, zipCode);
                    }

                    Employee    employee    = LoggedIn.GetEmployee();
                    WaitingRoom waitingRoom = LoggedIn.GetWaitingRoom();

                    IMedicalExaminationService medicalExaminationService = _serviceFactory.createMedicalExaminationService(_unitOfWork);

                    MedicalExamination medicalExamination = medicalExaminationService.Add(patient, examinationType, emergency);
                    //WaitingRoom waitingRoom = LoggedIn.GetEmployee().WaitingRoom;

                    //var service = _serviceFactory.CreateWaitingRoomService(_unitOfWork);

                    //WaitingRoom wr = service.GetById(waitingRoom.Id);
                    //WaitingRoom wr = new WaitingRoom(new List<MedicalExamination>(), "Kardio");
                    //wr.AddExamination(medicalExamination);
                    //service.Add(wr);

                    NotifyObservers();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.StackTrace);
                }
            }
        }
Esempio n. 2
0
        public ActionResult Create(MedicalExamination medicalExamination)
        {
            ViewBag.ExanimationType     = new SelectList(_typeService.GetAll(), "Value", "Text");
            ViewData["ExanimationType"] = new SelectList(_typeService.GetAll(), "Value", "Text");

            medicalExamination.Doctor      = _doctorService.GetByEmployeeId(User.Identity.Name);
            medicalExamination.WaitingRoom = medicalExamination.Doctor.WaitingRoom;
            if (_patientService.GetByOIB(medicalExamination.Patient.OIB) == null)
            {
                ModelState.AddModelError("", "Neispravan OIB pacijenta.");
                //pokazi gresku
            }
            else
            {
                medicalExamination.Patient = _patientService.GetByOIB(medicalExamination.Patient.OIB);
                _exanimationService.Add(medicalExamination);
            }

            return(RedirectToAction("Index"));

            // return View(medicalExamination);
        }