Ejemplo n.º 1
0
        private void buttonObrisiZaposlenog_Click(object sender, RoutedEventArgs e)
        {
            if (SelektovaniZaposleni == null || string.IsNullOrWhiteSpace(SelektovaniZaposleni.Jmbg))
            {
                return;
            }
            foreach (Zaposleni z in TempZaposlenici)
            {
                if (z.Jmbg == SelektovaniZaposleni.Jmbg)
                {
                    DoctorController    doctorController    = new DoctorController();
                    SecretaryController secretaryController = new SecretaryController();
                    UserController      userController1     = new UserController(doctorController);
                    UserController      userController2     = new UserController(secretaryController);
                    if (!userController2.DeleteProfile(z.Jmbg))
                    {
                        userController1.DeleteProfile(z.Jmbg);
                        ExaminationController ec = new ExaminationController();
                        ec.DeleteDoctorExaminations(z.Jmbg);
                        WorkingTimeController wtc = new WorkingTimeController();
                        wtc.DeleteWorkingTime(z.Jmbg);
                    }

                    TempZaposlenici.Remove(z);
                    Zaposlenici.Remove(z);
                    SelektovaniZaposleni = null;

                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public void DebePoderGuardarUnDoctor()
        {
            var docor = new Doctor()
            {
                Codigo          = "ddddd",
                Nombres         = "Pedro",
                Apellidos       = "Huaman",
                TipoDocumento   = TipoDocumento.DNI,
                NumeroDocumento = "dkdhas",
                Celular         = "96482494",
                Especialidad    = "Ojos",
                Username        = "******",
                Password        = "******",
                Estado          = Estado.Activo
            };
            ModelStateDictionary modelState = new ModelStateDictionary();

            var iDoctorService = new Mock <IDoctorService>();

            iDoctorService.Setup(o => o.AddDoctor(docor));

            var iDoctorValidation = new Mock <IDoctorValidation>();

            iDoctorValidation.Setup(o => o.IsValid()).Returns(true);

            var controller = new DoctorController(iDoctorService.Object, iDoctorValidation.Object);

            var view = controller.Save(docor);

            Assert.IsInstanceOf <RedirectToRouteResult>(view);
            Assert.IsNotInstanceOf <ViewResult>(view);
            iDoctorValidation.Verify(o => o.Validate(docor, modelState));
            iDoctorValidation.Verify(o => o.IsValid());
            iDoctorService.Verify(o => o.AddDoctor(docor), Times.AtLeastOnce);
        }
Ejemplo n.º 3
0
        internal async Task AddAppointmentAsync(int doctorId, int patientId, DateTime dateTime)
        {
            Doctor  doctor  = null;
            Patient patient = null;

            using (var doctorController = new DoctorController())
                await Task.Run(() => doctor = doctorController.GetDoctor(doctorId));
            if (doctor == null)
            {
                throw new KeyNotFoundException("Doctor with the specified id doesn't exist.");
            }

            using (var patientController = new PatientController())
                await Task.Run(() => patient = patientController.GetPatient(patientId));
            if (patient == null)
            {
                throw new KeyNotFoundException("Patient with the specified id doesn't exist.");
            }


            Appointment appointment = new Appointment(doctor, patient, dateTime);

            using (_controller = new AppointmentController())
                await Task.Run(() => _controller.AddAppointment(appointment));

            await UpdateAppointmentsAsync();
        }
Ejemplo n.º 4
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;
        }
 private void LoadDataFromFiles()
 {
     DoctorController.getInstance().LoadFromFile();
     PatientController.getInstance().LoadFromFile();
     AppointmentController.getInstance().LoadAppointmentsFromFile();
     NotificationController.GetInstance().LoadFromFile();
 }
Ejemplo n.º 6
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();
        }
Ejemplo n.º 7
0
        public void DoctorMyinfo()
        {
            //arrange
            DoctorController controller = new DoctorController();

            //act


            try
            {
                Doctor doc = new Doctor();
                controller.Session["DoctorLoggedIn"] = "doc1";
                ViewResult result = controller.MyInfo() as ViewResult;


                // ViewResult result = controller.Submit(doc) as ViewResult;
                Assert.IsNotNull(result);
            }
            catch (Exception e)
            {
                Assert.AreNotEqual("pass", e);
            }
            //assert
            //Assert.AreEqual("pass", "pass");
            Assert.IsNotNull(controller);
        }
Ejemplo n.º 8
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;
        }
Ejemplo n.º 9
0
        internal async Task EditDoctorAsync(Doctor oldPatient, Doctor newDoctor)
        {
            using (_controller = new DoctorController())
                await Task.Run(() => _controller.AlterDoctorInfo(SelectedDoctor, newDoctor));

            await UpdateDoctorsAsync();
        }
 private void deleteBtn_Click(object sender, RoutedEventArgs e)
 {
     if (doctorsGrid.SelectedItem is Doctor)
     {
         DoctorController.getInstance().RemoveDoctor((Doctor)doctorsGrid.SelectedItem);
     }
 }
Ejemplo n.º 11
0
        public void NoDeberPoderActualizarUnDoctor()
        {
            var docor = new Doctor()
            {
                Codigo          = "ddddd",
                Nombres         = "Pedro",
                Apellidos       = "Huaman",
                TipoDocumento   = TipoDocumento.DNI,
                NumeroDocumento = "dkdhas",
                Celular         = "96482494",
                Especialidad    = "Ojos",
                Username        = "******",
                Password        = "******",
                Estado          = Estado.Activo
            };
            ModelStateDictionary modelState = new ModelStateDictionary();

            var iDoctorValidation = new Mock <IDoctorValidation>();

            iDoctorValidation.Setup(o => o.ValidateUpdate(docor, modelState));
            iDoctorValidation.Setup(o => o.IsValid()).Returns(false);

            var controller = new DoctorController(null, iDoctorValidation.Object);
            var view       = controller.Update(docor);

            Assert.IsInstanceOf <ViewResult>(view);
            iDoctorValidation.Verify(o => o.ValidateUpdate(docor, modelState));
            iDoctorValidation.Verify(o => o.IsValid());
        }
Ejemplo n.º 12
0
        public UserAccountLogged()
        {
            _userController         = (Application.Current as App).UserController;
            _doctorController       = (Application.Current as App).DoctorController;
            _drugController         = (Application.Current as App).DrugController;
            _notificationController = (Application.Current as App).NotificationController;
            InitializeComponent();

            User user = _userController.GetLoggedUser();

            nameTextBox.Text    = user.Name;
            surnameTextBox.Text = user.Surname;
            emailTextBox.Text   = user.Email;
            idLabel.Content     = user.Id.ToString();

            userTypeLabel.Content = user.GetType().Name;

            Doctor doctor = _doctorController.Get(user.Id);

            if (doctor != null)
            {
                notificationDataGrid.Visibility = Visibility.Visible;

                List <Notification> notifications = new List <Notification>();

                foreach (var notificationId in doctor.Notification)
                {
                    notifications.Add(_notificationController.Get(notificationId));
                }

                notificationDataGrid.ItemsSource = notifications;
            }
        }
Ejemplo n.º 13
0
        public EmployeesPage()
        {
            _doctorController   = (Application.Current as App).DoctorController;
            _employeeController = (Application.Current as App).EmployeeController;
            DoctorList          = new ObservableCollection <DoctorView>();
            SecretaryList       = new ObservableCollection <EmployeeView>();

            InitializeComponent();
            this.DataContext = this;

            List <Doctor> doctors = new List <Doctor>();

            doctors = _doctorController.GetAll();

            for (int i = 0; i < doctors.Count; i++)
            {
                DoctorList.Add(new DoctorView(doctors[i]));
            }

            dataGrid.ItemsSource = DoctorList;

            SecretaryList.Add(new EmployeeView((Employee)_employeeController.Get()));

            dataGrid2.ItemsSource = SecretaryList;
        }
Ejemplo n.º 14
0
 public RegularAppointmentService()
 {
     appointmentRepository       = new AppointmentRepository(path);
     doctorController            = new DoctorController();
     employeesScheduleController = new EmployeesScheduleController();
     patientController           = new PatientController();
 }
Ejemplo n.º 15
0
        public AddMedicine()
        {
            InitializeComponent();
            this.DataContext = this;

            DoctorController  DoctorContr = new DoctorController();
            List <DoctorUser> lista       = new List <DoctorUser>();

            lista = DoctorContr.GetAll();



            foreach (DoctorUser ee in lista)
            {
                StringBuilder l = new StringBuilder();
                l.Append(ee.id + " ");
                l.Append(ee.firstName + " ");
                l.Append(ee.secondName);
                li.Add(new Lista {
                    Name = l.ToString()
                });
            }



            Combo.ItemsSource = li;
        }
Ejemplo n.º 16
0
        public void DoctorQueueDelete()
        {
            //arrange
            DoctorController controller = new DoctorController();

            //act


            try
            {
                Doctor   doc  = new Doctor();
                Queue    que  = new Queue();
                DateTime date = new DateTime();
                controller.Session["DoctorLoggedIn"] = "doc1";
                ViewResult result = controller.QueueDelete(date, "a", true, "a") as ViewResult;


                // ViewResult result = controller.Submit(doc) as ViewResult;
                Assert.IsNotNull(result);
            }
            catch (Exception e)
            {
                Assert.AreNotEqual("pass", e);
            }
            //assert
            //Assert.AreEqual("pass", "pass");
            Assert.IsNotNull(controller);
        }
Ejemplo n.º 17
0
        internal async Task RemoveDoctorAsync(Doctor doctor)
        {
            using (_controller = new DoctorController())
                await Task.Run(() => _controller.RemoveDoctor(doctor));

            await UpdateDoctorsAsync();
        }
Ejemplo n.º 18
0
        private void LoadController()
        {
            // HospitalManagementController
            doctorStatisticsController    = new DoctorStatisticsController(doctorStatisticsService);
            inventoryStatisticsController = new InventoryStatisticsController(inventoryStatisticsService);
            roomStatisticsController      = new RoomStatisticsController(roomStatisticsService);
            hospitalController            = new HospitalController(hospitalService);
            medicineController            = new MedicineController(medicineService);
            roomController      = new RoomController(roomService);
            inventoryController = new InventoryController(inventoryService);

            // MedicalController
            appointmentController = new AppointmentController(appointmentService, appointmentRecommendationService);
            diseaseController     = new DiseaseController(diseaseService);

            // MiscController
            articleController        = new ArticleController(articleService);
            doctorFeedbackController = new DoctorFeedBackController(doctorFeedbackService);
            feedbackController       = new FeedbackController(feedbackService);
            locationController       = new LocationController(locationService);
            messageController        = new MessageController(messageService);
            notificationController   = new NotificationController(notificationService);

            // UsersController
            doctorController    = new DoctorController(doctorService, diagnosisService, therapyService, medicalRecordService);
            managerController   = new ManagerController(managerService);
            patientController   = new PatientController(patientService, medicalRecordService, therapyService, diagnosisService);
            secretaryController = new SecretaryController(secretaryService);
            userController      = new UserController(userService);
        }
Ejemplo n.º 19
0
        public void IsUniqueTest()
        {
            DoctorController controller = new DoctorController();
            Doctor           doctor     = new Doctor();

            doctor.LicenseNumber    = "abnbdbq122";
            doctor.WCBAuthorization = "";
            doctor.WcbRatingCode    = "";
            doctor.NPI     = "";
            doctor.TaxType = GBEnums.TaxType.Tax1;
            doctor.Title   = "abcd";
            doctor.user    = new User();

            doctor.user.UserName   = "******";
            doctor.user.MiddleName = "Micheal";
            doctor.user.FirstName  = "MILIND";
            doctor.user.LastName   = "Kate";
            doctor.user.Gender     = GBEnums.Gender.Male;
            doctor.user.UserType   = GBEnums.UserType.Staff;
            doctor.user.Status     = GBEnums.UserStatus.Active;

            doctor.user.ContactInfo = new ContactInfo();
            doctor.user.ContactInfo.EmailAddress = "*****@*****.**";

            controller.IsUnique(doctor);
        }
        public void TestUpdateDoctor()
        {
            IDataBaseService   iDataBaseService  = new DataBaseService();
            DoctorService      dService          = new DoctorService(iDataBaseService);
            StaticDataServices staticDataService = new StaticDataServices(iDataBaseService);
            ILogger            logger            = new Logger(iDataBaseService);

            DataServices.DataServices dServ   = new DataServices.DataServices(iDataBaseService);
            ViewModelFactory          factory = new ViewModelFactory(dServ, staticDataService);
            DoctorMapper     dMapper          = new DoctorMapper(factory);
            DoctorController dController      = new DoctorController(staticDataService, dServ, factory, dMapper, logger);

            dController.Request = new HttpRequestMessage
            {
                RequestUri = new Uri("http://localhost/Doctor/SaveDoctor")
            };
            dController.Configuration = new HttpConfiguration();
            dController.Configuration.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional });

            dController.RequestContext.RouteData = new HttpRouteData(
                route: new HttpRoute(),
                values: new HttpRouteValueDictionary {
                { "controller", "doctor" }
            });

            RequestCarrier req = new RequestCarrier();

            req.From     = "Test";
            req.TanentId = -1;

            DoctorViewModel dvModel = new DoctorViewModel(staticDataService.GetCountry(), staticDataService.GetState(), staticDataService.GetCity(), staticDataService.GetHospital(), staticDataService.GetDegree(), staticDataService.GetSpecialization(), staticDataService.GetDesease());

            dvModel.Id                   = 8;
            dvModel.Address1             = "12, DP Pharma Road";
            dvModel.CityID               = 1;
            dvModel.CreatedBy            = 1;
            dvModel.CreatedByEntity      = 1;
            dvModel.DoctorDegree         = new List <int>();
            dvModel.DoctorDesease        = new List <int>();
            dvModel.DoctorHospital       = new List <int>();
            dvModel.DoctorSpecialization = new List <int>();
            dvModel.EmailAddress         = "*****@*****.**";
            dvModel.FirstName            = "Raj";
            dvModel.LastName             = "Sharma";
            dvModel.OtherInformation     = "Heart Specilist";
            dvModel.PhoneNumber          = "8989889889";
            dvModel.Pincode              = "411014";
            dvModel.ProfilePhotoID       = 1;
            dvModel.RegistrationNumber   = "RJ12123";
            dvModel.TanentId             = -1;
            //dvModel.UpdatedBy = 1;
            req.PayLoad = dvModel;
            var response = dController.SaveDoctor(req);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 21
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     CheckIfPatientIsTroll();
     AppointmentController.getInstance().SaveAppointmentsInFile();
     DoctorController.getInstance().SaveInFlie();
     PatientController.getInstance().SaveInFile();
     _instance = null;
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Constructor for the make appointment form
 /// </summary>
 /// <param name="appointmentUserControl">the refering appointment user control</param>
 public MakeAppointmentForm(AppointmentUserControl appointmentUserControl)
 {
     InitializeComponent();
     this.appointmentUserControl = appointmentUserControl;
     this.appointmentController  = new AppointmentController();
     this.patientController      = new PatientController();
     this.doctorController       = new DoctorController();
 }
 public AdminAuthenticationController(string connectionString, ServerIP IPConfig, JsonStructure jsonStructureConfig, MailData mailData)
     : base(IPConfig, jsonStructureConfig, jsonStructureConfig.Patient)
 {
     DoctorController            = new DoctorController(IPConfig, jsonStructureConfig);
     PatientCollectionController = new PatientController(IPConfig, jsonStructureConfig);
     ConnectionString            = connectionString;
     MailData = mailData;
 }
Ejemplo n.º 24
0
 /// <summary>
 /// Constructor for the edit appointment form
 /// </summary>
 /// <param name="theAppointment">The appointment to be edited</param>
 public EditAppointmentForm(AppointmentUserControl appointmentUserControl, Appointment theAppointment)
 {
     InitializeComponent();
     this.appointmentUserControl = appointmentUserControl;
     this.appointmentController  = new AppointmentController();
     this.doctorController       = new DoctorController();
     this.theAppointment         = theAppointment ?? throw new ArgumentNullException("theAppointment", "Appointment cannot be null for this form");
 }
Ejemplo n.º 25
0
 public NewAppointmentDialog(UserDTO _patient)
 {
     InitializeComponent();
     doctorController      = new DoctorController();
     appointmentController = new AppointmentController();
     patientController     = new PatientController();
     patient = _patient;
 }
Ejemplo n.º 26
0
        private bool isOrdinationAvailable(Room room)
        {
            DoctorController  doctorController = new DoctorController();
            List <DoctorUser> listOfDoctors    = doctorController.GetAll();

            List <DoctorUser> doctorsWithFreeOrdination = listOfDoctors.Where(doctor => (doctor.ordination.Equals(room.typeOfRoom))).ToList();

            return(isListOfDoctorsEmpty(doctorsWithFreeOrdination));
        }
Ejemplo n.º 27
0
 public AppointmentInformationDialog(AppointmentDTO appointmentDTO, UserDTO _patient)
 {
     InitializeComponent();
     doctorController      = new DoctorController();
     appointmentController = new AppointmentController();
     this.patient          = _patient;
     this.appointmentDTO   = appointmentDTO;
     this.doctor           = doctorController.GetDoctorById(this.appointmentDTO.DoctorID.Value);
 }
Ejemplo n.º 28
0
        public async Task PostCreateShouldReturnRedirectWithValidModel()
        {
            //Arrange
            const string nameValue           = "Name";
            const string emailValue          = "*****@*****.**";
            const string imageURLValue       = "SomeURL";
            const string specialityValue     = "doctorche";
            const string departmentNameValue = "department";

            string modelName           = null;
            string modelEmail          = null;
            string modelImageURL       = null;
            string modelSpeciality     = null;
            string modelDepartmentName = null;

            var doctorService = new Mock <IDoctorService>();

            doctorService.Setup
                (d => d.CreateAsync(
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>(),
                    It.IsAny <string>()))
            .Callback((string name,
                       string email, string imageURL, string speciality, string departmentName) =>
            {
                modelName           = name;
                modelEmail          = email;
                modelImageURL       = imageURL;
                modelSpeciality     = speciality;
                modelDepartmentName = departmentName;
            })
            .Returns(Task.CompletedTask);

            var controller = new DoctorController(doctorService.Object);

            // Act
            var result = await controller.Create(new DoctorViewModel
            {
                Name           = nameValue,
                Email          = emailValue,
                ImageURL       = imageURLValue,
                Speciality     = specialityValue,
                DepartmentName = departmentNameValue
            });

            // Assert
            modelName.Should().Be(nameValue);
            modelEmail.Should().Be(emailValue);
            modelImageURL.Should().Be(imageURLValue);
            modelSpeciality.Should().Be(specialityValue);
            modelDepartmentName.Should().Be(departmentNameValue);

            result.Should().BeOfType <RedirectToActionResult>();
        }
Ejemplo n.º 29
0
        public DoctorControllerTests()
        {
            Random random = new Random();

            _options = new DbContextOptionsBuilder <HospitalContext>()
                       .UseInMemoryDatabase(databaseName: "HospitalTestDb" + random.Next(int.MinValue, int.MaxValue))
                       .Options;

            _controller = new DoctorController(_options);
        }
 public CreateAppointment(UserInfo info, Patient currentPatient)
 {
     InitializeComponent();
     this.currentPatient   = currentPatient;
     doctorController      = new DoctorController();
     patientController     = new PatientController();
     appointmentController = new AppointmentController();
     userID           = info;
     lblUserName.Text = userID.userID;
 }