/// <summary> /// Add event handlers to ICaisisInputControls to mark relevant forms as dirty /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitalizeEvents(object sender, EventArgs e) { // set require fields if (!Page.IsPostBack) { int?toxicityId = null; int?patientItemId = null; // get keys if (!string.IsNullOrEmpty(QueryPatientItemId)) { string dpid = base.DecrypyValue(QueryPatientItemId); if (!string.IsNullOrEmpty(dpid)) { patientItemId = int.Parse(dpid); } } if (!string.IsNullOrEmpty(QueryToxicityId)) { toxicityId = int.Parse(QueryToxicityId); } // set hidden fields: important, use raw QS for pass through PatientItemId.Value = QueryPatientItemId; ToxicityIdField.Value = QueryToxicityId; // check if SAE if (toxicityId.HasValue) { CheckSAEDetails(toxicityId.Value); } } // add "dirty" tracking for forms foreach (ICaisisInputControl iCIC in CICHelper.GetCaisisInputControls(this)) { if (iCIC.Table == "Toxicities") { iCIC.ValueChanged += new CaisisEventHandler(MarkToxicityDirty); } else if (iCIC.Table == "SeriousAdverseEvents") { iCIC.ValueChanged += new CaisisEventHandler(MarkSAEDirty); } iCIC.ValueChanged += MarkTableFieldsDirty; } // query default list of patient MedTxAgents if (!string.IsNullOrEmpty(BaseSchemaId)) { int protocolSchemaId = int.Parse(BaseSchemaId); int patientSchemaId = int.Parse(PatientSchemaId); MedicalTherapyDa da = new MedicalTherapyDa(); DataTable trialMedTx = da.GetProtocolSchemaTherapies(protocolSchemaId); // combine data var trialAgents = trialMedTx.AsEnumerable().Select(m => m[MedicalTherapy.MedTxAgent].ToString()).Distinct().ToArray(); IEnumerable <MedicalTherapy> patientTherapies = BOL.ProtocolMgmt.GetRecordsByPatientSchema <MedicalTherapy>(patientSchemaId); protocolMedTxAgents = from agent in trialAgents join tx in patientTherapies on agent equals tx[MedicalTherapy.MedTxAgent].ToString() into g let tx = g.FirstOrDefault() let txAdmin = tx == null ? new MedTxAdministration[0] : BOL.BusinessObject.GetByParent <MedTxAdministration>((int)tx[MedTxAdministration.MedicalTherapyId]) select agent; } }
public int Populate(int patientId, DateTime?fromDate, DateTime?toDate, IEnumerable <string> txExactMatch, IEnumerable <string> txLikeMatch) { MedicalTherapyDa da = new MedicalTherapyDa(); DataView view = da.GetPatientTherapiesByType(patientId, txExactMatch, txLikeMatch).DefaultView; // filter List <string> filters = new List <string>(); if (fromDate.HasValue) { string fromDateFilter = string.Format("{0} > #{1:d}#", MedicalTherapy.MedTxDate, fromDate); filters.Add(fromDateFilter); } if (toDate.HasValue) { string toDateFilter = string.Format("{0} < #{1:d}#", MedicalTherapy.MedTxDate, toDate); filters.Add(toDateFilter); } if (filters.Count() > 0) { view.RowFilter = string.Join(" AND ", filters.ToArray()); } view = view.ToTable().DefaultView; view.Sort = MedicalTherapy.MedTxDate; int recordCount = view.Count; MedTxGrid.VisibleBlankRows = recordCount > 0 ? 0 : 2; MedTxGrid.DataSource = view; MedTxGrid.DataBind(); return(recordCount); }
override protected void BuildMedTx(int PatientID, string FormName, string FormType, string MedTxType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); if (MedTxType.Length > 0) { Ds = Da.FormGetRecords(PatientID, FormName, FormType, MedTxType); } else { Ds = Da.FormGetRecords(PatientID, FormName, FormType); } if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { DataView Dv = new DataView(Ds.Tables[0]); Dv.RowFilter = (BOL.MedicalTherapy.MedTxType + " = 'HORM'"); if (Dv.Count > 0) { MedicalTherapies.DataSource = Dv; MedicalTherapies.DataBind(); } } }
protected void BuildChemoTx(int PatientID, string FormName, string FormType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); Ds = Da.FormGetRecords(PatientID, FormName, FormType); DataView dv = new DataView(Ds.Tables[0]); dv.RowFilter = MedicalTherapy.MedTxType + " LIKE '%CHEMO%' "; if (dv.Count > 0) { MedicalTherapies.DataSource = dv; MedicalTherapies.DataBind(); } }
protected void BuildHormoneMedTx(int PatientID, string FormName, string FormType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); Ds = Da.FormGetRecords(PatientID, FormName, FormType); DataView Dv = Ds.Tables[0].DefaultView; Dv.RowFilter = Caisis.BOL.MedicalTherapy.MedTxType + " IN ('HORM', 'Horm', 'horm', 'HORMONE', 'Hormone', 'hormone')"; if (Dv.Count > 0) { MedicalTherapies.DataSource = Dv; MedicalTherapies.DataBind(); PriorHormoneTxExist = true; } }
protected void BuildImmunoMedTx(int PatientID, string FormName, string FormType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); Ds = Da.FormGetRecords(PatientID, FormName, FormType); DataView Dv = Ds.Tables[0].DefaultView; Dv.RowFilter = Caisis.BOL.MedicalTherapy.MedTxType + " IN ('IMMUNO', 'Immuno', 'immuno')"; if (Dv.Count > 0) { MedicalTherapies.DataSource = Dv; MedicalTherapies.DataBind(); PriorImmunoTxExist = true; } }
protected virtual void BuildMedTxHistory(int PatientID, string FormName, string FormType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); Ds = Da.FormGetRecords(PatientID, FormName, FormType); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { NoMedTxHxMsgTr.Visible = false; MedicalTxRptr.DataSource = Ds.Tables[0].DefaultView; MedicalTxRptr.DataBind(); } else { NoMedTxHxMsgTr.Visible = true; } }
protected virtual void BuildMedTx(int PatientID, string FormName, string FormType, string MedTxType) { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); if (MedTxType.Length > 0) { Ds = Da.FormGetRecords(PatientID, FormName, FormType, MedTxType); } else { Ds = Da.FormGetRecords(PatientID, FormName, FormType); } if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { MedicalTherapies.DataSource = Ds.Tables[0].DefaultView; MedicalTherapies.DataBind(); } }
protected void GetAntiViralMedTx(int PatientID, string FormName, string FormType) { MedicalTherapyDa antiViralMedTxDa = new MedicalTherapyDa(); DataSet antiViralMedTxDs = antiViralMedTxDa.FormGetSpecialRecords(PatientID, FormName, FormType, MedicalTherapy.MedTxType, "IN", "'Anti-viral History'"); if (antiViralMedTxDs.Tables.Count > 0 && antiViralMedTxDs.Tables[0].Rows.Count > 0) { // limit to last 10 records PastRecordsCountAntiViral = antiViralMedTxDs.Tables[0].Rows.Count; DataView antiViralMedTxDv = new DataView(antiViralMedTxDs.Tables[0]); antiViralMedTxDv.Sort = MedicalTherapy.MedTxDate + " DESC "; antiViralMedTxDv = GetTopDataViewRows(antiViralMedTxDv, 10); antiViralMedTxDv.Sort = MedicalTherapy.MedTxDate + " ASC, " + MedicalTherapy.MedTxAgent + " ASC "; antiViralHistory.DataSource = antiViralMedTxDv; antiViralHistory.DataBind(); } else { PastRecordsCountAntiViral = 0; } }
protected void GetMedTx(int PatientID, string FormName, string FormType) { MedicalTherapyDa medTxDa = new MedicalTherapyDa(); DataSet medTxDs = medTxDa.FormGetSpecialRecords(PatientID, FormName, FormType, MedicalTherapy.MedTxType, " NOT IN ", "'Anti-viral History'"); if (medTxDs.Tables.Count > 0 && medTxDs.Tables[0].Rows.Count > 0) { // limit to last 10 records PastRecordsCountMedTx = medTxDs.Tables[0].Rows.Count; DataView medTxDv = new DataView(medTxDs.Tables[0]); medTxDv.Sort = MedicalTherapy.MedTxDate + " DESC "; medTxDv = GetTopDataViewRows(medTxDv, 10); medTxDv.Sort = MedicalTherapy.MedTxDate + " ASC "; MedicalTherapies.DataSource = medTxDv; MedicalTherapies.DataBind(); } else { PastRecordsCountMedTx = 0; } }
protected void BuildCurrentMedTx() { MedicalTherapyDa Da = new MedicalTherapyDa(); DataSet Ds = new DataSet(); Ds = Da.FormGetRecords(this._patientId, this._eformName, "Dynamic"); // MedTxAdministrationDa Daa = = new MedTxAdministrationDa(); // DataSet Dsa = Daa.FormGetRecords(this._patientId, this._eformName, "Dynamic"); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { if (Ds.Tables[0].Rows[(Ds.Tables[0].Rows.Count) - 1]["MedTxStopDateText"].ToString().Length < 1) { CurrentTXLabel.Text = Ds.Tables[0].Rows[(Ds.Tables[0].Rows.Count) - 1]["MedTxAgent"].ToString(); CurrentTXStartDateLabel.Text = Ds.Tables[0].Rows[(Ds.Tables[0].Rows.Count) - 1]["MedTxDateText"].ToString(); mostRecentTxRow.Attributes.Add("onclick", "LoadDataEntryForm('MedicalTherapy', " + Ds.Tables[0].Rows[(Ds.Tables[0].Rows.Count) - 1]["MedicalTherapyId"].ToString() + ", 'MedTxDateText,MedTxDate,MedTxStopDateText,MedStopTxDate,MedTxType,MedTxAgent,MedTxDose,MedTxUnits,MedTxInstitution,MedTxNotes', 'CurrentMedicalTherapy_GU');"); mostRecentTxRow.Visible = true; // mostRecentTxRowHelpText.Visible = true; // newTxLabel.Text = "New"; } } }
/// <summary> /// Add event handlers to ICaisisInputControls to mark relevant forms as dirty /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitalizeEvents(object sender, EventArgs e) { // add "dirty" tracking for forms foreach (ICaisisInputControl iCIC in CICHelper.GetCaisisInputControls(this)) { if (iCIC.Table == "Toxicities") { iCIC.ValueChanged += new CaisisEventHandler(MarkToxicityDirty); } else if (iCIC.Table == "SeriousAdverseEvents") { iCIC.ValueChanged += new CaisisEventHandler(MarkSAEDirty); } } // query default list of patient MedTxAgents if (!string.IsNullOrEmpty(BaseSchemaId)) { int protocolSchemaId = int.Parse(BaseSchemaId); MedicalTherapyDa da = new MedicalTherapyDa(); protocolMedTxAgents = da.GetProtocolSchemaTherapies(protocolSchemaId).AsEnumerable().Select(r => r[MedicalTherapy.MedTxAgent].ToString()).ToArray(); } }
protected virtual void BuildAdditionalGUMedicationSection(int PatientID, string FormName, string FormType) { // Medications string stopDate = System.DateTime.Now.ToShortDateString(); if (Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic" && Session[SessionKey.CurrentClinicDate] != null && Session[SessionKey.CurrentClinicDate].ToString().Length > 0) { try { stopDate = Convert.ToDateTime(Session[SessionKey.CurrentClinicDate]).ToShortDateString(); } catch { } } MedicationDa medDa = new MedicationDa(); DataSet medDs = medDa.FormGetRecords(PatientID, FormName, FormType, stopDate); medDs.Tables[0].Columns.Add("MedTableType"); foreach (DataRow dr in medDs.Tables[0].Rows) { dr["MedTableType"] = "Medications"; } MedicalTherapyDa medTxDa = new MedicalTherapyDa(); DataSet medTxDs = medTxDa.FormGetRecords(PatientID, FormName, FormType); if (medTxDs.Tables.Count > 0 && medTxDs.Tables[0].Rows.Count > 0) { DataView medTxDv = new DataView(medTxDs.Tables[0]); string filter = "(MedTxRoute = 'Orally') AND (Isnull(MedTxStopDateText,'') = '')"; medTxDv.RowFilter = filter; foreach (DataRowView drv in medTxDv) { DataRow newRow; newRow = medDs.Tables[0].NewRow(); newRow["Medication"] = drv.Row["MedTxAgent"]; newRow["MedDose"] = drv.Row["MedTxDose"]; newRow["MedUnits"] = drv.Row["MedTxUnits"]; newRow["MedSchedule"] = drv.Row["MedTxSchedule"]; newRow["MedIndication"] = drv.Row["MedTxIndication"]; newRow["MedRoute"] = drv.Row["MedTxRoute"]; newRow["MedDateText"] = drv.Row["MedTxDateText"]; newRow["MedDate"] = drv.Row["MedTxDate"]; newRow["MedStopDateText"] = drv.Row["MedTxStopDateText"]; newRow["MedicationId"] = drv.Row["MedicalTherapyId"]; newRow["MedTableType"] = "MedicalTherapy"; medDs.Tables[0].Rows.Add(newRow); } } DataView medDv = new DataView(medDs.Tables[0]); medDv.Sort = "MedDate, MedStopDate, Medication"; medicationsAll.DataSource = medDv; medicationsAll.DataBind(); }
// this is mostly identical to the method BuildMedications(int minNumMedRowsToShow, int minNumBlankMedRows) // but we need to populate 2 different medications sections on this form and the usual methods both // call for the same repeater id. this version uses a different ID for the repeater protected virtual void BuildAdditionalGUMedicationSection(int minNumMedRowsToShow, int minNumBlankMedRows, int numRowsToShowIfNoRecords) { if (patientID != 0) { // Medications string stopDate = System.DateTime.Now.ToShortDateString(); if (Session[SessionKey.CurrentListType] != null && Session[SessionKey.CurrentListType].ToString() == "Clinic" && Session[SessionKey.CurrentClinicDate] != null && Session[SessionKey.CurrentClinicDate].ToString().Length > 0) { try { stopDate = Convert.ToDateTime(Session[SessionKey.CurrentClinicDate]).ToShortDateString(); } catch { } } MedicationDa medDa = new MedicationDa(); DataSet medDs = medDa.FormGetRecords(this.patientID, this._formName, "Dynamic", stopDate); MedicalTherapyDa medTxDa = new MedicalTherapyDa(); DataSet medTxDs = medTxDa.FormGetRecords(this.patientID, this._formName, "Dynamic"); if (medTxDs.Tables.Count > 0 && medTxDs.Tables[0].Rows.Count > 0) { DataView medTxDv = new DataView(medTxDs.Tables[0]); string filter = "(MedTxRoute = 'Orally') AND (Isnull(MedTxStopDateText,'') = '')"; //"(MedTxRoute = 'Orally') AND (MedTxStopDateText = '')"; medTxDv.RowFilter = filter; foreach (DataRowView drv in medTxDv) { DataRow newRow; newRow = medDs.Tables[0].NewRow(); newRow["Medication"] = drv.Row["MedTxAgent"]; newRow["MedDose"] = drv.Row["MedTxDose"]; newRow["MedUnits"] = drv.Row["MedTxUnits"]; newRow["MedSchedule"] = drv.Row["MedTxSchedule"]; newRow["MedIndication"] = drv.Row["MedTxIndication"]; newRow["MedRoute"] = drv.Row["MedTxRoute"]; newRow["MedDateText"] = drv.Row["MedTxDateText"]; newRow["MedDate"] = drv.Row["MedTxDate"]; newRow["MedStopDateText"] = drv.Row["MedTxStopDateText"]; medDs.Tables[0].Rows.Add(newRow); } } // set the number of blank rows that are added to the medications section if (medDs.Tables.Count > 0 && medDs.Tables[0].Rows.Count > 0) { int numBlankMedRows = minNumMedRowsToShow - medDs.Tables[0].Rows.Count; // be sure you have at least the number of blank rows specified earlier if (numBlankMedRows < minNumBlankMedRows) { numBlankMedRows = minNumBlankMedRows; } // add the blank rows for (int i = 0; i < numBlankMedRows; i++) { DataRow blankMedsRow; blankMedsRow = medDs.Tables[0].NewRow(); blankMedsRow["Medication"] = " "; blankMedsRow["MedDose"] = " "; blankMedsRow["MedSchedule"] = " "; blankMedsRow["MedDateText"] = " "; blankMedsRow["MedStopDateText"] = " "; blankMedsRow["MedIndication"] = " "; blankMedsRow["MedRoute"] = " "; blankMedsRow["MedDate"] = "12/31/9999"; // temp fix to facilitate sorting - VERY HACKY - jf medDs.Tables[0].Rows.Add(blankMedsRow); } DataView medDv = new DataView(medDs.Tables[0]); medDv.Sort = "MedDate, MedStopDate, Medication"; AdditionalGUMedicationSection.DataSource = medDv; } else { AdditionalGUMedicationSection.DataSource = BlankMedications(numRowsToShowIfNoRecords).DefaultView; } } else { AdditionalGUMedicationSection.DataSource = BlankMedications(numRowsToShowIfNoRecords).DefaultView; } AdditionalGUMedicationSection.DataBind(); }