protected void FilterByDisease(object sender, EventArgs e) { string[] stages = new string[] { "T", "N", "M", "S" }; CaisisSelect cs = (CaisisSelect)sender; string disease = cs.RefList["ClinStageDisease"].ToString(); if (!string.IsNullOrEmpty(disease)) { disease = disease.Replace(" ", ""); foreach (ListItem item in cs.Items) { string yearText = string.Join(null, System.Text.RegularExpressions.Regex.Split(item.Text, "[^\\d]")); int parsedNum; string year = ""; if (!string.IsNullOrEmpty(yearText) && int.TryParse(yearText, out parsedNum)) { year = yearText; } else { year = item.Text; } if (!string.IsNullOrEmpty(year)) { bool enable = false; foreach (string stage in stages) { string lkpCode = "StageClin_" + disease + "_" + year + "_" + stage; DataTable results = CacheManager.GetLookupCodeList(lkpCode); if (results.Rows.Count > 0) { enable = true; break; } } item.Enabled = enable; } } } }
private void BuildImgCompared(Control container, int?diagnosticId) { CaisisSelect imgCompared = FindInputControl(container, Diagnostic.ImgCompared) as CaisisSelect; if (imgCompared != null) { int patientId = int.Parse(BaseDecryptedPatientId); var allDiagnostics = new DiagnosticDa().GetDiagnosticsByType(patientId, ImageTypes).DefaultView; var prevDiagnostics = from diagnostic in allDiagnostics.Table.AsEnumerable() let rowDiagnosticId = (int)diagnostic[Diagnostic.DiagnosticId] let dxType = diagnostic[Diagnostic.DxType] let dxDate = diagnostic[Diagnostic.DxDate] // exclude current ? where !diagnosticId.HasValue || diagnosticId.Value != rowDiagnosticId // display text as "Bone Scan 01/26/2010" and value = diag id let displayText = string.Format("{0} {1:d}", dxType, dxDate) let sortDate = !diagnostic.IsNull(Diagnostic.DxDate) ? (DateTime)dxDate : DateTime.MaxValue orderby sortDate ascending select new { DiagnosticText = displayText, DiagnosticId = rowDiagnosticId }; // build dropdown imgCompared.DataSource = prevDiagnostics; imgCompared.DataBind(); // SPECIAL CASE: for current diagnostic, check if there is a related record, used as compare to for follow up scans if (diagnosticId.HasValue) { // get related diagnostic id var relatedDiagnostics = Caisis.Controller.RelatedRecordController.GetRelatedRecords("Diagnostics", diagnosticId.Value, "Diagnostics"); // set related diagnostic if (relatedDiagnostics.Count() > 0) { int relatedDiagnosticId = (int)relatedDiagnostics.First()[RelatedRecord.DestPrimaryKey]; PageUtil.SelectDropDownItem(imgCompared, relatedDiagnosticId.ToString()); } } } }
protected void SetAttributionFields(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int rowIndex = e.Row.DataItemIndex; string toxAttributionId = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttributionId).ToString(); string toxAttribution = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttribution_Field).ToString(); string toxAttributionProbability = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttributionProbability).ToString(); string toxAttributionAction = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttributionAction).ToString(); Label toxAttributionLabel = e.Row.FindControl("ToxAttributionLabel") as Label; ICaisisInputControl toxAttributionField = e.Row.FindControl("ToxAttributionField") as ICaisisInputControl; CaisisSelect toxProbField = e.Row.FindControl("ToxProbabilityField") as CaisisSelect; CaisisSelect toxActionField = e.Row.FindControl("ToxActionField") as CaisisSelect; toxAttributionLabel.Text = toxAttribution; toxAttributionField.Value = toxAttribution; //toxProbField.DataBound += (a, b) => toxProbField.Value = toxAttributionProbability; //toxActionField.DataBound += (a, b) => toxActionField.Value = toxAttributionAction; } }
/// <summary> /// When grid is bound, bind organization select in footer row /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void HandleOrgBound(object sender, EventArgs e) { ProjectManagementDa projDA = new ProjectManagementDa(); //ProjectOrganization biz = new ProjectOrganization(); //biz.GetAll(); DataView view = projDA.GetAllOrgsByContactId(contactId).DefaultView; DataView notAssociates = projDA.GetAllUnassociatedOrgsByContact(contactId).DefaultView; // After Grid has been bound, locate OrgSelects and bind to unassociates organizations int blankStart = OrgGrid2.Rows.Count - notAssociates.Count; for (int i = 0; i < OrgGrid2.Rows.Count; i++) { GridViewRow row = OrgGrid2.Rows[i]; CaisisSelect OrgSel = row.FindControl("OrgSel") as CaisisSelect; //CaisisComboBox OrgRoleBlank = row.FindControl("OrgRoleBlank") as CaisisComboBox; CaisisComboBox CaisisComboOrgRole = row.FindControl("CaisisComboOrgRole") as CaisisComboBox; ImageButton OrgDelBtn = row.FindControl("OrgDelBtn") as ImageButton; // Hide delete button from blank rows if (i >= blankStart) { OrgDelBtn.Visible = false; } //OrgSel.DataSource = biz.DataSourceView;//view; OrgSel.DataSource = BusinessObject.GetAllAsDataView <ProjectOrganization>(); OrgSel.DataBind(); // Extract organization ID from grid keys string orgId = OrgGrid2.DataKeys[i][ProjectOrganization_ProjectContact.OrganizationId].ToString();; OrgSel.Value = orgId; if (!string.IsNullOrEmpty(orgId)) { OrgSel.Enabled = false; } } }
/// <summary> /// Binds repeater to DataSource in matching CaisisSelect /// </summary> /// <param name="clinRep"></param> /// <param name="clinSel"></param> protected void BindRepeater(Repeater clinRep, CaisisSelect clinSel, HtmlAnchor showLink) { clinRep.DataSource = clinSel.DataSource; clinRep.DataBind(); // If select contains Values, populate Repeater with data if (clinSel.Items.Count > 0) { if (Page.IsPostBack && clinSel.Enabled) { showLink.Attributes.Clear(); showLink.Attributes.Add("onclick", "showClinStage('" + clinSel.Field + "Div')"); } else { showLink.Attributes.Clear(); //showLink.Attributes.Add("onclick", "alert('There are no values for " + clinSel.ID + "');"); } } else { showLink.Attributes.Clear(); showLink.Attributes.Add("onclick", "alert('There are no values for " + clinSel.ID + "');"); } }
/// <summary> /// Sets the data source for organization dropdown /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetOrgDropDown(object sender, GridViewRowEventArgs e) { int rowIndex = e.Row.RowIndex; CaisisSelect orgDropDown = e.Row.FindControl("OrganizationDropDown") as CaisisSelect; if (rowIndex > -1 && orgDropDown != null) { DataView dropDownView; // Blank row drop down should only contain those unassociated orgs if (AssociatedOrgsGrid.BlankRowIndexes.Contains(rowIndex)) { dropDownView = unAssociatedOrgs; } // Existing records should bind to existing orgs in project // and should be disabled, not allowing organization to be changed else { dropDownView = associatedOrgs; orgDropDown.Enabled = false; } orgDropDown.DataSource = dropDownView; orgDropDown.DataBind(); } }
protected void SetAttributionFields(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int rowIndex = e.Row.DataItemIndex; string toxAttributionId = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttributionId).ToString(); string toxAttribution = DataBinder.Eval(e.Row.DataItem, ToxAttribution.ToxAttribution_Field).ToString(); // data bind attributions CaisisSelect attributionField = e.Row.FindControl("ToxAttributionField") as CaisisSelect; attributionField.DataSource = protocolMedTxAgents; attributionField.DataBind(); // set values based on index if (string.IsNullOrEmpty(toxAttributionId) && rowIndex < protocolMedTxAgents.Length) { string defaultValue = protocolMedTxAgents[rowIndex]; attributionField.Value = defaultValue; } else { attributionField.Value = toxAttribution; } } }
private void PopulateSpecimenDetailsRow(Control row, int specimenId) { // Core HiddenField SpecimenNumField = row.FindControl("SpecimenNumField") as HiddenField; HiddenField SpecimenSubTypeField = row.FindControl("SpecimenSubTypeField") as HiddenField; CaisisTextBox StatusDate = row.FindControl("StatusDate") as CaisisTextBox; // Sequencing CaisisSelect Sequencing_Failed_Reason = row.FindControl("Sequencing_Failed_Reason") as CaisisSelect; CaisisRadioButtonList Extraction_Radio = row.FindControl("Extraction_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Library_Radio = row.FindControl("Library_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Sequenced_Radio = row.FindControl("Sequenced_Radio") as CaisisRadioButtonList; // Analysis CaisisRadioButtonList Analysis_Radio = row.FindControl("Analysis_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Pathology_Radio = row.FindControl("Pathology_Radio") as CaisisRadioButtonList; // Pathology CaisisSelect Analysis_Failed_Reason = row.FindControl("Analysis_Failed_Reason") as CaisisSelect; CaisisComboBox SpecimenConditionNotes = row.FindControl("SpecimenConditionNotes") as CaisisComboBox; Specimen specimen = new Specimen(); specimen.Get(specimenId); string num = specimen[BOL.Specimen.SpecimenReferenceNumber].ToString(); string status = specimen[BOL.Specimen.SpecimenStatus].ToString(); string notes = specimen[BOL.Specimen.SpecimenNotes].ToString(); SpecimenNumField.Value = num; SpecimenSubTypeField.Value = specimen[BOL.Specimen.SpecimenSubType].ToString(); SpecimenEvents specimenEvent = GetSequencingEvent(specimenId); // applies to all if (specimenEvent != null) { StatusDate.Value = string.Format("{0:d}", specimenEvent[SpecimenEvents.EventDate]); } // set relevant radios if (InventoryMode == SpecimenInventoryMode.Sequencing) { switch (status) { case "Tissue Extraction Successful": Extraction_Radio.Value = ANSWER_YES; break; case "Tissue Extraction Unsuccessful": Extraction_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; case "Library Construction Successful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; break; case "Library Construction Unsuccessful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; case "Sequenced": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; Sequenced_Radio.Value = ANSWER_YES; break; case "Sequencing Unsuccessful": Extraction_Radio.Value = ANSWER_YES; Library_Radio.Value = ANSWER_YES; Sequenced_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Sequencing_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; default: Extraction_Radio.ClearSelection(); Library_Radio.ClearSelection(); Sequenced_Radio.ClearSelection(); break; } } else if (InventoryMode == SpecimenInventoryMode.Analysis) { switch (status) { case "Analysis Complete": Analysis_Radio.Value = ANSWER_YES; break; case "Analysis Unsuccessul": Analysis_Radio.Value = ANSWER_NO; if (specimenEvent != null && !specimenEvent.IsNull(SpecimenEvents.EventResult)) { Analysis_Failed_Reason.Value = specimenEvent[SpecimenEvents.EventResult].ToString(); } break; default: Analysis_Radio.ClearSelection(); break; } } else if (InventoryMode == SpecimenInventoryMode.Pathology) { switch (status) { case "Pathology Review Completed": Pathology_Radio.Value = ANSWER_YES; break; case "Banked by Pathology": Pathology_Radio.Value = ANSWER_NO; break; default: Pathology_Radio.ClearSelection(); break; } // build condition list, fill into notes field DataTable conditions = new DataTable(); conditions.Columns.Add("Condition"); string foundCondition = ""; foreach (string condition in specimenController.GetConditions()) { // find selected if (specimenController.GetSpecimenCondition(notes) == condition) { foundCondition = condition; } // add data conditions.Rows.Add(new object[] { condition }); } SpecimenConditionNotes.BuildComboData(conditions, "Condition", "Condition"); SpecimenConditionNotes.Value = notes; } }
private void UpdateSpecimenDetailsRow(Control row, int specimenId) { // Core HiddenField SpecimenNumField = row.FindControl("SpecimenNumField") as HiddenField; HiddenField SpecimenSubTypeField = row.FindControl("SpecimenSubTypeField") as HiddenField; CaisisTextBox StatusDate = row.FindControl("StatusDate") as CaisisTextBox; // Sequencing CaisisSelect Sequencing_Failed_Reason = row.FindControl("Sequencing_Failed_Reason") as CaisisSelect; CaisisRadioButtonList Extraction_Radio = row.FindControl("Extraction_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Library_Radio = row.FindControl("Library_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Sequenced_Radio = row.FindControl("Sequenced_Radio") as CaisisRadioButtonList; // Analysis CaisisRadioButtonList Analysis_Radio = row.FindControl("Analysis_Radio") as CaisisRadioButtonList; CaisisRadioButtonList Pathology_Radio = row.FindControl("Pathology_Radio") as CaisisRadioButtonList; // Pathology CaisisSelect Analysis_Failed_Reason = row.FindControl("Analysis_Failed_Reason") as CaisisSelect; CaisisComboBox SpecimenConditionNotes = row.FindControl("SpecimenConditionNotes") as CaisisComboBox; // shared variables string status = ""; DateTime?statusDate = null; if (!string.IsNullOrEmpty(StatusDate.Value)) { statusDate = DateTime.Parse(StatusDate.Value); } if (InventoryMode == SpecimenInventoryMode.Sequencing) { string failedReason = Sequencing_Failed_Reason.Value; string statusResult = ""; // determine new status, top down if (Extraction_Radio.Value == ANSWER_NO) { status = "Tissue Extraction Unsuccessful"; statusResult = failedReason; } else if (Extraction_Radio.Value == ANSWER_YES) { if (Library_Radio.Value == ANSWER_NO) { status = "Library Construction Unsuccessful"; statusResult = failedReason; } else if (Library_Radio.Value == ANSWER_YES) { if (Sequenced_Radio.Value == ANSWER_NO) { status = "Sequencing Unsuccessful"; statusResult = failedReason; } else if (Sequenced_Radio.Value == ANSWER_YES) { status = "Sequenced"; } else { status = "Library Construction Successful"; } } else { status = "Tissue Extraction Successful"; } } // update event if (!string.IsNullOrEmpty(status) || statusDate.HasValue || !string.IsNullOrEmpty(statusResult)) { UpdateSequencingEvent(specimenId, status, statusDate, statusResult); } } else if (InventoryMode == SpecimenInventoryMode.Pathology) { if (Pathology_Radio.Value == ANSWER_YES) { status = "Pathology Review Completed"; } else if (Analysis_Radio.Value == ANSWER_NO) { status = "Banked by Pathology"; } // update event if (!string.IsNullOrEmpty(status) || statusDate.HasValue) { UpdateSequencingEvent(specimenId, status, statusDate, ""); } } else if (InventoryMode == SpecimenInventoryMode.Analysis) { string failedReason = Analysis_Failed_Reason.Value; if (Analysis_Radio.Value == ANSWER_YES) { status = "Analysis Complete"; // on successful analysis, update event UpdateSequencingEvent(specimenId, status, statusDate, ""); } else if (Analysis_Radio.Value == ANSWER_NO) { status = "Analysis Unsuccessul"; UpdateSequencingEvent(specimenId, status, statusDate, failedReason); } } // update specimen status if (!string.IsNullOrEmpty(status)) { Specimen specimen = new Specimen(); specimen.Get(specimenId); specimen[Specimen.SpecimenStatus] = status; // special case if (InventoryMode == SpecimenInventoryMode.Pathology) { specimen[Specimen.SpecimenNotes] = SpecimenConditionNotes.Value; } specimen.Save(); } }
protected void SetEformFields(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemIndex > -1) { int patientId = (int)DataBinder.Eval(e.Item.DataItem, Patient.PatientId); string mrn = DataBinder.Eval(e.Item.DataItem, Patient.PtMRN).ToString(); string name = DataBinder.Eval(e.Item.DataItem, "Name").ToString().Replace(",", ", "); string currentStatus = DataBinder.Eval(e.Item.DataItem, "CurrentStatus").ToString(); string currentEFormApptPhysician = DataBinder.Eval(e.Item.DataItem, "EFormApptPhysician").ToString(); CaisisSelect statusList = e.Item.FindControl("StatusField") as CaisisSelect; CaisisSelect EFormApptPhysicianField = e.Item.FindControl("EFormApptPhysicianField") as CaisisSelect; Label mrnLabel = e.Item.FindControl("PtMRN") as Label; Label ptLabel = e.Item.FindControl("PtLabel") as Label; statusList.DataSource = EFormStatuses; // EformStatusManager.GetEformStatuses(); statusList.DataBind(); statusList.Value = currentStatus; //AppointmentDa aptDa = new AppointmentDa(); //EFormApptPhysicianField.DataSource = aptDa.GetDistinctAppointmentPhysicians().Tables[0].DefaultView; //EFormApptPhysicianField.DataTextField = "ApptPhysician"; //EFormApptPhysicianField.DataValueField = "ApptPhysician"; //EFormApptPhysicianField.DataBind(); EFormApptPhysicianField.Value = currentEFormApptPhysician; if (DataBinder.Eval(e.Item.DataItem, "EFormApptTime").ToString().Length > 0) { CaisisTextBox EFormApptTimeField = e.Item.FindControl("EFormApptTimeField") as CaisisTextBox; EFormApptTimeField.Value = ((DateTime)(DataBinder.Eval(e.Item.DataItem, "EFormApptTime"))).ToShortDateString(); } // set identified fields mrnLabel.Text = pc.GetPatientMRN(mrn); ptLabel.Text = canViewIdentifiers ? name : pc.GetPatientName(" ", " ", true); // set identifier string selectedIdType = IdTypeSelection.Value + ""; bool displayIdentifier = selectedIdType != PatientController.LAST_NAME_MRN_IDENTIFIER; Label idTypeLabel = e.Item.FindControl("IdType") as Label; Label idValueLabel = e.Item.FindControl("IdTypeValue") as Label; if (displayIdentifier) { idTypeLabel.Text = selectedIdType + ":"; idValueLabel.Text = pc.GetPatientIdentifier(patientId, selectedIdType); idTypeLabel.Visible = true; idValueLabel.Visible = true; } else { idTypeLabel.Visible = false; idValueLabel.Visible = false; } } }
/// <summary> /// During databinding, dynamically insert ICaisisInputControls into placeholder /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BuildControlsAndLabel(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { EformField field = (EformField)e.Item.DataItem; // supress DATE FIELDS if (field.Field.EndsWith("Date")) { e.Item.Visible = false; } else { ICaisisInputControl iCIC = CICHelper.InvokeInputControl(field.ControlType); if (iCIC is CaisisTextArea) { iCIC = new CaisisTextBox(); (iCIC as CaisisTextBox).ShowTextEditor = true; } iCIC.ShowLabel = false; iCIC.Table = field.Table; iCIC.Field = field.Field; PlaceHolder dynamicHolder = e.Item.FindControl("DynamicControlPlaceHolder") as PlaceHolder; dynamicHolder.Controls.Add(iCIC as Control); if (!(iCIC is CaisisHidden)) { CICHelper.SetStaticFieldAttributes(dynamicHolder.Controls, field.Table); } // FIX?? needs to be centralized if (iCIC is CaisisSelect) { CaisisSelect cs = iCIC as CaisisSelect; string lookupCode = cs.LookupCode; if (!string.IsNullOrEmpty(cs.LookupDistinct) && cs.LookupDistinct.IndexOf(SessionKey.PatientId) > -1) { if (Session[SessionKey.PatientId] != null | Session[SessionKey.PatientId].ToString() != string.Empty) { CICHelper.HandleLookupDistinctAttribute(cs, cs.LookupDistinct, this.Page.Session); this.EnableViewState = true; } } else if (lookupCode != null && lookupCode.Length > 0) { cs.DataSource = CacheManager.GetLookupCodeList(lookupCode).DefaultView; cs.DataTextField = "LkpCode"; cs.DataValueField = "LkpCode"; cs.DataBind(); } } if (Caisis.BOL.BusinessObject.HasLabel(field.Table, field.Field)) { iCIC.FieldLabel = Caisis.BOL.BusinessObject.GetLabel(field.Table, field.Field); } else { iCIC.FieldLabel = field.Field; } Label fieldLabel = e.Item.FindControl("FieldLabel") as Label; fieldLabel.Text = iCIC.FieldLabel; if (BusinessObject.IsRequired(iCIC.Table, iCIC.Field)) { fieldLabel.CssClass = fieldLabel.CssClass + " RequiredField"; fieldLabel.ToolTip = "Required Field"; } if (iCIC is CaisisTextBox) { //(iCIC as CaisisTextBox).ShowCalendar = false; } } } }
private void PopulateTimeInterface(CaisisSelect HourSelect, CaisisSelect MinuteSelect, CaisisSelect AmPmSelect) { // if culture is set to "en-US", use 12 hr time, else, use 24hr time if (CultureIsUS.Text == "true") { for (int i = 1; i <= 12; i++) { ListItem li1 = new ListItem(i.ToString("00"), i.ToString("00")); HourSelect.Items.Add(li1); } } else { for (int i = 1; i <= 24; i++) { ListItem li1 = new ListItem(i.ToString("00"), i.ToString("00")); HourSelect.Items.Add(li1); } } for (int i = 0; i <= 59; i++) { ListItem li2 = new ListItem(i.ToString("00"), i.ToString("00")); MinuteSelect.Items.Add(li2); } ListItem li3 = new ListItem("am", "am"); AmPmSelect.Items.Add(li3); li3 = new ListItem("pm", "pm"); AmPmSelect.Items.Add(li3); }