public MessuresViewModel(RoothCalculationEntity roothModel, MouthCalculationEntity mouseModel, PatientInformation patientModel) { this.roothModel = roothModel; this.mouseModel = mouseModel; this.patientModel = patientModel; this.patientModel.DateMessure = patientModel.DateMessure.Equals(DateTime.MinValue) ? DateTime.Now : patientModel.DateMessure; }
public void Update(Patient patient) { IQueryable <PatientInformation> apatient = from patients in patientDC.PatientInformations where (patients.Id == patient.Id) select patients; bool insert = false; try { pi = apatient.Single <PatientInformation>(); } catch (Exception ex) { insert = true; ex.GetHashCode(); } pi.FirstName = patient.FirstName; pi.LastName = patient.LastName; pi.BirthDate = dataEncryptionAlgorithm.EncryptData(patient.Birthday); pi.TelephoneNumber = dataEncryptionAlgorithm.EncryptData(patient.PhoneNumber); pi.EmailAddress = dataEncryptionAlgorithm.EncryptData(patient.Email); if (insert) { patientDC.PatientInformations.InsertOnSubmit(pi); patientDC.SubmitChanges(); } else { patientDC.SubmitChanges(); } }
public IActionResult PatientInformationAdd(HastalikTakibi.Models.PatientInformationVM patientInformation) { if (patientInformation == null || patientInformation.DiseaseId <= 0 || patientInformation.PatientId <= 0) { ViewBag.eror = "zorunlu alanları doldurunuz"; int categoryId = SetCategory(); SetDisease(categoryId); int plateNumber = SetProvince(); SetDistrict(plateNumber); return(View(patientInformation)); } var patientknownDb = new PatientInformation() { PatientId = patientInformation.PatientId, DiseaseId = patientInformation.DiseaseId, WhenIll = patientInformation.WhenIll, RecoveryTime = patientInformation.RecoveryTime, ProvinceId = patientInformation.ProvinceId, DistrictId = patientInformation.DistrictId, Latitude = patientInformation.Latitude, Longitude = patientInformation.Longitude, Symptoms = patientInformation.Symptoms, CategoryId = patientInformation.CategoryId }; _hastlikTakipDbContext.PatientInformation.Add(patientknownDb); _hastlikTakipDbContext.SaveChangesAsync().GetAwaiter().GetResult(); return(RedirectToAction("PatientInformation", new { id = patientknownDb.PatientId })); }
public void SaveStudy(DicomStudy study, PatientInformation patient) { if (study == null) { throw new ArgumentNullException(nameof(study)); } if (patient == null) { throw new ArgumentNullException(nameof(patient)); } if (string.IsNullOrWhiteSpace(patient.PatientKey)) { throw new ArgumentNullException("patient.PatientKey"); } string strNow = DatabaseDateString(DateTime.Now); var cmd = _conn.CreateCommand(); cmd.CommandText = "INSERT INTO Study(ID, StudyDate, StudyDescription, PatientID) VALUES (@ID, @studydate, @studydescription, @patientID)"; cmd.Prepare(); Guid studyID = Guid.NewGuid(); study.ID = studyID; cmd.Parameters.AddWithValue("@ID", DatabaseGuidString(studyID)); cmd.Parameters.AddWithValue("@studydate", DatabaseDateString(GetDicomStudyDate(study))); cmd.Parameters.AddWithValue("@studydescription", study.StudyDescription); cmd.Parameters.AddWithValue("@patientID", patient.PatientKey); cmd.ExecuteNonQuery(); }
/// <summary> /// Sets the patient information. /// </summary> /// <param name="sheet">The sheet.</param> /// <param name="patientInformation">The patient information.</param> private static void SetPatientInfo(Worksheet sheet, PatientInformation patientInformation) { sheet.get_Range("E26", "E26").Value2 = patientInformation.PatientName; sheet.get_Range("E27", "E27").Value2 = patientInformation.HcNumber.ToString(); sheet.get_Range("E28", "E28").Value2 = patientInformation.DateMessure.ToShortDateString(); sheet.get_Range("E29", "E29").Value2 = patientInformation.UserName; }
private void Button_Click(object sender, RoutedEventArgs e) { try { patientlist.Clear(); string path = System.Environment.CurrentDirectory; string path2 = path.Substring(0, path.LastIndexOf("bin")) + "Data" + "\\patientinformation.txt"; FileStream fs = new FileStream(path2, FileMode.Open); StreamReader sr = new StreamReader(fs); while (sr.Peek() != -1) { string singlepatient = sr.ReadLine(); string[] singlepatientdata = singlepatient.Split('|'); PatientInformation patient = new PatientInformation() { IDNumber = singlepatientdata[0], FirstName = singlepatientdata[1], LastName = singlepatientdata[2], DateOfBirth = singlepatientdata[3], AdmitDate = singlepatientdata[4], Age = Int32.Parse(singlepatientdata[5]), Gender = singlepatientdata[6], ChiefComplaint = singlepatientdata[7], NotDischarged = Convert.ToBoolean(singlepatientdata[8]) }; if (singlepatientdata[8] == "True") { if ((txtBxFName.Text.Length > 0) & (singlepatientdata[1].Contains(txtBxFName.Text)) | ((txtBxLName.Text.Length > 0) & (singlepatientdata[2].Contains(txtBxLName.Text)) | ((txtBxChComp.Text.Length > 0) & (singlepatientdata[7].Contains(txtBxChComp.Text)) | ((txtBxAge.Text.Length > 0) & (singlepatientdata[5] == (txtBxAge.Text)))))) { patientlist.Add(patient); } } } fs.Close(); } catch (Exception) { MessageBox.Show("Search error..."); } }
public PatientInfo() { InitializeComponent(); try { string path = System.Environment.CurrentDirectory; string path2 = path.Substring(0, path.LastIndexOf("bin")) + "Data" + "\\patientinformation.txt"; FileStream fs = new FileStream(path2, FileMode.Open); StreamReader sr = new StreamReader(fs); while (sr.Peek() != -1) { string singlepatient = sr.ReadLine(); string[] singlepatientdata = singlepatient.Split('|'); PatientInformation patient = new PatientInformation() { IDNumber = singlepatientdata[0], FirstName = singlepatientdata[1], LastName = singlepatientdata[2], DateOfBirth = singlepatientdata[3], AdmitDate = singlepatientdata[4], Age = Int32.Parse(singlepatientdata[5]), Gender = singlepatientdata[6], ChiefComplaint = singlepatientdata[7], NotDischarged = Convert.ToBoolean(singlepatientdata[8]) }; if (singlepatientdata[8] == "True") { patientlist.Add(patient); } PatientTable.ItemsSource = patientlist; string newestid = singlepatientdata[0]; int nextid = Int32.Parse(newestid) + 1; } fs.Close(); } catch (Exception) { MessageBox.Show("Error finding patients..."); } }
private void WriteStudyObjectToDb(DicomStudy study, PatientInformation patient) { if (study != null && patient != null) { AppSingleton.DatabaseService.SaveStudy(study, patient); } }
public DicomImage() { _dicomDecoder = new DicomDecoder(); _validDicomFile = false; _ImageType = ImageType.Undefined; _patientInfo = new PatientInformation(); }
protected void btnSavePatient_Click(object sender, EventArgs e) { int patientId = 0; PatientInformation pi = new PatientInformation(); PatientDataContext patientDC = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString); PatientInformationTableManager patientTableMgr = new PatientInformationTableManager(); DatabaseObjects.Patient patientInformation = new DatabaseObjects.Patient(); patientInformation.Id = 0; if ((Session["PatientID"] != null) && (Int32.TryParse(Session["PatientID"].ToString(), out patientId))) { patientInformation.Id = patientId; } patientInformation.FirstName = txtboxFirstName.Text; patientInformation.LastName = txtboxLastName.Text; patientInformation.Birthday = String.Format("{0}/{1}/{2} 00:00:00", datepickerMonth.SelectedValue, datepickerDay.SelectedValue, datepickerYear.SelectedValue); patientInformation.PhoneNumber = txtboxPhone.Text; patientInformation.Email = txtboxEmailAddress.Text; patientTableMgr.Update(patientInformation); if (patientCareSaved != null) { patientCareSaved(this, new EventArgs()); } }
public ActionResult DeletePatientConfirmed(int id) { PatientInformation patientinfo = _db.PatientInformations.Find(id); _db.PatientInformations.Remove(patientinfo); _db.SaveChanges(); return(RedirectToAction("ViewPatientInformation")); }
public PatientInformationTableManager() { // // TODO: Add constructor logic here // pi = new PatientInformation(); patientDC = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString); dataEncryptionAlgorithm = new MyTherapistEncryption.SecurityController(); }
public MessuresViewModel() { roothModel = new RoothCalculationEntity(); mouseModel = new MouthCalculationEntity(); patientModel = new PatientInformation() { DateMessure = DateTime.Now }; }
public void Delete(Patient patient) { PatientDataContext patientDC = new PatientDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString); PatientInformation patientToDelete = new PatientInformation(); patientToDelete = patientDC.PatientInformations.Single(patientRecord => patientRecord.Id == patient.Id); patientDC.PatientInformations.DeleteOnSubmit(patientToDelete); patientDC.SubmitChanges(); }
public ActionResult DetailsForPatientInformation(int id) { PatientInformation patientDetail = _db.PatientInformations.Find(id); if (patientDetail == null) { return(HttpNotFound()); } return(View(patientDetail)); }
public Result(MessuresViewModel messureViewModule) { this.mouseMessures = messureViewModule.mouseModel; this.theetMessure = messureViewModule.roothModel; this.patientInformation = messureViewModule.patientModel; result = new MessuresResultsProvider(mouseMessures, theetMessure).GetResult(); InitializeComponent(); SetValues(result); }
public ActionResult CreateNewPatient([Bind(Exclude = "Id")] PatientInformation patientToCreate) { if (!ModelState.IsValid) { return(View()); } _db.PatientInformations.Add(patientToCreate); _db.SaveChanges(); return(RedirectToAction("ViewPatientInformation")); }
private void SaveData() { try { if (IsValidated()) { PatientInformation patientInformation = new PatientInformation(); patientInformation.FirstName = FirstNameTextBox.Text; patientInformation.LastName = LastNameTextBox.Text; patientInformation.MiddleName = MiddleNameTextBox.Text; patientInformation.FullName = FirstNameTextBox.Text + " " + MiddleNameTextBox.Text + " " + LastNameTextBox.Text; if (GenderComboBox.SelectedItem != null) { patientInformation.Sex = GenderComboBox.SelectedItem.ToString(); } patientInformation.AddedDate = DateTime.Now; patientInformation.IsLessThan5Years = childageCheckBox.Checked; if (AgeTextBox.Text.Trim().Length > 0) { patientInformation.Age = Convert.ToInt32(AgeTextBox.Text); } patientInformation.Weight = WeightTextBox.Text; patientInformation.GuardianName = GuardianNameTextBox.Text; patientInformation.ContactNumber = ContactTextBox.Text; patientInformation.District = DistrictTextBox.Text; patientInformation.Municipality = MunicipalityTextBox.Text; if (WardTextBox.Text.Trim().Length > 0) { patientInformation.Ward = WardTextBox.Text; } patientInformation.Village = VillageTextBox.Text; if (CasteComboBox.SelectedItem != null) { patientInformation.Caste = CasteComboBox.SelectedItem.ToString(); } patientInformation.AddedDate = DateTime.Today; patientInformation.AddedBy = LoggedInUser.UserName; databaseContext.patientInformations.Add(patientInformation); databaseContext.SaveChanges(); //MessageBox.Show("Data Saved Successfully"); groupBox1.Enabled = false; } } catch (Exception ex) { MessageBox.Show("error\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult DeletePatientInformation(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PatientInformation patientinfo = _db.PatientInformations.Find(id); if (patientinfo == null) { return(HttpNotFound()); } return(View(patientinfo)); }
public void SaveSeries(DicomSeries series, DicomStudy study, PatientInformation patient, string studyFolderPath) { if (series == null) { throw new ArgumentNullException(nameof(series)); } if (study == null) { throw new ArgumentNullException(nameof(study)); } if (patient == null) { throw new ArgumentNullException(nameof(patient)); } if (string.IsNullOrWhiteSpace(patient.PatientKey)) { throw new ArgumentNullException("patient.PatientKey"); } string strNow = DatabaseDateString(DateTime.Now); var pngFileList = System.IO.Directory.EnumerateFiles(studyFolderPath, series.SeriesFileName + "*.png").ToList(); string pngFile = pngFileList.Count == 1 ? pngFileList[0] : ""; byte[] thumbnail = Utilities.CreateThumbnailFromFile(pngFile, 64, 64); var cmd = _conn.CreateCommand(); cmd.CommandText = "INSERT INTO Series(ID, SeriesDate, SeriesDescription, StudyID, DrapeUsedAtCapture, Thumbnail) VALUES (@ID, @seriesdate, @seriesdescription, @studyID, @drapeusedatcapture, @thumbnail)"; cmd.Prepare(); Guid seriesID = Guid.NewGuid(); series.ID = seriesID; cmd.Parameters.AddWithValue("@ID", DatabaseGuidString(series.ID)); cmd.Parameters.AddWithValue("@seriesdate", DatabaseDateString(ParseDicomDateToDateTime(series.SeriesDate))); cmd.Parameters.AddWithValue("@seriesdescription", series.SeriesDescription); cmd.Parameters.AddWithValue("@studyID", DatabaseGuidString(study.ID)); cmd.Parameters.AddWithValue("@drapeusedatcapture", series.DrapeUsedAtCapture ? 1 : 0); cmd.Parameters.AddWithValue("@drapeusedatcapture", series.DrapeUsedAtCapture ? 1 : 0); cmd.Parameters.Add("@thumbnail", DbType.Binary, 20).Value = thumbnail; cmd.ExecuteNonQuery(); }
public ActionResult EditPatient(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PatientInformation patientToEdit = _db.PatientInformations.Find(id); if (patientToEdit == null) { return(HttpNotFound()); } return(View(patientToEdit)); }
private void InitializePatientInfo() { _patientInfo.AccessionNo = _dicomDecoder.FindTag("00080050"); String dateOfBirth = _dicomDecoder.FindTag("00100030"); dateOfBirth = dateOfBirth.Trim(' '); if (dateOfBirth.Length >= 8) { _patientInfo.DOB_Day = dateOfBirth.Substring(6, 2); _patientInfo.DOB_Month = dateOfBirth.Substring(4, 2); _patientInfo.DOB_Year = dateOfBirth.Substring(0, 4); } String patientName = _dicomDecoder.FindTag("00100010"); String[] nameParts = patientName.Split('^'); if (nameParts.Length > 0) { _patientInfo.Lastname = nameParts[0]; } if (nameParts.Length > 1) { _patientInfo.Firstname = nameParts[1]; } if (nameParts.Length > 2) { _patientInfo.Middlename = nameParts[2]; } _patientInfo.Gender = PatientInformation.ParseGenderString(_dicomDecoder.FindTag("00100040")); _patientInfo.PatientMRN = _dicomDecoder.FindTag("00100020"); String referringPhysician = _dicomDecoder.FindTag("00080090"); nameParts = referringPhysician.Split('^'); if (nameParts.Length > 0) { _patientInfo.ReferringPhysicianLastName = nameParts[0]; } if (nameParts.Length > 1) { _patientInfo.ReferringPhysicianFirstName = nameParts[1]; } }
public List <DicomStudy> RetrievePatientStudyDetails(PatientInformation patient) { if (patient == null) { throw new ArgumentNullException(nameof(patient)); } List <DicomStudy> list = new List <DicomStudy>(); try { var cmd = _conn.CreateCommand(); cmd.CommandText = "SELECT ID, StudyDate, StudyDescription, PatientId FROM Study WHERE PatientId=@patientID"; cmd.Prepare(); cmd.Parameters.AddWithValue("@patientID", patient.PatientKey); var reader = cmd.ExecuteReader(); string ID; string studyDate; string studyDescription; string patientId; while (reader.Read()) { ID = GetColumnValue <string>(reader, "ID"); studyDate = GetColumnValue <string>(reader, "StudyDate"); studyDescription = GetColumnValue <string>(reader, "StudyDescription"); patientId = GetColumnValue <string>(reader, "PatientId"); var study = CreateStudy(ID, studyDate, studyDescription, patientId); list.Add(study); } } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.Assert(false, e.Message); } return(list); }
protected void btnDeletePatient_Click(object sender, EventArgs e) { PatientDataContext patientDC = new PatientDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True"); PatientInformation patientToDelete = new PatientInformation(); PatientAppointmentInfomationDataContext patientAppointmentInformationDC = new PatientAppointmentInfomationDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True"); PatientAppointmentInformation patientAppointmentInformationToDelete = new PatientAppointmentInformation(); Int32 patientId = 0; if (Session[CommonDefinitions.CommonDefinitions.PATIENT_ID] != null) { if (Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] == null) { lblWarningText.Text = "Click Delete again to confirm this action."; lblWarningText.ForeColor = System.Drawing.Color.Red; lblWarningText.Visible = true; Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = "yes"; } else { if (Int32.TryParse(Session[CommonDefinitions.CommonDefinitions.PATIENT_ID].ToString(), out patientId)) { Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = null; PatientInformationTableManager patientTableMgr = new PatientInformationTableManager(); Patient patientInfo = new Patient(); patientInfo.Id = patientId; patientTableMgr.Delete(patientInfo); lblWarningText.Visible = false; PatientListing1.LoadGrid(); } } } else { lblWarningText.Visible = true; lblWarningText.Text = "Select a patient to delete."; lblWarningText.ForeColor = System.Drawing.Color.Red; } }
public AddPatient(PatientInformation pI) { InitializeComponent(); Thread Insurance = new Thread(() => { insurance = BAL.PatientInfo.GetInsurance(); }); Thread City = new Thread(() => { city = BAL.PatientInfo.GetCities(); }); //doctor City.Start(); Insurance.Start(); City.Join(); Insurance.Join(); MyFunction.FillComboBox(Insurancebox, PatientInfo.GetInsurance(), "الجهة_الضامنة", "الرمز"); MyFunction.FillComboBox(CityBox, BAL.PatientInfo.GetCities(), "المدينة", "رمز"); CityBox.SelectedValueChanged += CityBox_SelectedValueChanged; PI = pI; }
public void SavePatient(PatientInformation patient) { if (patient == null) { throw new ArgumentNullException(nameof(patient)); } if (string.IsNullOrWhiteSpace(patient.PatientKey)) { throw new ArgumentNullException("patient.PatientKey"); } try { string strNow = DatabaseDateString(DateTime.Now); var cmd = _conn.CreateCommand(); cmd.CommandText = @"INSERT INTO Patients(ID, FirstName, MiddleName, LastName, DateOfBirth, CreatedOn, UpdatedOn, CreatedBy, UpdatedBy) VALUES(@ID, @FirstName, @MiddleName, @LastName, @DateOfBirth, @CreatedOn, @UpdatedOn, @CreatedBy, @UpdatedBy)"; DateTime dateOfBirth; DateTime.TryParse(patient.DateOfBirth, out dateOfBirth); cmd.Prepare(); cmd.Parameters.AddWithValue("@ID", patient.PatientKey); cmd.Parameters.AddWithValue("@FirstName", patient.Firstname); cmd.Parameters.AddWithValue("@MiddleName", patient.Middlename); cmd.Parameters.AddWithValue("@LastName", patient.Lastname); cmd.Parameters.AddWithValue("@DateOfBirth", dateOfBirth.ToShortDateString()); cmd.Parameters.AddWithValue("@CreatedOn", strNow); cmd.Parameters.AddWithValue("@UpdatedOn", strNow); cmd.Parameters.AddWithValue("@CreatedBy", DatabaseGuidString(_currentUserId)); cmd.Parameters.AddWithValue("@UpdatedBy", DatabaseGuidString(_currentUserId)); cmd.ExecuteNonQuery(); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); System.Diagnostics.Debug.Assert(false, e.Message); } }
public static void Export(RoothCalculationEntity roothCalculation, MouthCalculationEntity mouthCalculation, PatientInformation patientInformation, ResultsMessures result, string filePath) { InitializeCultures(); var excelTemplate = Resources.FilesResources.HaenggiCalculationResult; CopyStream(excelTemplate, filePath); wapp = new Application(); try { wbook = wapp.Workbooks.Open(filePath, true, true, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value); var fileNameSubstr = filePath.LastIndexOf("\\") + 1; wbook.Title = filePath.Substring(fileNameSubstr, filePath.LastIndexOf(".") - fileNameSubstr); SetDataIntoSheetMessure(wbook.Worksheets.get_Item(1), roothCalculation, mouthCalculation, patientInformation); SetDataIntoSheetResult(wbook.Worksheets.get_Item(2), result); wbook.SaveCopyAs(filePath); wbook.Close(false); } catch (Exception) { wbook.Close(false); throw new Exception("Error al intentar exportar el resultado."); } finally { wapp.Workbooks.Close(); wapp.Quit(); } }
private void WriteSeriesObjectToDb(DicomSeries series, DicomStudy study, PatientInformation patient, string studyFolderPath) { if (series != null && study != null && patient != null && !string.IsNullOrWhiteSpace(studyFolderPath)) { AppSingleton.DatabaseService.SaveSeries(series, study, patient, studyFolderPath); var seriesImageFiles = System.IO.Directory.EnumerateFiles(studyFolderPath, series.SeriesFileName + "*.*"); foreach (string filename in seriesImageFiles) { if (filename.EndsWith(".txt") || filename.EndsWith(".png")) { continue; } AppSingleton.DatabaseService.SaveSeriesImageFile(series, studyFolderPath, filename); } } }
public Patient FindPatient(Patient patient) { IQueryable <PatientInformation> apatient = from patients in patientDC.PatientInformations where (patients.Id == patient.Id) select patients; try { pi = apatient.Single <PatientInformation>(); patient.FirstName = pi.FirstName; patient.LastName = pi.LastName; patient.Birthday = dataEncryptionAlgorithm.DecryptData(pi.BirthDate); patient.PhoneNumber = dataEncryptionAlgorithm.DecryptData(pi.TelephoneNumber); patient.Email = dataEncryptionAlgorithm.DecryptData(pi.EmailAddress); } catch (Exception ex) { ex.GetHashCode(); } return(patient); }
public static Stream Export(ResultsMessures result, PatientInformation patientInformation, string fileName) { InitializeCultures(); results = result; patientInfo = patientInformation; using (var doc = new Document(PageSize.A4)) { MemoryStream pdfStream = new MemoryStream(); using (var writer = PdfWriter.GetInstance(doc, new FileStream(fileName, FileMode.Create))) { doc.Open(); doc.AddCreationDate(); doc.AddTitle(Properties.Resources.PdfTitle); doc.AddAuthor(Properties.Resources.PdfAuthor); doc.SetMargins(10, 10, (float)1.5, (float)1.5); SetTitle(doc); SetPatientData(doc); SetDentalBoneDiscrepancy(doc); SetMoyers(doc); SetTanaka(doc); SetBolton(doc); SetPont(doc); doc.Close(); return(pdfStream); } } }
public PatientInformation ProcessRow(SqlDataReader read, params PatientInformation.LazyComponents[] lazyComponents) { PatientInformation patientInfo = new PatientInformation(); patientInfo.PatientId = Convert.ToInt32(read["a.PatientId"]); patientInfo.Student.Username = read["a.StudentId"].ToString(); patientInfo.Clinician.Username = read["a.ClinicianId"].ToString(); patientInfo.FormCompleted = Convert.ToChar(read["a.FormCompleted"].ToString()); if (read["a.TemperamentId"].ToString() != "") patientInfo.Temperament.Id = Convert.ToInt32(read["a.TemperamentId"].ToString()); if (read["a.DateSeenOn"].ToString() != "") patientInfo.DateSeenOn = Convert.ToDateTime(read["a.DateSeenOn"].ToString()); if (read["a.CageOrStallNumber"].ToString() != "") patientInfo.CageOrStallNumber = Convert.ToInt32(read["a.CageOrStallNumber"].ToString()); if (read["a.BodyWeight"].ToString() != "") patientInfo.BodyWeight = Convert.ToDecimal(read["a.BodyWeight"].ToString()); if (read["a.AgeInYears"].ToString() != "") patientInfo.AgeInYears = Convert.ToInt32(read["a.AgeInYears"].ToString()); if (read["a.AgeInMonths"].ToString() != "") patientInfo.AgeInMonths = Convert.ToInt32(read["a.AgeInMonths"].ToString()); if (read["a.PreOpPainAssessmentId"].ToString() != "") patientInfo.PreOperationPainAssessment.Id = Convert.ToInt32(read["a.PreOpPainAssessmentId"].ToString()); if (read["a.PostOpPainAssessmentId"].ToString() != "") patientInfo.PostOperationPainAssessment.Id = Convert.ToInt32(read["a.PostOpPainAssessmentId"].ToString()); if (read["a.ProcedureDate"].ToString() != "") patientInfo.ProcedureDate = Convert.ToDateTime(read["a.ProcedureDate"].ToString()); if (read["a.ProcedureId"].ToString() != "") patientInfo.Procedure.Id = Convert.ToInt32(read["a.ProcedureId"].ToString()); patientInfo.ProcedureOther = read["a.ProcedureOther"].ToString(); foreach (PatientInformation.LazyComponents a in lazyComponents) { if (a == PatientInformation.LazyComponents.LOAD_CLINICIAN_DETAIL) { patientInfo.Clinician.Username = read["b.Username"].ToString(); patientInfo.Clinician.FullName = read["b.FullName"].ToString(); patientInfo.Clinician.EmailAddress = read["b.Email"].ToString(); } else if (a == PatientInformation.LazyComponents.LOAD_STUDENT_DETAIL) { patientInfo.Student.Username = read["c.Username"].ToString(); patientInfo.Student.FullName = read["c.FullName"].ToString(); patientInfo.Student.EmailAddress = read["c.Email"].ToString(); } else if (a == PatientInformation.LazyComponents.LOAD_POSTOP_PAIN_DETAIL && patientInfo.PostOperationPainAssessment.Id != -1) { patientInfo.PostOperationPainAssessment.Category.Id = Convert.ToInt32(read["d.CategoryId"].ToString()); patientInfo.PostOperationPainAssessment.Label = read["d.Label"].ToString(); patientInfo.PostOperationPainAssessment.OtherFlag = Convert.ToChar(read["d.OtherFlag"].ToString()); patientInfo.PostOperationPainAssessment.Description = read["d.Description"].ToString(); if (read["d.Concentration"].ToString() != "") patientInfo.PostOperationPainAssessment.Concentration = Convert.ToDecimal(read["d.Concentration"].ToString()); } else if (a == PatientInformation.LazyComponents.LOAD_PREOP_PAIN_DETAIL && patientInfo.PreOperationPainAssessment.Id != -1) { patientInfo.PreOperationPainAssessment.Category.Id = Convert.ToInt32(read["e.CategoryId"].ToString()); patientInfo.PreOperationPainAssessment.Label = read["e.Label"].ToString(); patientInfo.PreOperationPainAssessment.OtherFlag = Convert.ToChar(read["e.OtherFlag"].ToString()); patientInfo.PreOperationPainAssessment.Description = read["e.Description"].ToString(); if (read["e.Concentration"].ToString() != "") patientInfo.PreOperationPainAssessment.Concentration = Convert.ToDecimal(read["e.Concentration"].ToString()); } else if (a == PatientInformation.LazyComponents.LOAD_TEMPERAMENT_DETAIL && patientInfo.Temperament.Id != -1) { patientInfo.Temperament.Category.Id = Convert.ToInt32(read["f.CategoryId"].ToString()); patientInfo.Temperament.Label = read["f.Label"].ToString(); patientInfo.Temperament.OtherFlag = Convert.ToChar(read["f.OtherFlag"].ToString()); patientInfo.Temperament.Description = read["f.Description"].ToString(); if (read["f.Concentration"].ToString() != "") patientInfo.Temperament.Concentration = Convert.ToDecimal(read["f.Concentration"].ToString()); } else if (a == PatientInformation.LazyComponents.LOAD_PROCEDURE_DETAIL && patientInfo.Procedure.Id != -1) { patientInfo.Procedure.Category.Id = Convert.ToInt32(read["g.CategoryId"].ToString()); patientInfo.Procedure.Label = read["g.Label"].ToString(); patientInfo.Procedure.OtherFlag = Convert.ToChar(read["g.OtherFlag"].ToString()); patientInfo.Procedure.Description = read["g.Description"].ToString(); if (read["g.Concentration"].ToString() != "") patientInfo.Procedure.Concentration = Convert.ToDecimal(read["g.Concentration"].ToString()); } } return patientInfo; }