protected void BuildIdentifiers(string type) { int protocolId = int.Parse(BaseProtocolId); string datasetSQL = base.GetSpecimenPatientsDatasetSQL(); DataTable patientIdentifiers = ProtocolMgmtDa.GetProtocolPatientIdentifiers(protocolId, datasetSQL); DataView patientView = PatientProtocolController.SortPatientsByStudyId(patientIdentifiers, "ASC"); // set column visibility ProtocolPatientIdentifiers.Columns[1].Visible = type == ID_TYPES[0]; ProtocolPatientIdentifiers.Columns[2].Visible = type == ID_TYPES[1]; ProtocolPatientIdentifiers.Columns[3].Visible = type == ID_TYPES[2]; // delete column ProtocolPatientIdentifiers.Columns[4].Visible = false;// todo: UserType == ProtocolMgmtUsers.ProtocolAdmin; ProtocolPatientIdentifiers.DataSource = patientView; ProtocolPatientIdentifiers.DataBind(); UpdateBtn.Visible = patientView.Count > 0; ProtocolPatientIdentifiers.Visible = true; }
private void BuildPatientList() { string dataset = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); int protocolId = int.Parse(BaseProtocolId); bool showIdentifiers = base.ShowPatientIdentifiers(); // get list bool canViewIdentifiers = base.ShowPatientIdentifiers(); DataTable patientsList = ProtocolMgmtDa.GetPatientsByProtocol(protocolId, dataset, showIdentifiers, true); DataView sortedPatients = PatientProtocolController.SortPatientsByStudyId(patientsList, "ASC"); var patients = from patient in sortedPatients.ToTable().AsEnumerable() let name = patient["Name"].ToString() select new { PatientDisplayName = patient[PatientProtocol.PtProtocolStudyId].ToString() + (canViewIdentifiers && !string.IsNullOrEmpty(name) ? " : " + name : ""), PatientProtocolId = patient[PatientProtocol.PatientProtocolId].ToString() }; PatientList.DataSource = patients; PatientList.DataBind(); }
private void BuildInventory(DataView inventoryView) { selectedColumns = GetSpecimenColumns(); // build header HeaderRptr.DataSource = selectedColumns; HeaderRptr.DataBind(); // build data string sortColumn = SortColumn.Value; string sortDirection = SortDirection.Value; if (!string.IsNullOrEmpty(sortColumn)) { // special case if (sortColumn == "PtProtocolStudyId" && inventoryView.Count > 0) { inventoryView = PatientProtocolController.SortPatientsByStudyId(inventoryView.ToTable(), sortDirection); } else { inventoryView.Sort = sortColumn + " " + sortDirection; } } // do not show NULL statuses inventoryView.RowFilter = Specimen.SpecimenStatus + " IS NOT NULL"; bool hideBankedSpeicmens = BankedSpecimensPreference.Checked && BankedSpecimensPreference.Visible; if (hideBankedSpeicmens) { inventoryView.RowFilter += " AND SpecimenSubType NOT IN ('Serum', 'Plasma', 'PAXGen')"; } SpecimenInventoryRows.DataSource = inventoryView; SpecimenInventoryRows.DataBind(); RecordCount.Text = inventoryView.Count + " Record(s)"; }
private DataView LoadPatients(String SortString) { string dataset = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]); DataView patientsList; int protocolId = int.Parse(BaseProtocolId); bool showIdentifiers = base.ShowPatientIdentifiers(); // call main method for filtering values patientsList = ProtocolMgmtDa.GetPatientsByProtocol(protocolId, dataset, QueryTreatmentArms, QueryStatuses, showIdentifiers, IncludeDeceasedPatients).DefaultView; // special case for StudyId: strip last x ids from end to sort if (SortString.StartsWith(PatientProtocol.PtProtocolStudyId) && patientsList.Count > 0) { string sort = SortString.EndsWith("DESC", StringComparison.OrdinalIgnoreCase) ? "DESC" : "ASC"; patientsList = PatientProtocolController.SortPatientsByStudyId(patientsList.Table, sort); } else { // Force default sort to earliest records first patientsList.Sort = SortString; } return(patientsList); }