private void SetPatientSearchResults(string searchTerm, string searchType) { SearchController ct = new SearchController(); string datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); // Determine type of search, if identifier or normal search DataTable results = new DataTable(); if (!string.IsNullOrEmpty(searchType) && searchType.Equals(PROTOCOL_PARTICIPANT_ID_CODE)) { results = ct.FindPatientByIdentifier(searchTerm, PROTOCOL_PARTICIPANT_ID_CODE, datasetSQL).Tables[0]; // add identifier columns if (PatientResults.Columns.Count == 3) { BoundField identifierColumn = new BoundField(); identifierColumn.DataField = "Identifier"; PatientResults.Columns.Add(identifierColumn); } } else if (CanViewPatientInfo) { results = ct.FindPatient(searchTerm, datasetSQL).Tables[0]; } isSingleResult = results.Rows.Count == 1; PatientResults.DataSource = GetPatientParticipantTable(results); PatientResults.DataBind(); }
protected void btnSearch_Click(object sender, CommandEventArgs e) { string strSearch = searchTxtBox.Value; string datasetSql = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); SpecimenManagerDa da = new SpecimenManagerDa(); SearchController sc = new SearchController(); DataTable dt; if (searchType == "LastNameMRN") { dt = sc.FindPatient(strSearch, datasetSql).Tables[0];; } else { dt = sc.FindPatientByIdentifier(strSearch, _identifierType, datasetSql).Tables[0]; } int n = dt.Rows.Count; if (n > 0) { if (n == 1) { patientId = Int32.Parse(dt.Rows[0]["PatientId"].ToString()); Response.Redirect("AccessionsContainer.aspx?patientId=" + EncryptPatientId(patientId.ToString()) + "&specimenaccessionId=0"); } else { PatientResults.DataSource = dt; PatientResults.DataBind(); PDFormDiv.Style.Add("display", "block"); noRecordsFound.Visible = false; } } else { PDFormDiv.Style.Add("display", "none"); noRecordsFound.Visible = true; } }