private void PrintDocument_PrintPage(object sender, PrintPageEventArgs e) { Graphics g = e.Graphics; g.DrawImage(Resources.logo1, new Point(offsetX, offsetY)); int titleOffset = offsetX; Font font = new Font("Arial", 20); Brush brush = Brushes.Black; //g.DrawString("Over Surgery", font, brush, titleOffset, offsetY); float imageHeightPrint = Resources.logo1.Height / Resources.logo1.VerticalResolution * 100; offsetY += (int)imageHeightPrint; font = new Font("Arial", 16); int stringHeight = (int)g.MeasureString("Over Surgery", font).Height; StaffFactory sf = new StaffFactory(dbCon); PatientFactory pf = new PatientFactory(dbCon); Staff s = sf.GetStaffByID(a.StaffId)[0]; Patient p = pf.GetPatientsByID(a.PatientId)[0]; string s1 = "You have an appointment booked to see: "; string s2 = $"{s.JobRole} {s.FirstName} {s.LastName} on "; string s3 = $"{a.AppointmentDate.ToShortDateString()} at {a.AppointmentTime.ToShortTimeString()}"; string s4 = "If you cannot attend please contact reception to cancel."; AddAllStringsTo(g, font, brush, titleOffset, offsetY, stringHeight, s1, s2, s3, s4); }
public void CreatePatient_GivenValidParameters_PatientIsMadePersistent() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var isPersistent = false; var patientRepositoryMock = new Mock <IPatientRepository>(); patientRepositoryMock .Setup(p => p.MakePersistent(It.IsAny <Patient>())) .Callback(() => isPersistent = true); var agency = new Mock <Agency>(); var patientUniqueIdentifierCalculatorMock = new Mock <IPatientUniqueIdentifierGenerator>(); var patientFactory = new PatientFactory( patientRepositoryMock.Object, patientUniqueIdentifierCalculatorMock.Object); // Exercise patientFactory.CreatePatient(agency.Object, CreateValidName(), ValidPatientProfile()); // Verify Assert.IsTrue(isPersistent); } }
public void CreatePatient_GivenValidParameters_ValidationFailureEventIsNotRaised() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); bool eventRaised = false; DomainEvent.Register <RuleViolationEvent>(p => eventRaised = true); var patientRepositoryMock = new Mock <IPatientRepository>(); var agency = new Mock <Agency>(); var patientUniqueIdentifierCalculatorMock = new Mock <IPatientUniqueIdentifierGenerator>(); var patientFactory = new PatientFactory( patientRepositoryMock.Object, patientUniqueIdentifierCalculatorMock.Object); // Exercise patientFactory.CreatePatient(agency.Object, CreateValidName(), ValidPatientProfile()); // Verify Assert.IsFalse(eventRaised); } }
public void TestMethod1() { PatientFactory pf = new PatientFactory(con); List <Patient> patients = pf.GetPatients(); Assert.AreEqual(patients.Count, 200); }
public RegisterNewPatientForm(Patient p, PatientFactory pf, ReceptionistForm parent) { InitializeComponent(); this.p = p; this.pf = pf; this.parent = parent; if (p != null) { nhsNumbertextBox1.Text = p.NHSNumber; patientFirstNameTextBox.Text = p.FirstName; patientLastNameTextBox.Text = p.LastName; patientAddressTextBox.Text = p.Address; postcodetextBox2.Text = p.Postcode; patientNextOfKinTextBox.Text = p.NextOfKin; dateTimePicker1.Value = p.DOB; maleradioButton1.Checked = p.Gender.Contains("Male"); religiontextBox3.Text = p.Religion; patientEmailTextBox.Text = p.Email; patientContactNumberTextBox.Text = p.Phone; this.Text = "Edit Patient Details"; } compulsoryFields[0] = nhsNumbertextBox1; compulsoryFields[1] = patientFirstNameTextBox; compulsoryFields[2] = patientLastNameTextBox; compulsoryFields[3] = patientAddressTextBox; compulsoryFields[4] = postcodetextBox2; compulsoryFields[5] = patientNextOfKinTextBox; compulsoryFields[6] = patientContactNumberTextBox; }
public void CreatePatient_GivenValidParameters_PatientIsMadePersistent2() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); string uniqueIdentifier = "unique identifier"; var patientRepositoryMock = new Mock <IPatientRepository>(); var agency = new Mock <Agency>(); var patientUniqueIdentifierCalculatorMock = new Mock <IPatientUniqueIdentifierGenerator>(); patientUniqueIdentifierCalculatorMock .Setup(p => p.GenerateUniqueIdentifier(It.IsAny <Patient> ())) .Returns(() => uniqueIdentifier); var patientFactory = new PatientFactory( patientRepositoryMock.Object, patientUniqueIdentifierCalculatorMock.Object); // Exercise var patient = patientFactory.CreatePatient(agency.Object, CreateValidName(), ValidPatientProfile()); // Verify Assert.AreSame(uniqueIdentifier, patient.UniqueIdentifier, "Patient uniqueIdentifier is not assigned correctly."); } }
public void Handle_GivenValidPatientInfo_ReturnsPatientDtoThatWasSavedInDB() { var patientRepository = new PatientRepository(SessionProvider); var patientFactory = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator()); var dtoToDomainMappingHelper = new DtoToDomainMappingHelper(new LookupValueRepository(SessionProvider)); var handler = new CreateNewPatientRequestHandler(dtoToDomainMappingHelper, patientFactory) { SessionProvider = SessionProvider }; // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request Request request = new CreateNewPatientRequest { AgencyKey = SafeHarborAgency.Key, BirthDate = new DateTime(1983, 8, 29), FirstName = "John", Gender = new LookupValueDto { WellKnownName = MaleGender.WellKnownName, Key = MaleGender.Key, Name = MaleGender.Name }, LastName = "Smith", MiddleName = "Middle" }; var response = handler.Handle(request) as CreateNewPatientResponse; Assert.IsTrue(response.PatientDto.Key > 0); }
private static void AddAdditionalData(Guid organizationkey, Role portalRole, Guid staffKey, List <AssessmentDefinitionDto> assessmentDefinitionDtos) { var patientFactory = new PatientFactory(); { //// How to add a new patient var patient = patientFactory.Create(organizationkey, new PersonName("Billy", "", "Bob"), DateTime.Parse("02/05/1965"), Gender.Male, new Email("*****@*****.**")); Console.WriteLine("Added patient: {0} {1} ......", patient.Name.FirstName, patient.Name.LastName); //// How to assign this patient an account AssignPatientToPortal(portalRole, organizationkey, patient); assessmentDefinitionDtos.ForEach(dto => CreateAssessmentForPatient(GetAssessmentDefinitionByKey(dto.Key), patient)); //// How to assign a reminder to this patient AddAssessmentReminderForPatient( assessmentDefinitionDtos.First(f => f.AssessmentCode == "1000000").Key, organizationkey, patient.Key, staffKey, "Test Reminder", "Reminder Description", "*****@*****.**", DateTime.Now, DateTime.Now.AddDays(4), AssessmentReminderRecurrence.Daily, AssessmentReminderUnit.Days); } }
public async Task <IEnumerable <Patient> > GetPatientsRepositoryAsync(PatientsType patientsType) { PatientFactory patientFactory = new PatientFactory(_context); var patients = await patientFactory.GetPatientAsync(patientsType); return(patients); }
public void TestCreateAndReturnObjData() { PatientClassesEnumeration testClassesEnumeration = PatientClassesEnumeration.PatientData; IPatientFactory testFactory = new PatientFactory(); testFactory.CreateAndReturnObj(testClassesEnumeration); Assert.IsNotNull(testFactory); }
static Initializer() { doctorFactory = new DoctorFactory(); patientFactory = new PatientFactory(); analgeticFactory = new AnalgeticFactory(); antisepticFactory = new AntisepticFactory(); febrifugeFactory = new FebrifugeFactory(); }
public void TestMethod2() { PatientFactory pf = new PatientFactory(con); Patient p = pf.GetPatientsByID(200)[0]; Assert.AreEqual(p.FirstName, "Trenna"); Assert.AreEqual(p.LastName, "Clayfield"); }
public void RunNullExecptiontestoPass() { appointmentClass = new AppointmentSort(dbCon); infoFac = new PatientFactory(dbCon); appointment = null; nextPatientret = infoFac.GetAPatientByID(appointment.PatientId); appointmentClass.removeAppointment(); }
/// <summary> /// This function initialises this class(important) /// </summary> /// <param name="dbCon"></param> public void InitClass(DBConnection dbCon) { this.dbCon = dbCon; medicalNote = new MedicalNoteFactory(dbCon); infoFac = new PatientFactory(dbCon); prescriptionFactory = new PrescriptionFactory(dbCon); test = new TestResultFactory(dbCon); medicationFactory = new MedicineInFactory(dbCon); appointmentClass = new AppointmentSort(dbCon); }
/** * initialises constructor * include time,database components * */ public void Init(DBConnection dbCon) { this.dbCon = dbCon; infoFac = new PatientFactory(dbCon); Timer timer1 = new Timer(); timer1.Start( ); converter = new DatabaseConverter(dbCon); prescriptonForm = new AddPrescription(dbCon, this); }
public CaseService() { specimenRepository = SpecimenRepository.Instance; specimenFactory = SpecimenFactory.Instance; requestorRepository = RequestorRepository.Instance; requestorFactory = RequestorFactory.Instance; patientRepository = PatientRepository.Instance; patientFactory = PatientFactory.Instance; caseRepository = CaseRepository.Instance; caseFactory = CaseFactory.Instance; slideFactory = SlideFactory.Instance; slideRepository = SlideRepository.Instance; }
public void DestroyPatient_GivenAPatient_ThrowsNotImplementedException() { // Setup var patientRepositoryMock = new Mock <IPatientRepository> (); var patientUniqueIdentifierCalculatorMock = new Mock <IPatientUniqueIdentifierGenerator>(); var patientFactory = new PatientFactory( patientRepositoryMock.Object, patientUniqueIdentifierCalculatorMock.Object); var patient = new Mock <Patient> (); // Exercise patientFactory.DestroyPatient(patient.Object); // Verify }
private static Guid AddPatients(Guid organizationkey) { Guid patientKey; var patientFacory = new PatientFactory(); { var patient = patientFacory.Create(organizationkey, new PersonName("O-Ren", "Z", "Ishii"), DateTime.Parse("01/01/1954"), Gender.Female); Console.WriteLine("Added patient: {0} {1} ......", patient.Name.FirstName, patient.Name.LastName); patientKey = patient.Key; } { var patient = patientFacory.Create(organizationkey, new PersonName("John", "B", "Smith"), DateTime.Parse("01/01/1983"), Gender.Male); Console.WriteLine("Added patient: {0} {1} ......", patient.Name.FirstName, patient.Name.LastName); } return(patientKey); }
private static List <Patient> AddPatients(Guid organizationkey) { var patientKeys = new List <Patient> (); var patientFactory = new PatientFactory(); { var patient = patientFactory.Create(organizationkey, new PersonName("O-Ren", "Z", "Ishii"), DateTime.Parse("01/01/1954"), Gender.Female, new Email("*****@*****.**")); Console.WriteLine("Added patient: {0} {1} ......", patient.Name.FirstName, patient.Name.LastName); patientKeys.Add(patient); } { var patient = patientFactory.Create(organizationkey, new PersonName("John", "B", "Smith"), DateTime.Parse("01/01/1983"), Gender.Male); Console.WriteLine("Added patient: {0} {1} ......", patient.Name.FirstName, patient.Name.LastName); patientKeys.Add(patient); } return(patientKeys); }
public ReceptionistForm(DBConnection dbCon) { InitializeComponent(); this.dbCon = dbCon; infoFac = new PatientFactory(dbCon); this.dataGridView1.SelectionChanged += dataGridView1_SelectionChanged; this.Load += ReceptionistForm_Load; this.selectedAppointments = new List <Appointment>(); af = new AppointmentFactory(dbCon); sf = new StaffFactory(dbCon); this.firstNameTextbox.KeyUp += FirstNameTextbox_KeyUp; this.lastNameTextbox.KeyUp += FirstNameTextbox_KeyUp; this.tabControl1.SelectedIndexChanged += TabControl1_SelectedIndexChanged; this.seerotadateTimePicker1.KeyUp += SeerotadateTimePicker1_KeyUp; this.d1 = DateTime.Now; this.d2 = DateTime.Now; }
public void Handle_GivenInValidPatientInfo_ThrowsException() { var patientRepository = new PatientRepository(SessionProvider); var patientFactory = new PatientFactory(patientRepository, new PatientUniqueIdentifierGenerator()); var dtoToDomainMappingHelper = new DtoToDomainMappingHelper(new LookupValueRepository(SessionProvider)); var handler = new CreateNewPatientRequestHandler(dtoToDomainMappingHelper, patientFactory) { SessionProvider = SessionProvider }; // When you do Agatha Request Handler testing, always declare the request as the base class type Agatha.Common.Request Request request = new CreateNewPatientRequest { AgencyKey = SafeHarborAgency.Key }; handler.Handle(request); }
public AddAppointmentForm(DBConnection dbCon, int staffID, int patientID, Appointment app, ReceptionistForm parent, bool editMode) { InitializeComponent(); this.dbCon = dbCon; this.pf = new PatientFactory(dbCon); this.sf = new StaffFactory(dbCon); this.af = new AppointmentFactory(dbCon); this.staffID = staffID; this.patientID = patientID; this.app = app; this.parent = parent; this.KeyUp += AddAppointmentForm_KeyUp; this.editMode = editMode; if (editMode) { this.Text = "Edit Appointment Details"; } QueryBuilder b = new QueryBuilder(); b.Select(Tables.ALL).From(Tables.STAFF_TABLE).Where(b.IsEqual(Tables.STAFF_TABLE.JobRole, "Doctor"), b.Or(), b.IsEqual(Tables.STAFF_TABLE.JobRole, "Nurse")); patients = pf.GetPatients(); staff = sf.GetStaff(b); if (editMode) { staff = sf.GetStaffByID(staffID); patients = pf.GetPatientsByID(patientID); firstnametextBox1.Visible = false; lastnametextBox2.Visible = false; findPatientButton.Visible = false; } else { this.statusComboBox.Enabled = false; } ctf = new CustomTableFactory(dbCon); this.statusComboBox.SelectedIndex = 0; PopulateComboBoxes(); }
public void CreatePatient_GivenPatientProfileWithNullPatientGender_PatientIsNotCreated() { using (var serviceLocatorFixture = new ServiceLocatorFixture()) { // Setup SetupServiceLocatorFixture(serviceLocatorFixture); var agency = new Mock <Agency>(); var patientRepositoryMock = new Mock <IPatientRepository>(); var patientUniqueIdentifierCalculatorMock = new Mock <IPatientUniqueIdentifierGenerator>(); var patientFactory = new PatientFactory( patientRepositoryMock.Object, patientUniqueIdentifierCalculatorMock.Object); // Exercise var patient = patientFactory.CreatePatient(agency.Object, CreateValidName(), InvalidPatientProfileWithNullPatientGender()); // Verify Assert.IsNull(patient); } }
public IPatient GetDataByIdentifier <IDType> (IDType _id) { string data = Storage.FindLine($"PatientID{_id}"); IPatient patient = null; if (data != null) { patient = PatientFactory.CreateEmpty(); try { patient.BuildEntity(data); } catch (Exception _e) { Debug.LogError(_e); throw; } } return(patient); }
/// <summary> /// Handles the specified request. /// </summary> /// <param name="request">The request.</param> /// <param name="response">The response.</param> protected override void Handle(CreatePatientRequest request, SaveDtoResponse <PatientDto> response) { var patientFactory = new PatientFactory(); var patient = patientFactory.Create(request.PatientDto.OrganizationKey, request.PatientDto.Name, request.PatientDto.DateOfBirth, _lookupProvider.Find <Gender> (request.PatientDto.Gender.Code)); if (patient != null) { if (request.PatientDto.Religion != null && !string.IsNullOrEmpty(request.PatientDto.Religion.Code)) { patient.ReviseReligion(_lookupProvider.Find <Religion> (request.PatientDto.Religion.Code)); } if (request.PatientDto.Ethnicity != null && !string.IsNullOrEmpty(request.PatientDto.Ethnicity.Code)) { patient.ReviseEthnicity(_lookupProvider.Find <Ethnicity> (request.PatientDto.Ethnicity.Code)); } var patientDto = Mapper.Map <Patient, PatientDto> (patient); response.DataTransferObject = patientDto; } }
private void button6_Click(object sender, EventArgs e) { if (appointmentDataGridView.SelectedRows.Count > 0) { int rowNum = appointmentDataGridView.CurrentCell.RowIndex; string docFName = appointmentDataGridView.Rows[rowNum].Cells[0].Value.ToString(); string docLName = appointmentDataGridView.Rows[rowNum].Cells[1].Value.ToString(); string patFName = appointmentDataGridView.Rows[rowNum].Cells[2].Value.ToString(); string patLName = appointmentDataGridView.Rows[rowNum].Cells[3].Value.ToString(); StaffFactory sf = new StaffFactory(dbCon); PatientFactory pf = new PatientFactory(dbCon); int staffID = sf.GetStaffByName(docFName, docLName)[0].ID; int patientID = pf.GetPatientsByName(patFName, patLName)[0].ID; AddAppointmentForm aaf = new AddAppointmentForm(dbCon, staffID, patientID, selectedAppointments[rowNum], this, true); //aaf.staffIDTextBox.Text = docFName + " " + docLName; //aaf.patientIDTextBox.Text = patFName + " " + patLName; //aaf.staffIDTextBox.Enabled = false; //aaf.patientIDTextBox.Enabled = false; aaf.dateTimePicker1.Value = (DateTime)appointmentDataGridView.Rows[rowNum].Cells[4].Value; // aaf.dateTimePicker2.Format = DateTimePickerFormat.Custom; //aaf.dateTimePicker2.CustomFormat = "HH:mm tt"; // aaf.dateTimePicker2.Value = aaf.dateTimePicker2.Value.Date + (TimeSpan) appointmentDataGridView.Rows[rowNum].Cells[5].Value; Log.WriteLine("Time object is: " + appointmentDataGridView.Rows[rowNum].Cells[5].Value); aaf.statusComboBox.Text = appointmentDataGridView.Rows[rowNum].Cells[6].Value.ToString(); aaf.causeTextBox.Text = appointmentDataGridView.Rows[rowNum].Cells[7].Value.ToString(); Log.WriteLine("Index of selected timeslot is: " + aaf.timeslotcomboBox1.Items.IndexOf(appointmentDataGridView.Rows[rowNum].Cells[5].Value)); aaf.timeslotcomboBox1.SelectedIndex = aaf.timeslotcomboBox1.FindStringExact(appointmentDataGridView.Rows[rowNum].Cells[5].Value.ToString()); aaf.ValidateTimeslots(); aaf.Show(); } else { MessageBox.Show("No appointment selected.", "Please Select an Appointment"); } }
public void CanCreatePregnancyJournalFromPatient() { // Arrange string expectedSSN = "MyChildsFathersSocialSecurityNumber"; int expectedID = currentIDIndex; IPregnancyJournal pJournal; IPatient patient = PatientFactory.CreateEmpty(); patient.ChildFathersSSN = expectedSSN; bool notNull; bool correctID; bool correctSSN; // Act pJournal = JournalFactory.CreateWithPatient(JournalType.PregnancyJournal, patient) as IPregnancyJournal; notNull = pJournal != null; correctID = pJournal.ID == expectedID; correctSSN = pJournal.PatientData.ChildFathersSSN == expectedSSN; // Assert Assert.True((notNull && correctID), $"Is Null: {!notNull} {{Value: {!notNull} | Expected: {false}}}<|> Correct ID: {correctID} {{Value: {( ( notNull ) ? ( pJournal.ID.ToString () ) : ( "NaN" ) )} | Expected: {expectedID}}} <|> CorrectSSN: {correctSSN} {{Value: {pJournal.PatientData.ChildFathersSSN} | Expected: {expectedSSN}}}"); currentIDIndex++; // Incrementing the ID index in case another journal is created after this test }
public IEnumerable <IPatient> GetEnumerable() { List <IPatient> patients = new List <IPatient> (); foreach (string dataStream in Storage.ReadLines()) // Read all lines in storage file, and build a patient from it { if (dataStream != string.Empty) { IPatient patient = PatientFactory.CreateEmpty(); try { patient.BuildEntity(dataStream); } catch (Exception _e) { Debug.LogWarning(_e.ToString()); } patients.Add(patient); } } return(patients); }
/// <summary> Event handler. Called by SubmitBtn for click events. /// Will attempt to submit a patient or give an error </summary> /// /// <param name="sender"> Source of the event. </param> /// <param name="e"> Routed event information. </param> private void SubmitBtn_Click(object sender, RoutedEventArgs e) { SubmitError.Visibility = Visibility.Hidden; //Hide the error initally int patientLength = 13; string[] patient = new string[patientLength]; //A string to create a patient. if (CanSubmit()) //If all required items were inputted { //Fill a list with patient details. patient[0] = hcnTextBox.Text; patient[1] = lNameTextBox.Text; patient[2] = fNameTextBox.Text; patient[3] = mInitialTextBox.Text; patient[4] = dobPicker.Text; patient[5] = Gender; patient[6] = headOfHousehold; patient[7] = addressOne; patient[8] = addressTwo; patient[9] = city; patient[10] = postalCode; patient[11] = prov; patient[12] = phoneNum; //See if it is a HOH or dependant PatientFactory.Create(patient).Add(); MessageBox.Show("Patients Added Successfully"); ResetBoxes(); } else { //Something was not entered.. Do not submit. Show error. SubmitError.Visibility = Visibility.Visible; } }
public PatientService() { patientRepository = PatientRepository.Instance; patientFactory = PatientFactory.Instance; }