コード例 #1
0
ファイル: ORThoracic.ascx.cs プロジェクト: aomiit/caisis
 //Updates Node finding values
 protected void updateNodeFindingSideSite(EformRadioButton notSampledRadio, EformTextBox findingSide, EformTextBox findingSite, string findingSideVal, string findingSiteVal)
 {
     if (notSampledRadio.Checked == true)
     {
         findingSide.Text = findingSideVal;
         findingSite.Text = findingSiteVal;
     }
 }
コード例 #2
0
 protected virtual void CheckSiteOfDisease(DataTable SurveyItemTable, string Site, EformRadioButton PresentRadio, EformRadioButton AbsentRadio)
 {
     if (!PresentRadio.Checked && !AbsentRadio.Checked)
     {
         for (int i = 0; i < SurveyItemTable.Rows.Count; i++)
         {
             if (SurveyItemTable.Rows[i]["SurveyItem"].ToString().ToUpper().Equals(Site.ToUpper()))
             {
                 if (SurveyItemTable.Rows[i]["SurveyItemResult"].ToString().ToUpper().Equals("PRESENT"))
                 {
                     PresentRadio.Checked      = true;
                     SurveyType_1.Disabled     = false;
                     SurveyDate_1.Disabled     = false;
                     SurveyDateText_1.Disabled = false;
                 }
                 else if (AbsentRadio != null && SurveyItemTable.Rows[i]["SurveyItemResult"].ToString().ToUpper().Equals("ABSENT"))
                 {
                     AbsentRadio.Checked       = true;
                     SurveyType_1.Disabled     = false;
                     SurveyDate_1.Disabled     = false;
                     SurveyDateText_1.Disabled = false;
                 }
             }
         }
     }
 }
コード例 #3
0
        /// <summary>
        /// Writes value from control to matching Xml node.
        /// </summary>
        /// <param name="con"></param>
        /// <param name="xDoc"></param>
        protected void WriteControlValueToXmlNode(Control con, XmlDocument xDoc)
        {
            // TODO: give this method the parent id treatment
            if (con is EformHidden)
            {
                IEformInputField tb = (IEformInputField)con;
                this.SetXmlNodeValue(tb, xDoc);
            }
            else if (con is EformTextBox)
            {
                EformTextBox tb = (EformTextBox)con;
                this.SetXmlNodeValue(tb, xDoc);
            }

            else if (con is EformComboBox)
            {
                IEformInputField tb = (IEformInputField)con;
                this.SetXmlNodeValue(tb, xDoc);
            }

            else if (con is EformTextArea)
            {
                IEformInputField tb = (IEformInputField)con;
                this.SetXmlNodeValue(tb, xDoc);
            }

            else if (con is EformDropDownList)
            {
                IEformInputField tb = (IEformInputField)con;
                this.SetXmlNodeValue(tb, xDoc);
            }
            else if (con is EformSelect)
            {
                EformSelect es = (EformSelect)con;
                this.SetXmlNodeValue(es, xDoc);
            }
            else if (con is EformCheckBox)
            {
                EformCheckBox cb = (EformCheckBox)con;

                string recordId = cb.RecordId;
                // XmlNode node = null;

                /*
                 #region get node
                 * // use recordId to locate the node if it is set
                 * if (recordId != null && !recordId.Equals(""))
                 * {
                 *      string xPath = "//"+cb.Table+"[attribute::RecordId='"+recordId+"']";
                 *      XmlNode parentNode = xDoc.SelectSingleNode(xPath);
                 *      if (parentNode != null)
                 *      {
                 *              node = parentNode.SelectSingleNode("child::"+cb.Field);
                 *      }
                 * }
                 * else // in all other cases, find the first node that matches the table and field name.
                 * {
                 *      string xpath = "//" + cb.Table + "/" + cb.Field;
                 *
                 *      node = xDoc.SelectSingleNode(xpath);
                 * }
                 #endregion
                 */

                XmlNode node = GetXmlNode(cb.Table, cb.Field, cb.RecordId, cb.ParentRecordId, xDoc);

                if (node != null)
                {
                    string val = Request.Form[con.UniqueID];

                    if (val != null && val.Equals("on"))
                    {
                        // brandon: cb.Text is the text label (sigh. ask Microsoft)
                        // node.InnerText = cb.Text;
                        node.InnerText = cb.Value;
                    }
                    else
                    {
                        node.InnerText = "";
                    }
                }
            }
            else if (con is EformRadioButton)
            {
                EformRadioButton rb = (EformRadioButton)con;

                string recordId = rb.RecordId;

                /*
                 * XmlNode node = null;
                 *
                 #region get node
                 * // use recordId to locate the node if it is set
                 * if (recordId != null && !recordId.Equals(""))
                 * {
                 *      string xPath = "//"+rb.Table+"[attribute::RecordId='"+recordId+"']";
                 *      XmlNode parentNode = xDoc.SelectSingleNode(xPath);
                 *      if (parentNode != null)
                 *      {
                 *              node = parentNode.SelectSingleNode("child::"+rb.Field);
                 *      }
                 * }
                 * else // in all other cases, find the first node that matches the table and field name.
                 * {
                 *      string xpath = "//" + rb.Table + "/" + rb.Field;
                 *
                 *      node = xDoc.SelectSingleNode(xpath);
                 * }
                 #endregion
                 *
                 */

                XmlNode node = GetXmlNode(rb.Table, rb.Field, rb.RecordId, rb.ParentRecordId, xDoc);

                if (node != null)
                {
                    string val = Request.Form[con.UniqueID];

                    if (val != null && val.Equals("on"))
                    {
                        // brandon: cb.Text is the text label (sigh. ask Microsoft)
                        // node.InnerText = cb.Text;
                        node.InnerText = rb.Value;
                    }
                    else
                    {
                        node.InnerText = "";
                    }
                }
            }
            else if (con is EformRadioButtonList)
            {
                // EformRadioButtonList rb = (EformRadioButtonList) con;
                EformRadioButtonList rb = (EformRadioButtonList)con;

                XmlNode node = FetchNode(xDoc, rb.Table, rb.Field, rb.RecordId, rb.ParentRecordId);

                if (node != null)
                {
                    node.InnerText = rb.Value;// Request.Form[con.UniqueID];

                    if (node.InnerText != null && !"".Equals(node.InnerText))
                    {
                        // handle additional fields
                        if (rb.Field1 != null && !"".Equals(rb.Field1))
                        {
                            XmlNode node1 = FetchNode(xDoc, rb.Table, rb.Field1, rb.RecordId, rb.ParentRecordId);
                            node1.InnerText = rb.Value1;
                        }

                        if (rb.Field2 != null && !"".Equals(rb.Field2))
                        {
                            XmlNode node2 = FetchNode(xDoc, rb.Table, rb.Field2, rb.RecordId, rb.ParentRecordId);
                            node2.InnerText = rb.Value2;
                        }

                        if (rb.Field3 != null && !"".Equals(rb.Field3))
                        {
                            XmlNode node3 = FetchNode(xDoc, rb.Table, rb.Field3, rb.RecordId, rb.ParentRecordId);
                            node3.InnerText = rb.Value3;
                        }
                    }
                }
            }
            else if (con is EformRadioButtonGroup)
            {
                // save each additional field
                // may also need to deal w/ xml for child controls
                EformRadioButtonGroup rg = (EformRadioButtonGroup)con;
                string val = rg.GetSelectedValue(this.Request);
                if (val != null && !"".Equals(val))
                {
                    // DO WE NEED TO WORRY ABOUT PARENT ID HERE?
                    if (rg.Field1 != null && !"".Equals(rg.Field1))
                    {
                        XmlNode node = FetchNode(xDoc, rg.Table, rg.Field1, rg.RecordId, rg.ParentRecordId);
                        node.InnerText = rg.Value1;
                    }

                    if (rg.Field2 != null && !"".Equals(rg.Field2))
                    {
                        XmlNode node = FetchNode(xDoc, rg.Table, rg.Field2, rg.RecordId, rg.ParentRecordId);
                        node.InnerText = rg.Value2;
                    }

                    if (rg.Field3 != null && !"".Equals(rg.Field3))
                    {
                        XmlNode node = FetchNode(xDoc, rg.Table, rg.Field3, rg.RecordId, rg.ParentRecordId);
                        node.InnerText = rg.Value3;
                    }

                    // we already know our value
                    EformRadioButton rb = rg.GetCheckedButton(this.Request);
                    if (rb != null)
                    {
                        XmlNode node = GetXmlNode(rg.Table, rg.Field, rg.RecordId, rg.ParentRecordId, xDoc);

                        if (node != null)
                        {
                            node.InnerText = rb.Value;
                        }
                    }
                }
                else                 // we will have to unset values if the user "cleared" the group of radio buttons
                {
                    if (rg.Field1 != null && !"".Equals(rg.Field1))
                    {
                        XmlNode node1 = FetchNode(xDoc, rg.Table, rg.Field1, rg.RecordId, rg.ParentRecordId);
                        node1.InnerText = null;
                    }

                    if (rg.Field2 != null && !"".Equals(rg.Field2))
                    {
                        XmlNode node2 = FetchNode(xDoc, rg.Table, rg.Field2, rg.RecordId, rg.ParentRecordId);
                        node2.InnerText = null;
                    }

                    if (rg.Field3 != null && !"".Equals(rg.Field3))
                    {
                        XmlNode node3 = FetchNode(xDoc, rg.Table, rg.Field3, rg.RecordId, rg.ParentRecordId);
                        node3.InnerText = null;
                    }

                    XmlNode node = GetXmlNode(rg.Table, rg.Field, rg.RecordId, rg.ParentRecordId, xDoc);

                    if (node != null)
                    {
                        node.InnerText = null;
                    }
                }
            }
            else if (con is EformCheckBoxList || con is EformRadioButtonList)
            {
                IEformInputField eFormControl = con as IEformInputField;
                this.SetXmlNodeValue(eFormControl, xDoc);
            }
        }
コード例 #4
0
        protected virtual void CheckSiteOfDisease(DataTable SurveyItemTable, string Site, EformRadioButton PresentRadio, EformRadioButton AbsentRadio)
        {
            if (!PresentRadio.Checked && !AbsentRadio.Checked)
            {
                for (int i = 0; i < SurveyItemTable.Rows.Count; i++)
                {
                    if (SurveyItemTable.Rows[i]["SurveyItem"].ToString().ToUpper().Equals(Site.ToUpper()))
                    {
                        if (SurveyItemTable.Rows[i]["SurveyItemResult"].ToString().ToUpper().Equals("PRESENT"))
                        {
                            //                      PresentRadio.Checked = true;

                            PrevSitesOfDiseaseVals.Text += "PrevSitesOfDiseaseValArray[PrevSitesOfDiseaseValArray.length++] = new PrevSitesOfDiseaseRecord('" + Site + "','Present', '" + PresentRadio.ClientID + "', '" + AbsentRadio.ClientID + "');";
                            //SurveyType_1.Disabled = false;
                            //SurveyDate_1.Disabled = false;
                            //SurveyDateText_1.Disabled = false;
                        }
                        else if (AbsentRadio != null && SurveyItemTable.Rows[i]["SurveyItemResult"].ToString().ToUpper().Equals("ABSENT"))
                        {
                            //                       AbsentRadio.Checked = true;
                            PrevSitesOfDiseaseVals.Text += "PrevSitesOfDiseaseValArray[PrevSitesOfDiseaseValArray.length++] = new PrevSitesOfDiseaseRecord('" + Site + "','Absent', '" + PresentRadio.ClientID + "', '" + AbsentRadio.ClientID + "');";
                            //SurveyType_1.Disabled = false;
                            //SurveyDate_1.Disabled = false;
                            //SurveyDateText_1.Disabled = false;
                        }
                    }
                }
            }
        }
コード例 #5
0
ファイル: BaseEFormControl.cs プロジェクト: aomiit/caisis
        /// <summary>
        ///
        /// </summary>
        /// <param name="con"></param>
        /// <param name="xmlDoc"></param>
        /// <param name="inputFieldValue"></param>
        protected void SetControlValue(IEformInputField con, XmlDocument xmlDoc, string inputFieldValue)
        {
            if (inputFieldValue != null)
            {
                // TODO: collapse this into a call on the IEformInputField interface
                if (con is EformTextBox)
                {
                    EformTextBox temp = (EformTextBox)con;
                    //temp.Value = inputFieldValue;
                    temp.Text = inputFieldValue;
                }

                else if (con is EformHidden)
                {
                    EformHidden temp = (EformHidden)con;
                    // let's experiment
                    string val = inputFieldValue;
                    if (temp.Field.EndsWith("Date")) // we want Dates enabled to pick up the DateText conversion
                    {
                        temp.Disabled = false;
                        // we need to propagate the value here, b/c it would be empty on the page
                        temp.Value = val;
                    }
                    else if (val == null || "".Equals(val))
                    {
                        temp.Disabled = true;
                    }
                    else
                    {
                        temp.Disabled = false;
                        // persist the value in this case
                        temp.Value = val;
                    }

                    // leave the value alone, keeping what was on the page;
                    // temp.Value = inputFieldValue;
                }

                else if (con is EformTextArea)
                {
                    EformTextArea temp = (EformTextArea)con;
                    //temp.Value = inputFieldValue;
                    temp.Text = inputFieldValue;
                }

                else if (con is EformDropDownList)
                {
                    EformDropDownList temp = (EformDropDownList)con;
                    //temp.Value = inputFieldValue;
                    temp.SelectedValue = inputFieldValue;
                }

                else if (con is EformComboBox)
                {
                    EformComboBox temp = (EformComboBox)con;
                    temp.Value = inputFieldValue;
                }

                //else if (con is EformRadioButtonList)
                //{
                //    EformRadioButtonList temp = (EformRadioButtonList)con;
                //    string val = inputFieldValue;

                //    if (val != null && !val.Equals(""))
                //        temp.SelectedValue = val;
                //}
                else if (con is EformRadioButtonGroup)
                {
                    EformRadioButtonGroup rg = (EformRadioButtonGroup)con;

                    // tell it to the child controls
                    foreach (Control c in rg.Controls)
                    {
                        if (c is EformRadioButton)
                        {
                            EformRadioButton rb = (EformRadioButton)c;

                            string nodeInnerText = GetNodeValue(rg, xmlDoc);

                            if (nodeInnerText != null && !"".Equals(nodeInnerText))
                            {
                                if (rb.Value.Equals(nodeInnerText))
                                {
                                    rb.Checked = true;
                                }
                            }
                        }
                    }
                }
                else if (con is EformRadioButton)
                {
                    EformRadioButton rb = (EformRadioButton)con;

                    string nodeInnerText = inputFieldValue;

                    if (nodeInnerText != null && nodeInnerText != "")
                    {
                        rb.Checked = true;
                    }
                }
                else if (con is EformCheckBox)
                {
                    EformCheckBox cb = (EformCheckBox)con;

                    string nodeInnerText = inputFieldValue;

                    if (nodeInnerText != null && nodeInnerText != "")
                    {
                        cb.Checked = true;
                    }
                }
                else if (con is EformSelect)
                {
                    EformSelect temp = (EformSelect)con;
                    temp.Text = inputFieldValue;
                }
                else if (con is EformCheckBoxList || con is EformRadioButtonList)
                {
                    IEformInputField eFormControl = con as IEformInputField;
                    eFormControl.Value = inputFieldValue;
                }
            }
        }