示例#1
0
 /// <summary>
 /// Builds static list of available Lookup Codes
 /// </summary>
 /// <param name="combo"></param>
 private void BuildLookupCodeCombo(ICaisisInputControl icic)
 {
     if (icic is CaisisComboBox)
     {
         CaisisComboBox combo = icic as CaisisComboBox;
         combo.BuildComboData(LookupCodesTable, LookupCode.LkpFieldName, LookupCode.LkpFieldName);
     }
 }
示例#2
0
        private void AddEntryField(ICaisisInputControl control)
        {
            // TODO: handle control.Required
            if (control.Required)
            {
                controlsToValidate.Add(control as Control);
            }

            // TODO: styles and other whatnots
            Panel panel = new Panel();

            panel.CssClass = "DataEntryRow";
            panel.Controls.Add((Control)control);

            // Special Cases
            if ((MatchProtocol("c12-097") || MatchProtocol("c10-070")) && control.Table == "Status" && control.Field == "Status" && control is ListControl)
            {
                ListControl listControl = control as ListControl;
                listControl.PreRender += (a, b) =>
                {
                    listControl.DataTextField  = "";
                    listControl.DataValueField = "";
                    listControl.DataSource     = PATIENT_STATUSES;
                    listControl.DataBind();
                };
            }
            else if (MatchProtocol("c12-108") && control.Table == "Categories" && control.Field == "Category" && control is ICaisisLookupControl)
            {
                // build static data
                string[]  values    = new string[] { "Positive", "Negative" };
                DataTable comboData = new DataTable();
                comboData.Columns.Add(new DataColumn("Category"));
                foreach (string value in values)
                {
                    comboData.Rows.Add(value);
                }
                CaisisComboBox combo  = control as CaisisComboBox;
                CaisisSelect   select = control as CaisisSelect;
                if (combo != null)
                {
                    combo.BuildComboData(comboData, "Category", "Category");
                }
                else if (select != null)
                {
                    select.PreRender += (a, b) =>
                    {
                        select.DataTextField  = "Category";
                        select.DataValueField = "Category";
                        select.DataSource     = comboData;
                        select.DataBind();
                    };
                }
            }

            container.Controls.Add(panel);
        }
示例#3
0
        /// <summary>
        /// Sets the event and detail name to "disabled", enabled on client side
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void SetComboDisable(object sender, GridViewRowEventArgs e)
        {
            CaisisComboBox nameField = e.Row.FindControl("NameComboBox") as CaisisComboBox;
            ImageButton    editBtn   = e.Row.FindControl("EditBtn") as ImageButton;

            if (nameField != null && editBtn != null)
            {
                nameField.Attributes["disabled"] = bool.TrueString.ToLower();
                editBtn.OnClientClick            = "return editField('" + nameField.ClientID + "');";
            }
        }
示例#4
0
 protected void SetProcedures(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         // set proc name drop down
         CaisisComboBox combo = e.Row.FindControl("ProcName") as CaisisComboBox;
         if (combo != null)
         {
             combo.BuildComboData(procedureLookupNames, "LkpCode", "LkpDescription");
         }
     }
 }
        /// <summary>
        /// Dynamically set columns
        /// </summary>
        private void InitSpecimensGrid()
        {
            SpecimenAccession accession = new SpecimenAccession();
            Specimen specimen = new Specimen();
            var accessionFields = accession.FieldNames;
            var specimenFields = specimen.FieldNames;
            var specimenMetadata = CICHelper.GetCaisisInputControlsByTableName(specimen.TableName, "").ToDictionary(f => f.Field, f => f);
            //SpecimenInventory.Columns.Clear();
            foreach (var column in GetSpecimenColumns())
            {
                string fieldName = column.Key;
                string fieldLabel = column.Value;
                // get input
                CaisisTextBox defaultInput = new CaisisTextBox();
                ICaisisInputControl fieldInput = defaultInput;
                // special case: lookup controls map to distinct combo values
                if (specimenFields.Contains(fieldName) && specimenMetadata.ContainsKey(fieldName))
                {
                    fieldInput = specimenMetadata[fieldName];
                    // select, radio list, check list => combo box
                    if (fieldInput is ICaisisLookupControl && !(fieldInput is CaisisComboBox))
                        fieldInput = new CaisisComboBox();
                    fieldInput.Table = specimen.TableName;
                }

                // global
                fieldInput.Field = fieldName;
                fieldInput.FieldLabel = fieldLabel;
                fieldInput.ShowLabel = false;

                CaisisDataBoundField boundField = new CaisisDataBoundField(fieldInput);
                SpecimenInventory.Columns.Add(boundField);
            }
            // only enable specimen fields for edit
            SpecimenInventory.RowCreated += (o, e) =>
                {
                    var inputs = CICHelper.GetCaisisInputControls(e.Row);
                    foreach (var fieldInput in inputs)
                    {
                        if (fieldInput.Table == specimen.TableName)
                        {
                            fieldInput.Enabled = true;
                            // special lookup distinct
                            if (fieldInput is ICaisisLookupControl)
                                (fieldInput as ICaisisLookupControl).LookupDistinct = string.Format("{0};{1};{2}", specimen.TableName, fieldInput.Field, fieldInput.Field);
                        }
                        else
                        {
                            fieldInput.Enabled = false;
                        }
                    }
                };
        }
示例#6
0
        /// <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;
                }
            }
        }
示例#7
0
        //to check the Type is not null, before Add/Update events in different RowTypes of gridview control
        protected void AddClickEventToButtons(object sender, GridViewRowEventArgs e)
        {
            //adding new event
            if (e.Row.RowType == DataControlRowType.EmptyDataRow)
            {
                ImageButton    emptyrowAddBtn  = e.Row.FindControl("EvtAdd") as ImageButton;
                CaisisComboBox emptyrowevtTest = e.Row.FindControl("EvtTest") as CaisisComboBox;
                if (emptyrowAddBtn != null && emptyrowevtTest != null)
                {
                    emptyrowAddBtn.Attributes["onclick"] = "return validateTest('" + emptyrowevtTest.ClientID + "');";
                }
            }
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //delete existing event
                ImageButton deleteBtn = e.Row.FindControl("DeleteBtn") as ImageButton;
                if (deleteBtn != null)
                {
                    deleteBtn.Attributes["onclick"] = "return confirm('Are you sure you want to delete this event?');";
                }

                //updating existing event data in edit mode
                ImageButton    saveBtn = e.Row.FindControl("SaveRowBtn") as ImageButton;
                CaisisComboBox evtTest = e.Row.FindControl("EvtTest1") as CaisisComboBox;
                if (saveBtn != null && evtTest != null)
                {
                    saveBtn.Attributes["onclick"] = "return validateTest('" + evtTest.ClientID + "');";
                }

                //getting Specimen Reference # to view report
                DataRowView       drv        = (DataRowView)e.Row.DataItem;
                int               id         = int.Parse(drv["SpecimenId"].ToString());
                SpecimenManagerDa da         = new SpecimenManagerDa();
                string            datasetSQL = CacheManager.GetDatasetSQL(Session[SessionKey.DatasetId]);
                DataTable         dt         = da.GetIdentifier(id, _identifierType, datasetSQL);
                string            str        = dt.Rows[0].ItemArray[3].ToString();
                string            refnum;

                //to get the substring of ReferenceNumber removing from first hyphen(-)
                if (str.Contains("-"))
                {
                    int index = str.IndexOf(@"-");
                    refnum = str.Substring(0, index);
                }
                else
                {
                    refnum = str;
                }

                //show URL button for only processed aCGH tests
                //commented this section temporarily

                /*
                 * string testValue = drv["EventType"].ToString();
                 * string testProcessedBy = drv["ProcessedBy"].ToString();
                 *
                 * Button urlBtn1 = e.Row.FindControl("EvtURL1") as Button;
                 * if (testValue == "aCGH" && testProcessedBy == "")
                 * {
                 *  SpecimenEventsGridViewTable.FindControl("hdrRpt").Visible = true;
                 *  SpecimenEventsGridView.Columns[11].Visible = true;
                 * }
                 * if (urlBtn1 != null)
                 * {
                 *  if (testValue == "aCGH" && testProcessedBy == "")
                 *  {
                 *      urlBtn1.Attributes["onclick"] = "window.open('http://aji.cbio.mskcc.org/btc/" + refnum + "/index.html','_new'); return false;";
                 *      urlBtn1.Style["visibility"] = "visible";
                 *      urlBtn1.NamingContainer.Visible = true;
                 *  }
                 * }
                 */

                // enable edit click
                ImageButton editBtn = e.Row.FindControl("EditImage") as ImageButton;
                editBtn.OnClientClick = "enableGridFields(" + e.Row.RowIndex + ");return false;";
            }
            if (e.Row.RowType == DataControlRowType.Footer)
            {
                //Adding new event, with some events already existing
                ImageButton    AddBtn        = e.Row.FindControl("EvntAdd1") as ImageButton;
                CaisisComboBox footerevtTest = e.Row.FindControl("EvtTest2") as CaisisComboBox;
                if (AddBtn != null && footerevtTest != null)
                {
                    AddBtn.Attributes["onclick"] = "return validateTest('" + footerevtTest.ClientID + "');";
                }
            }
        }
        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();
            }
        }