/// <summary> /// Gets the nurse with the provided id. /// </summary> /// <returns></returns> public async Task <User> GetUser() { var nursedal = new NurseDAL(); var nurse = await nursedal.GetNurse(this.id); return(nurse); }
/// <see cref="NurseDAL.IsThisNurseTheNurseOfTheVisit(UserDTO, VisitDTO)"/> public bool IsThisNurseTheNurseOfTheVisit(UserDTO currentUser, VisitDTO visit) { if (currentUser == null || visit == null || visit.ID == null) { throw new ArgumentNullException("currentUser, visit, and visitID cannot be null"); } return(NurseDAL.IsThisNurseTheNurseOfTheVisit(currentUser, visit)); }
/// <summary> /// Updates the given Nurse and their information in the db /// </summary> /// <param name="person">The Person of the Nurse to update</param> /// <param name="address">The Address of the Nurse to update</param> /// <param name="nurse">The Nurse to update</param> /// <returns>Whether or not the update succeeded</returns> public bool UpdateNurse(Person person, Address address, Nurse nurse) { using (TransactionScope scope = new TransactionScope()) { AddressDAL.UpdateAddress(address); PersonDAL.UpdatePerson(person); NurseDAL.UpdateNurse(nurse); scope.Complete(); } return(true); }
/// <summary> /// Initalizes DAL objects /// </summary> public HealthcareController() { visitDAL = new VisitDAL(); appointmentDAL = new AppointmentDAL(); doctorDAL = new DoctorDAL(); personDAL = new PersonDAL(); loginDAL = new LoginDAL(); patientDAL = new PatientDAL(); nurseDAL = new NurseDAL(); testDAL = new TestDAL(); specialtyDAL = new SpecialityDAL(); }
private async void finishEdit(object sender, RoutedEventArgs e) { try { this.ring.IsActive = true; var patientDal = new PatientDAL(); var nurseDal = new NurseDAL(); var appointDal = new AppointmentDAL(); var vm = new RoutineCheckupViewModel(); var appnt = await appointDal.GetAppointmentById(this.AppointmentID); var patient = await patientDal.GetPatientById(this.PatientId); var nurse = await nurseDal.GetNurseByNurseId(this.NurseId); var date = this.CheckupDate.Date.AddHours(this.CheckupTime.Hours).AddMinutes(this.CheckupTime.Minutes); var sys = !string.IsNullOrWhiteSpace(this.SystolicReading.ToString()) ? this.SystolicReading : throw new ArgumentException("The Systolic Reading cannot be empty."); var dbp = !string.IsNullOrWhiteSpace(this.DiastolicBloodPressure.ToString()) ? this.DiastolicBloodPressure : throw new ArgumentException("The blood pressure cannot be empty."); var weght = !string.IsNullOrWhiteSpace(this.Weight.ToString()) ? this.Weight : throw new ArgumentException("The weight cannot be empty"); var tep = !string.IsNullOrWhiteSpace(this.Temperature.ToString()) ? this.Temperature : throw new ArgumentException("The tmeperature cannot be empty"); var diag = !string.IsNullOrWhiteSpace(this.InitialDiagnosis) ? this.InitialDiagnosis : throw new ArgumentException("The initial diaggnosis cannot be empty"); var checkup = new RoutineCheck(appnt, nurse, patient, date, sys, dbp, weght, tep, diag); await vm.EditCheckup(checkup); this.Editing(false); this.ChangesMade = true; } catch (Exception ex) { this.ring.IsActive = false; this.error.Text = ex.Message; await Task.Delay(4000); this.error.Text = ""; } this.ring.IsActive = false; }
/// <summary> /// Inserts a new Patient with their data into the db. /// </summary> /// <param name="patient">Person of Patient to insert</param> /// <param name="address">Address of Patient to insert</param> /// <returns>Whether or not the insertion succeeded</returns> public bool RegisterNurse(Person nurse, Address address) { if (nurse == null || address == null) { throw new ArgumentNullException("nurse and address cannot be null"); } using (TransactionScope scope = new TransactionScope()) { int?addressID = AddressDAL.InsertAddress(address); int?personID = PersonDAL.InsertPerson(new Person(null, nurse.Username, nurse.Password, nurse.FirstName, nurse.LastName, nurse.DateOfBirth, nurse.SSN, nurse.Gender, addressID, nurse.ContactPhone)); NurseDAL.InsertNurse(new Nurse(null, personID, true)); scope.Complete(); } return(true); }
/// <summary> /// Inserts new user in DB /// </summary> private void registerUserButton_Click(object sender, EventArgs e) { try { if (this.areEntryFieldsValid()) { var nurse = this.buildNurse(); NurseDAL.InsertNurse(nurse, Security.HashPassword(nurse.Username, this.passwordTextBox.Text)); this.resetFields(); this.showNurseRegisteredMessage(nurse); } } catch (Exception err) { ExceptionMessage.ShowError(err); } }
private void handleLogin() { this.Nurse = NurseDAL.GetNurse(this.usernameTextBox.Text); if (this.IsAdminLoginPage & !this.Nurse.IsAdmin) { this.showDeniedAccessMessage(); } else if (this.IsAdminLoginPage & this.Nurse.IsAdmin) { this.Hide(); this.displayAdminMainPage(); } else { this.Hide(); this.displayUserMainPage(); } }
private async void addCheckup(object sender, RoutedEventArgs e) { this.ring.IsActive = true; try { var aId = int.Parse(this.aID.Text); var nId = int.Parse(this.nID.Text); var time = this.timeicker.Time; var date = this.datePicker.Date.Date.AddHours(time.Hours).AddMinutes(time.Minutes); var sys = int.Parse(this.sysReadind.Text); var bPr = int.Parse(this.bPressure.Text); var _weight = double.Parse(this.weight.Text); var temp = double.Parse(this.temp.Text); var ini = this.summaryTextBox.Text; var appointmentdal = new AppointmentDAL(); var appointment = await appointmentdal.GetAppointmentById(aId); var nursedal = new NurseDAL(); var nurse = await nursedal.GetNurseByNurseId(nId); var checkup = new RoutineCheck(appointment, nurse, appointment.Patient, date, sys, bPr, _weight, temp, ini); await this.viewModel.AddCheckup(checkup); await this.viewModel.LoadAllAppointments(); var confirmBox = new MessageDialog($"CheckUp completed {date.ToShortDateString()}"); this.ring.IsActive = false; await confirmBox.ShowAsync(); } catch (Exception ex) { this.ring.IsActive = false; var messageDialog = new MessageDialog(ex.Message); await messageDialog.ShowAsync(); } }
/// <summary> /// Constructor for the PatientController class. /// </summary> public NurseController() { this.nurseSource = new NurseDAL(); }
/// <summary> /// /// </summary> /// <returns></returns> public List <UserDTO> GetAllNurse() { return(NurseDAL.GetAllNurse(AuthenticationHelper.currentUser)); }
/// <see cref="NurseDAL.GetNurses"/> public List <Nurse> GetNurses() { return(NurseDAL.GetNurses()); }
/// <summary> /// Returns the nurse with an Id eqaul to the accepted value /// </summary> /// <param name="selectedNurseID">Nurse ID number</param> /// <returns>Nurse object</returns> public Nurse GetNurseById(int selectedNurseID) { return(NurseDAL.GetNurseByID(selectedNurseID)); }