Esempio n. 1
0
        public void PneumologistCreationWithoutReflectionTest()
        {
            SimpleFactory factory = SimpleFactory.GetFactory();
            IDoctor       x       = factory.GetDoctor(typeof(Pneumologist));

            Assert.AreSame(x.GetType(), typeof(Pneumologist));
        }
Esempio n. 2
0
        public void AddSpecialisationForDoctor(IDoctor doctor)
        {
            int doctorId = doctor.SelectedDoctor;
            int specId   = doctor.SelectedSpecialisation;

            Dictionary <int, string> doctorSpecs = this.GetDoctorSpecialisations(doctorId);


            if (!doctorSpecs.ContainsKey(specId))
            {
                using (MySqlConnection conn = DatabaseConnection.Connection())
                {
                    try
                    {
                        conn.Open();
                        using (MySqlCommand command = new MySqlCommand($"INSERT INTO `posiadaja` VALUES('{doctorId}', '{specId}')", conn))
                        {
                            command.ExecuteNonQuery();
                        }

                        doctor.DoctorSpecialisations = this.GetDoctorSpecialisations(doctorId);

                        conn.Close();
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine("ERROR: " + exc.Message);
                    }
                }
            }
        }
Esempio n. 3
0
        public void AddRoomForDoctor(IDoctor doctor)
        {
            int doctorId = doctor.SelectedDoctor;
            int roomId   = doctor.SelectedRoom;

            Dictionary <int, string> doctorRoom = this.GetDoctorRoom(doctorId);

            if (doctorRoom.Count == 0)
            {
                using (MySqlConnection conn = DatabaseConnection.Connection())
                {
                    try
                    {
                        conn.Open();
                        using (MySqlCommand command = new MySqlCommand($"UPDATE gabinety SET gabinety.id_l = {doctorId} WHERE gabinety.id_g = {roomId};", conn))
                        {
                            command.ExecuteNonQuery();
                        }

                        doctor.DoctorRoom = this.GetDoctorRoom(doctorId);
                        doctor.Rooms      = this.GetRooms();

                        conn.Close();
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine("ERROR: " + exc.Message);
                    }
                }
            }
        }
Esempio n. 4
0
        public int AddDoctor(string name, string surname, DateTime startDate, DateTime birth, string cabinet)
        {
            IDoctor doctor = factory.CreateDoctor(name, surname, startDate, birth, cabinet);

            localEmailSender.SendMail("*****@*****.**", "LOCAL, object 2");
            return(doctorRepo.SaveDoctor(doctor));
        }
Esempio n. 5
0
        internal void AddOservable(IDoctor doctor)
        {
            var observeData = new ObserveData(SelectClinic.Id, doctor.Id, doctor.DoctorName);

            _detector.Add(observeData);
            refreshObserves();
        }
Esempio n. 6
0
        public void AddDoctorToDatabase(IDoctor doctor)
        {
            string name    = doctor.UserName;
            string surname = doctor.UserSurname;

            using (MySqlConnection conn = DatabaseConnection.Connection())
            {
                try
                {
                    conn.Open();
                    using (MySqlCommand command = new MySqlCommand($"INSERT INTO `lekarze` VALUES('', '{name}', '{surname}')", conn))
                    {
                        command.ExecuteNonQuery();
                        doctor.UserName    = "";
                        doctor.UserSurname = "";
                    }

                    doctor.Doctors = this.GetDoctors();
                    Register RG = Register.GetInstance;
                    RG.Doctors = this.GetDoctors();

                    conn.Close();
                }
                catch (Exception exc)
                {
                    Console.WriteLine("ERROR: " + exc.Message);
                }
            }
        }
Esempio n. 7
0
        public void SetStateForSlot(IDoctor doctor,
                                    EntityState modified)
        {
            Doctor instance = ConvertToSlot(doctor);

            Entry(instance).State = EntityState.Modified;
        }
Esempio n. 8
0
        public IDoctorForResponse Delete(int id)
        {
            IDoctor doctor = m_Repository.Delete(id);

            return(doctor == null
                       ? null
                       : new DoctorForResponse(doctor));
        }
Esempio n. 9
0
        public IDoctorForResponse FindById(int id)
        {
            IDoctor doctor = m_Repository.FindById(id);

            return(doctor == null
                       ? null
                       : new DoctorForResponse(doctor));
        }
Esempio n. 10
0
        public IDoctorForResponse Save(IDoctorForResponse doctor)
        {
            IDoctor toBeUpdated = ToDoctor(doctor);

            m_Repository.Save(toBeUpdated);

            return(new DoctorForResponse(toBeUpdated));
        }
Esempio n. 11
0
        public void VisitDocotor(int clientID, int doctorID, DateTime visitDate)
        {
            IClient client = clientRepo.GetClient(clientID);
            IDoctor doctor = doctorRepo.getDoctor(doctorID);

            registation.RegistClientToDoctor(client, doctor, visitDate);
            doctorRepo.UpdateDoctor(doctorID, doctor);
            googleEmailSender.SendMail("*****@*****.**", "VISIT DOCTOR in Consultation");
        }
Esempio n. 12
0
        private static Doctor ConvertToSlot(IDoctor doctor)
        {
            var instance = doctor as Doctor;

            if (instance == null)
            {
                throw new ArgumentException("Provided 'doctor' instance is not a Doctor!",
                                            "doctor");
            }
            return(instance);
        }
Esempio n. 13
0
        public IEnumerable <ISlot> FindSlotsForDoctorByDoctorId(int doctorId)
        {
            IDoctor doctor = m_Repository.FindById(doctorId);

            if (doctor == null)
            {
                return(new ISlot[0]);
            }

            return(FindSlotsForDoctor(doctor));
        }
Esempio n. 14
0
 public void parseDoctor(IDoctor doctor)
 {
     //string content = _doctorCollectionDataResolver.RequestProcess(clinicId, speciality.Id);
     //string specialityFileName = $"Cache/Specialities/{clinicId}_{speciality.Id}.json";
     //if (File.Exists(specialityFileName))
     //{
     //    System.Diagnostics.Trace.WriteLine($"{specialityFileName} is exists");
     //    return;
     //}
     //File.WriteAllText(specialityFileName, content);
 }
Esempio n. 15
0
 public DoctorController()
 {
     if (Convert.ToBoolean(ConfigurationManager.AppSettings["BD"]) == true)
     {
         service = new DoctorServiceBD();
     }
     else
     {
         service = new DoctorServiceFile();
     }
 }
        private List<ISlot> FindSlotsForDoctor(IDoctor doctor)
        {
            IEnumerable <IDay> days = doctor.AppointmentDays;
            var slots = new List <ISlot>();

            foreach ( IDay day in days )
            {
                slots.AddRange(day.AppointmentSlots());
            }

            return slots;
        }
Esempio n. 17
0
        private List <ISlot> FindSlotsForDoctor(IDoctor doctor)
        {
            IEnumerable <IDay> days = doctor.AppointmentDays;
            var slots = new List <ISlot>();

            foreach (IDay day in days)
            {
                slots.AddRange(day.AppointmentSlots());
            }

            return(slots);
        }
Esempio n. 18
0
        public void ClinicShouldGiveRightDoctor()
        {
            // arrange
            IClinic  testClinic  = new Clinic();
            IPatient testPatient = new Patient();

            testPatient.PatientComplaint.Symptoms.Add(Symptom.Headache);

            // act
            IDoctor returnedDoctor = testClinic.GiveDoctor(testPatient);

            // assert
            Assert.IsTrue(returnedDoctor is Orthopedist);
        }
 public UserManagerController(ApplicationDbContext context,
                              IDoctor doctor, IUpload upload,
                              IHostingEnvironment env, IHttpContextAccessor httpContextAccessor,
                              RoleManager <IdentityRole> roleMgr,
                              UserManager <ApplicationUser> userMrg)
 {
     _upload = upload;
     _env    = env;
     _httpContextAccessor = httpContextAccessor;
     roleManager          = roleMgr;
     userManager          = userMrg;
     _context             = context;
     _doctor = doctor;
 }
        public void Delete_ReturnsNewDoctor_WhenCalled([NotNull] IDoctor doctor)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsRepository>();

            repository.Delete(Arg.Any <int>()).Returns(doctor);
            InformationFinder sut = CreateSut(repository);

            // Act
            IDoctorForResponse actual = sut.Delete(DoesNotMatter);

            // Assert
            Assert.Equal(doctor.Id,
                         actual.Id);
        }
        public void FindByLastName_ReturnsDoctors_WhenCalled([NotNull] IDoctor doctor)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsRepository>();

            repository.FindByLastName(Arg.Any <string>()).Returns(CreateList);
            InformationFinder sut = CreateSut(repository);

            // Act
            IEnumerable <IDoctorForResponse> actual = sut.FindByLastName("any name");

            // Assert
            Assert.Equal(2,
                         actual.Count());
        }
        public void FindById_ReturnsDoctor_ForExistingId([NotNull] IDoctor doctor)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsRepository>();

            repository.FindById(doctor.Id).Returns(doctor);
            InformationFinder sut = CreateSut(repository);

            // Act
            IDoctorForResponse actual = sut.FindById(doctor.Id);

            // Assert
            Assert.Equal(doctor.Id,
                         actual.Id);
        }
        public void Delete_ReturnsNewDoctors_WhenCalled([NotNull] IDoctor doctor)
        {
            // Arrange
            var context = Substitute.For <IDoctorsContext>();

            context.Delete(Arg.Any <int>()).Returns(doctor);
            DoctorsRepository sut = CreateSut(context);

            // Act
            IDoctor actual = sut.Delete(-1);

            // Assert
            Assert.Equal(doctor,
                         actual);
        }
        public void Save_CallsSave_WhenCalled([NotNull] IDoctorForResponse toBeUpdated,
                                              [NotNull] IDoctor doctor)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsRepository>();

            repository.Save(Arg.Any <IDoctor>());
            InformationFinder sut = CreateSut(repository);

            // Act
            sut.Save(toBeUpdated);

            // Assert
            repository.Received().Save(Arg.Is <IDoctor>(x => x.Id == toBeUpdated.Id));
        }
        public void FindByLastName_ReturnsDoctors_ForKnownLastName()
        {
            // Arrange
            var context = Substitute.For <IDoctorsContext>();

            context.Doctors().Returns(CreateDoctors);
            DoctorsRepository sut = CreateSut(context);

            // Act
            IDoctor actual = sut.FindByLastName("One").First();

            // Assert
            Assert.Equal("One",
                         actual.LastName);
        }
Esempio n. 26
0
        public void DeleteDoctor(IDoctor doctor)
        {
            int doctorId = doctor.SelectedDoctor;

            if (doctorId != 0)
            {
                using (MySqlConnection conn = DatabaseConnection.Connection())
                {
                    try
                    {
                        conn.Open();
                        using (MySqlCommand command = new MySqlCommand($"DELETE FROM umowienia WHERE umowienia.id_l = {doctorId};", conn))
                        {
                            command.ExecuteNonQuery();
                        }
                        using (MySqlCommand command = new MySqlCommand($"DELETE FROM posiadaja WHERE posiadaja.id_l = {doctorId};", conn))
                        {
                            command.ExecuteNonQuery();
                        }
                        using (MySqlCommand command = new MySqlCommand($"UPDATE gabinety SET gabinety.id_l = NULL WHERE gabinety.id_l = {doctorId};", conn))
                        {
                            command.ExecuteNonQuery();
                        }
                        using (MySqlCommand command = new MySqlCommand($"DELETE FROM lekarze WHERE lekarze.id_l = {doctorId}", conn))
                        {
                            command.ExecuteNonQuery();
                        }

                        doctor.Doctors = this.GetDoctors();
                        doctor.DoctorSpecialisations = this.GetDoctorSpecialisations(doctor.SelectedDoctor);
                        doctor.DoctorRoom            = this.GetDoctorRoom(doctor.SelectedDoctor);
                        doctor.Rooms = this.GetRooms();

                        IRegister register = Register.GetInstance;
                        register.Doctors = this.GetDoctors();

                        IRegisteredUsers registeredUsers = RegisteredUsers.GetInstance;
                        registeredUsers.Registered = this.GetRegistered();

                        conn.Close();
                    }
                    catch (Exception exc)
                    {
                        Console.WriteLine("ERROR: " + exc.Message);
                    }
                }
            }
        }
Esempio n. 27
0
        public void ClinicShouldGiveBillForTreatment()
        {
            // arrange
            IClinic  testClinic  = new Clinic();
            IPatient testPatient = new Patient();

            testPatient.PatientComplaint.Symptoms.Add(Symptom.Headache);
            IDoctor   testDoctor    = testClinic.GiveDoctor(testPatient);
            Treatment testTreatment = testDoctor.PrescribeTreatment(testDoctor.Diagnosticate(testPatient.PatientComplaint));

            // act
            Bill returnedBill = testClinic.GiveBill(testTreatment);

            // assert
            Assert.IsNotNull(returnedBill);
        }
Esempio n. 28
0
        private string getTicketsMessage(IClinic clinic, IDoctor doctor)
        {
            var stringBuilder = new StringBuilder();
            var tickets       = _repository.GetTickets(clinic, doctor);

            for (int i = 0; i < tickets.Count; ++i)
            {
                stringBuilder.AppendLine($"{tickets[i].Time}");
            }

            stringBuilder.AppendLine(string.Empty);
            stringBuilder.AppendLine("0. Вернуться назад");
            stringBuilder.AppendLine("00. Обновить");
            stringBuilder.AppendLine("Наберите + чтобы начать следить");
            return(stringBuilder.ToString());
        }
 public ActionResult ViewData(int id, string strType)
 {
     objIDoctor     = new ILDoctor();
     objDoctorModel = new DoctorModel();
     objICustomer   = new ILCustomer();
     objDoctorModel = objIDoctor.GetByID(id, "Doctor");
     if (strType == "View")
     {
         return(View("ViewData", objDoctorModel));
     }
     else
     {
         BindDegree();
         return(View("UpdateData", objDoctorModel));
     }
 }
        public void Save_ReturnsUpdatedDoctor_ForExisting([NotNull] IDoctorForResponse toBeUpdated,
                                                          [NotNull] IDoctor doctor)
        {
            // Arrange
            var repository = Substitute.For <IDoctorsRepository>();

            repository.Save(Arg.Any <IDoctor>());
            InformationFinder sut = CreateSut(repository);

            // Act
            IDoctorForResponse actual = sut.Save(toBeUpdated);

            // Assert
            Assert.Equal(toBeUpdated.Id,
                         actual.Id);
        }
Esempio n. 31
0
        public DoctorPresenter(IView view, Model model, IDoctor doctor)
        {
            this.view   = view;
            this.model  = model;
            this.doctor = doctor;

            LoadDoctors();
            LoadSpecialisations();
            LoadRooms();
            LoadSpecsAndRoom();

            this.doctor.ReturnBtnClicked    += BackToMenu;
            this.doctor.AddDoctorBtnClicked += AddDoctor;
            this.doctor.DoctorSelected      += LoadSpecsAndRoom;
            this.doctor.AddDoctorSpecialisationBtnClicked += AddSpecialisationForDoctor;
            this.doctor.AddRoomForDoctorBtnClicked        += AddRoomForDoctor;
            this.doctor.DeleteDoctorBtnClicked            += DeleteDoctor;
        }
Esempio n. 32
0
 public void Setup()
 {
     doctorDentist = new Dentist();
     doctorENT = new ENT();
     doctorOrthopedist = new Orthopedist();
 }
Esempio n. 33
0
 public Hospital(IPatient patient)
 {
     this.patient = patient;
     StaffRoom doctors = new Orthopaedist();
     doctor = doctors.Request();
 }
        public void Remove(IDoctor doctor)
        {
            Doctor instance = ConvertToSlot(doctor);

            DbSetDoctors.Remove(instance);
        }
        public void SetStateForSlot(IDoctor doctor,
                                    EntityState modified)
        {
            Doctor instance = ConvertToSlot(doctor);

            Entry(instance).State = EntityState.Modified;
        }
Esempio n. 36
0
 public void AddDoctor(IDoctor doctor)
 {
     Doctors.Add(doctor);
 }
        private static Doctor ConvertToSlot(IDoctor doctor)
        {
            var instance = doctor as Doctor;

            if ( instance == null )
            {
                throw new ArgumentException("Provided 'doctor' instance is not a Doctor!",
                                            "doctor");
            }
            return instance;
        }
        public void Add(IDoctor doctor)
        {
            Doctor instance = ConvertToSlot(doctor);

            DbSetDoctors.AddOrUpdate(instance);
        }