private static IAppointmentRepository CreateStubRepositoryInPast() { var stubRepository = new Mock <IAppointmentRepository>(); var appointments = new List <DoctorAppointment>(); DoctorUser doctor1 = new DoctorUser(1, "Konstantin", "Davidovic", "1234", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DoctorUser doctor2 = new DoctorUser(2, "Novak", "Maric", "12345", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); PatientUser patient1 = new PatientUser(1, "Pera2", "Peric", "Male", "1234", "2/2/2020", "123", "212313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); PatientUser patient2 = new PatientUser(2, "Pera3", "Peric", "Female", "1234", "2/2/2020", "123", "2112313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); DoctorAppointment appointment1 = new DoctorAppointment(4, new TimeSpan(), "17/05/2020", 1, 1, new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(5, new TimeSpan(), "17/04/2020", 2, 2, new List <Referral>(), "1"); appointments.Add(appointment1); appointments.Add(appointment2); stubRepository.Setup(m => m.GetByid(4)).Returns(appointments.SingleOrDefault(app => app.Id == 4)); stubRepository.Setup(m => m.CancelAppointment(appointment1)).Returns(appointments.SingleOrDefault(app => app.Id == 4)); return(stubRepository.Object); }
public async Task <IActionResult> Create(DoctorUser doctorUser) { Doctors doctors = new Doctors(); if (ModelState.IsValid) { Users user = new Users(); user.Name = doctorUser.Name; user.Email = doctorUser.Email; user.Password = Hashing.CalculateMD5Hash(doctorUser.Password); _context.Add(user); await _context.SaveChangesAsync(); doctors.UserId = user.Id; doctors.Specialization = doctorUser.Specialization; doctors.RegistrationNumber = doctorUser.RegistrationNumber; doctors.Phone = doctorUser.Phone; _context.Add(doctors); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["UserId"] = new SelectList(_context.Users, "Id", "Email", doctors.UserId); return(View(doctors)); }
private static IAppointmentRepository CreateStubRepositoryForNextTwoDays() { var stubRepository = new Mock <IAppointmentRepository>(); var appointments = new List <DoctorAppointment>(); DoctorUser doctor1 = new DoctorUser(1, "Konstantin", "Davidovic", "1234", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DoctorUser doctor2 = new DoctorUser(2, "Novak", "Maric", "12345", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DateTime dt = DateTime.Now.AddDays(1); String date = dt.ToString("dd/MM/yyyy"); PatientUser patient1 = new PatientUser(1, "Pera2", "Peric", "Male", "1234", "2/2/2020", "123", "212313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); PatientUser patient2 = new PatientUser(2, "Pera3", "Peric", "Female", "1234", "2/2/2020", "123", "2112313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); DoctorAppointment appointment1 = new DoctorAppointment(4, new TimeSpan(), date, 1, 1, new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(5, new TimeSpan(), date, 1, 2, new List <Referral>(), "1"); appointments.Add(appointment1); appointments.Add(appointment2); stubRepository.Setup(m => m.GetAppointmentsForPatient(1)).Returns(appointments); return(stubRepository.Object); }
private static IAppointmentRepository CreateStubRepository(int id) { var stubRepository = new Mock <IAppointmentRepository>(); var appointments = new List <DoctorAppointment>(); DoctorUser doctor1 = new DoctorUser(1, "Konstantin", "Davidovic", "1234", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DoctorUser doctor2 = new DoctorUser(2, "Novak", "Maric", "12345", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); PatientUser patient1 = new PatientUser(1, "Pera2", "Peric", "Male", "1234", "2/2/2020", "123", "212313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); PatientUser patient2 = new PatientUser(2, "Pera3", "Peric", "Female", "1234", "2/2/2020", "123", "2112313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); DoctorAppointment appointment1 = new DoctorAppointment(4, new TimeSpan(), "04/02/2019", 1, 1, new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(5, new TimeSpan(), "11/01/2016", 1, 2, new List <Referral>(), "1"); appointments.Add(appointment1); appointments.Add(appointment2); stubRepository.Setup(m => m.GetAppointmentsForPatient(It.IsAny <int>())).Callback((int id) => { } ).Returns(appointments.FindAll(app => app.PatientUserId == id)); return(stubRepository.Object); }
private static ISurveyRepository CreateStubRepository() { var stubRepository = new Mock <ISurveyRepository>(); var surveys = new List <Survey>(); DoctorUser doctor1 = new DoctorUser(1, "Konstantin", "Davidovic", "1234", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DoctorUser doctor2 = new DoctorUser(2, "Novak", "Maric", "12345", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); PatientUser patient1 = new PatientUser(1, "Pera2", "Peric", "Male", "1234", "2/2/2020", "123", "212313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); PatientUser patient2 = new PatientUser(2, "Pera3", "Peric", "Female", "1234", "2/2/2020", "123", "2112313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); DoctorAppointment appointment1 = new DoctorAppointment(4, new TimeSpan(), "04/02/2019", patient1, doctor1, new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(5, new TimeSpan(), "11/01/2016", patient1, doctor2, new List <Referral>(), "1"); Survey survey1 = new Survey(1, 1, 4, appointment1, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 4, 3, 3, 2, 2, 5); Survey survey2 = new Survey(1, 1, 5, appointment2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 4, 3, 3, 2, 2, 5); surveys.Add(survey1); surveys.Add(survey2); stubRepository.Setup(m => m.GetAll()).Returns(surveys); return(stubRepository.Object); }
public Appointment(int id, TimeSpan start, string date, PatientUser patient, DoctorUser doctor, string roomid) : base(id) { Doctor = doctor; Start = start; Date = date; Patient = patient; RoomId = roomid; }
private bool isScheduleForDoctor(Schedule schedule, DoctorUser doctor) { if (schedule.EmployeeId == doctor.id) { return(true); } return(false); }
private Shift getScheduleShiftForDoctor(DoctorUser doctor, string date, Schedule schedule) { if (isScheduleForDoctor(schedule, doctor) && schedule.date.Equals(date)) { return(schedule.shift); } return(null); }
private bool isScheduleForDoctor(Schedule schedule, DoctorUser doctor) { if (schedule.employeeid.Equals(doctor.id.ToString())) { return(true); } return(false); }
public Appointment(int doctorUserId, DoctorUser doctor, TimeSpan start, string date, int patientUserId, PatientUser patient, string roomid) { DoctorUserId = doctorUserId; Doctor = doctor; Start = start; Date = date; PatientUserId = patientUserId; Patient = patient; RoomId = roomid; }
private DoctorAppointment GetNewDoctorAppointment(DoctorUser doctor, DateTime date, TimeSpan time1, PatientUser patient, Shift doctorShift) { for (var time = GetStartTimeSpan(doctorShift); time < GetEndTimeSpan(doctorShift); time = time.Add(time1)) { if (IsTermNotAvailable(doctor, time, MakeStringFromDate(date), patient) == false) { return(new DoctorAppointment(0, time, MakeStringFromDate(date), patient, doctor, null, doctor.ordination)); } } return(null); }
private DoctorAppointment GetAvailableTerm(DoctorUser doctor, DateTime date, TimeSpan time1, PatientUser patient) { Shift doctorShift = employeesScheduleService.getShiftForDoctorForSpecificDay(MakeStringFromDate(date), doctor); if (doctorShift != null && doctorShift.startTime != null && doctorShift.endTime != null) { return(GetNewDoctorAppointment(doctor, date, time1, patient, doctorShift)); } return(null); }
public SurveyDoctorAverageDto(DoctorUser doctor, double doctorAverage, double doctorsProfessionalismAverage, double doctorsPolitenessAverage, double doctorsTechnicalityAverage, double doctorsSkillAverage, double doctorsKnowledgeAverage, double doctorsWorkingPaceAverage) { Doctor = doctor; DoctorAverage = doctorAverage; DoctorsProfessionalismAverage = doctorsProfessionalismAverage; DoctorsPolitenessAverage = doctorsPolitenessAverage; DoctorsTechnicalityAverage = doctorsTechnicalityAverage; DoctorsSkillAverage = doctorsSkillAverage; DoctorsKnowledgeAverage = doctorsKnowledgeAverage; DoctorsWorkingPaceAverage = doctorsWorkingPaceAverage; }
public Boolean IsTermNotAvailable(DoctorUser doctor, TimeSpan time, String dateToString, PatientUser patient) { Boolean hasAppointmentDoctor = doctorService.DoesDoctorHaveAnAppointmentAtSpecificTime(doctor, time, dateToString); Boolean hasOperationDoctor = doctorService.DoesDoctorHaveAnOperationAtSpecificTime(doctor, time, dateToString); if (hasAppointmentDoctor == true || hasOperationDoctor == true) { return(true); } return(false); }
public static void fill() { var JaneDoe = new DoctorUser { FirstName = "Jane", LastName = "Doe", UserName = "******", Email = "*****@*****.**", Address = "123 North Street", PhoneNumber = "911" }; var JohnSmith = new PatientUser { FirstName = "John", LastName = "Smith", UserName = "******", Email = "*****@*****.**", DateOfBirth = "1/1/1992", ZipCode = "34769", Ethnicity = "Cracker", Sex = "Attack Helicopter", Insurance = "None", PhoneNumber = "4071417934" }; }
public Boolean isTermNotAvailable(DoctorUser doctor, TimeSpan start, TimeSpan end, String dateToString, PatientUser patient) { PatientController patientController = new PatientController(); DoctorController doctorController = new DoctorController(); Boolean hasAppointmentDoctor = doctorController.doesDoctorHaveAnAppointmentAtSpecificPeriod(doctor, start, end, dateToString); Boolean hasOperationDoctor = doctorController.doesDoctorHaveAnOperationAtSpecificPerod(doctor, start, end, dateToString); if (hasAppointmentDoctor || hasOperationDoctor) { return(true); } return(false); }
public DoctorAppointment RecommendAnAppointment(DoctorUser doctor, DateTime startDate, DateTime endDate, PatientUser patient) { TimeSpan time1 = TimeSpan.FromMinutes(15); for (var date = startDate; date <= endDate; date = date.AddDays(1)) { if (GetAvailableTerm(doctor, date, time1, patient) != null) { return(GetAvailableTerm(doctor, date, time1, patient)); } } return(null); }
public Boolean isTermNotAvailable(DoctorUser doctor, TimeSpan time, String dateToString, PatientUser patient) { Boolean hasAppointmentDoctor = doctorController.doesDoctorHaveAnAppointmentAtSpecificTime(doctor, time, dateToString); Boolean hasOperationDoctor = doctorController.doesDoctorHaveAnOperationAtSpecificTime(doctor, time, dateToString); Boolean hasAppointmentPatient = patientController.doesPatientHaveAnAppointmentAtSpecificTime(time, dateToString, patient); Boolean hasOperationPatient = patientController.doesPatientHaveAnOperationAtSpecificTime(time, dateToString, patient); if (hasAppointmentDoctor == true || hasAppointmentPatient == true || hasOperationDoctor == true || hasOperationPatient == true) { return(true); } return(false); }
public bool isDoctorWorkingAtSpecifiedTime(string date, DoctorUser doctor, TimeSpan time) { Shift shift = getShiftForDoctorForSpecificDay(date, doctor); int areSelectedTimeAndStartTimeOfShiftEqual = TimeSpan.Compare(time, getStartTime(shift.startTime)); int areSelectedTimeAndEndTimeOfShiftEqual = TimeSpan.Compare(time, getEndTime(shift.endTime)); if ((areSelectedTimeAndStartTimeOfShiftEqual == 1 && areSelectedTimeAndEndTimeOfShiftEqual == -1) || areSelectedTimeAndStartTimeOfShiftEqual == 0) { return(true); } return(false); }
public Shift getShiftForDoctorForSpecificDay(string date, DoctorUser doctor) { if (doctor == null) { return(null); } foreach (Schedule schedule in _employeesScheduleRepository.GetAll()) { if (getScheduleShiftForDoctor(doctor, date, schedule) != null) { return(getScheduleShiftForDoctor(doctor, date, schedule)); } } return(null); }
public Shift getShiftForDoctorForSpecificDay(string date, DoctorUser doctor) { List <Schedule> listOfSchedule = employeesScheduleRepository.GetAll(); foreach (Schedule schedule in listOfSchedule) { Shift scheduleShiftForDoctor = getScheduleShiftForDoctor(doctor, date, schedule); if (scheduleShiftForDoctor != null) { return(scheduleShiftForDoctor); } } return(null); }
private void sendButton_Click(object sender, RoutedEventArgs e) { ListaDoktoriIme name = (ListaDoktoriIme)doctorCombo.SelectedValue; if (name == null) { MessageBox.Show("Please choose the doctor!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } else if (textBloxk.Text.Equals("")) { MessageBox.Show("Please enter the question.", "Error", MessageBoxButton.OK, MessageBoxImage.Error); helpButton.Focus(); return; } else { String imeDr = name.DoctorName; String[] delovi = imeDr.Split(' '); int idDoktor = int.Parse(delovi[2]); DoctorUser doctor = doctorController.GetByid(idDoktor); if (doctor.specialNotifications == null) { doctor.specialNotifications = new List <DoctorNotification>(); } List <DoctorNotification> obavestenja = doctor.specialNotifications; obavestenja.Add(new DoctorNotification("Patient - " + Patient.id + " - " + textBloxk.Text)); doctor.specialNotifications = obavestenja; Boolean isDoctorOk = doctorController.Update(doctor); if (isDoctorOk == false) { } else { MessageBox.Show("Your question is sent."); } } }
public Feedback() { InitializeComponent(); this.DataContext = this; lekar = new DoctorUser(); DoctorController scon = new DoctorController(); List <DoctorUser> lista = scon.GetAll(); cont = new ManagerController(); menadzeri = cont.GetAll(); foreach (DoctorUser s in lista) { if (s.email.Equals(svojstvo)) { lekar = s; } } }
private void confirmButton_Click(object sender, RoutedEventArgs e) { ListaDoktoriIme name = (ListaDoktoriIme)doctorCombo.SelectedValue; if (name == null) { MessageBox.Show("Please choose the doctor!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } else { String imeDr = name.DoctorName; String[] delovi = imeDr.Split(' '); int idDoktor = int.Parse(delovi[2]); DoctorUser doktorUpitnik = doctorController.GetByid(idDoktor); StringBuilder sb = new StringBuilder(); sb.Append("Questionarie: \n"); foreach (Question q in QuestionList) { sb.Append(q.name + " / mark: " + q.answer + "\n"); } DoctorNotification upitnik = new DoctorNotification(sb.ToString()); Console.WriteLine(upitnik); if (doktorUpitnik.specialNotifications == null) { doktorUpitnik.specialNotifications = new List <DoctorNotification>(); } doktorUpitnik.specialNotifications.Add(upitnik); doctorController.Update(doktorUpitnik); MessageBox.Show("Thank you!\nQuestionarie is successfully sent."); } }
private static IDoctorRepository CreateDoctorStubRepository() { var stubRepository = new Mock <IDoctorRepository>(); List <DoctorUser> doctors = new List <DoctorUser>(); DoctorUser doctor1 = new DoctorUser(1, "TestDoctorName1", "TestDoctorNameSurname1", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"); DoctorUser doctor2 = new DoctorUser(2, "TestDoctorName2", "TestDoctorNameSurname2", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Pulmonology", new List <DoctorNotification>(), "Ordination 2"); DoctorUser doctor3 = new DoctorUser(3, "TestDoctorName3", "TestDoctorNameSurname3", "1234", "02/02/2020", "123", "email", "pass", "Grad", 200.0, false, "Cardiology", new List <DoctorNotification>(), "Ordination 2"); doctors.Add(doctor1); doctors.Add(doctor2); doctors.Add(doctor3); stubRepository.Setup(m => m.GetAll()).Returns(doctors); stubRepository.Setup(m => m.GetByid(1)).Returns(doctor1); stubRepository.Setup(m => m.GetByid(2)).Returns(doctor2); stubRepository.Setup(m => m.GetByid(3)).Returns(doctor3); return(stubRepository.Object); }
public ObavestenjaPacijenata() { InitializeComponent(); lekar = new DoctorUser(); cont = new PatientController(); lista = new List <PatientUser>(); lista = cont.GetAll(); Question q = new Question(); DoctorController doctorController = new DoctorController(); List <DoctorUser> listaDoktora = doctorController.GetAll(); foreach (DoctorUser s in listaDoktora) { if (s.email.Equals(svojstvo)) { lekar = s; } } if (pitanja == null) { pitanja = new List <Question>(); } List <DoctorNotification> mojaObavestenja = lekar.specialNotifications; idSvihpacijenta = new List <int>(); foreach (PatientUser pacijent in lista) { idSvihpacijenta.Add(pacijent.id); } Obavestenja.ItemsSource = mojaObavestenja; pacijentid.ItemsSource = idSvihpacijenta; }
public async Task <IActionResult> DoctorRegister(DoctorRegisterViewModel model, string returnUrl = null) { ViewData["ReturnUrl"] = returnUrl; if (ModelState.IsValid) { var user = new DoctorUser { FirstName = model.FirstName, LastName = model.LastName, UserName = model.Email, Email = model.Email, Address = model.Address, PhoneNumber = model.PhoneNumber, AccountType = "Doctor", starttime = model.starttime, endtime = model.endtime }; using (var memoryStream = new MemoryStream()) { await model.UserPhoto.CopyToAsync(memoryStream); user.UserPhoto = memoryStream.ToArray(); } var result = await _userManager.CreateAsync(user, model.Password); if (result.Succeeded) { _logger.LogInformation("User created a new account with password."); var code = await _userManager.GenerateEmailConfirmationTokenAsync(user); var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme); await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl); await _signInManager.SignInAsync(user, isPersistent : false); _logger.LogInformation("User created a new account with password."); return(RedirectToLocal(returnUrl)); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
/// <summary> This method is getting List of <c>DoctorAppointment</c> that matches recoomended filters </summary> /// <param name="dto"><c>RecommendedAppointmentDto</c> is Data Transfer Object that is being used to get Recommended Appointments</param> /// <returns> List of recommended appointments</returns> public List <DoctorAppointment> GetRecommendedAppointment(RecommendedAppointmentDto dto) { DoctorUser doctor = doctorService.GetByid(dto.DoctorId); DateTime startDate = UtilityMethods.ParseDateInCorrectFormat(dto.Start); DateTime endDate = UtilityMethods.ParseDateInCorrectFormat(dto.End); PatientUser patient = _patientRepository.Find(2); //still no login, change after login, id set to 1 List <DoctorAppointment> recomendedAppointments = GetAllAvailableAppointmentsForRecommendedDates(dto.DoctorId, startDate, endDate, patient.id); if (!recomendedAppointments.Any()) { if (dto.Priority.Equals("doctor")) { endDate = (endDate - startDate).TotalDays > 20 ? endDate.AddDays(10) : (endDate - startDate).TotalDays > 10 ? endDate.AddDays(5) : endDate.AddDays(3); recomendedAppointments = GetAllAvailableAppointmentsForRecommendedDates(dto.DoctorId, startDate, endDate, patient.id); } else { recomendedAppointments = RecommenedAnAppointmentDatePriority(startDate, endDate, patient, doctor.speciality); } } return(recomendedAppointments); }
private static IAppointmentRepository CreateStubRepository() { var stubRepository = new Mock <IAppointmentRepository>(); var appointments = new List <DoctorAppointment>(); DateTime dt = DateTime.Now.AddDays(10); String date = dt.ToString("dd/MM/yyyy"); DoctorUser doctor1 = new DoctorUser(1, "Konstantin", "Davidovic", "1234", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); DoctorUser doctor2 = new DoctorUser(2, "Novak", "Maric", "12345", "2/2/2020", "123", "email", "pass", "Grad", 200.0, false, "Specialty", new List <DoctorNotification>(), "Ordination 1"); PatientUser patient1 = new PatientUser(1, "Pera2", "Peric", "Male", "1234", "2/2/2020", "123", "212313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); PatientUser patient2 = new PatientUser(2, "Pera3", "Peric", "Female", "1234", "2/2/2020", "123", "2112313", "Alergija", "Grad", false, "email", "pass", false, "Grad2", "Roditelj", null); DoctorAppointment appointment1 = new DoctorAppointment(4, new TimeSpan(), date, 1, 1, new List <Referral>(), "1"); DoctorAppointment appointment2 = new DoctorAppointment(5, new TimeSpan(), date, 2, 2, new List <Referral>(), "1"); appointments.Add(appointment1); appointments.Add(appointment2); stubRepository.Setup(m => m.GetByid(4)).Returns(appointments.SingleOrDefault(app => app.Id == 4)); stubRepository.Setup(m => m.CancelAppointment(It.IsAny <DoctorAppointment>())).Callback((DoctorAppointment appointment) => { DoctorAppointment app = (appointments.SingleOrDefault(app => app.Id == 4)); app.IsCanceled = true; } ).Returns(appointment1); return(stubRepository.Object); }
public Boolean isTermNotAvailable(DoctorUser doctor, TimeSpan start, TimeSpan end, String dateToString, PatientUser patient) { return(operationService.isTermNotAvailable(doctor, start, end, dateToString, patient)); }