Example #1
0
        private static void getKEntry(XmlNodeList xnlist)
        {
            foreach (XmlNode xn in xnlist)
            {
                if (xn.SelectSingleNode("ID") == null)
                {
                    continue;
                }

                KEntry entry = new KEntry();
                entry.ID    = xn.SelectSingleNode("ID").InnerText;
                entry.Text  = xn.SelectSingleNode("Text").InnerText;
                entry.Value = xn.SelectSingleNode("Value").InnerText;
                entry.Style = xn.SelectSingleNode("Style").InnerText;

                if (xn.SelectSingleNode("SubEntries") == null)
                {
                    entry.ListItems = new List <KListItem>();
                    if (xn.SelectSingleNode("ListItems") != null)
                    {
                        foreach (XmlNode item in xn.SelectSingleNode("ListItems").ChildNodes)
                        {
                            KListItem li = new KListItem();
                            li.Text  = item.SelectSingleNode("Text").InnerText;
                            li.Value = item.SelectSingleNode("Value").InnerText;
                            entry.ListItems.Add(li);
                        }
                    }
                }
                else
                {
                    getKEntry(xn.SelectSingleNode("SubEntries").ChildNodes);
                }

                KBEntries.Add(entry);
            }
        }
Example #2
0
        /// <summary>
        /// 双击域显示对应弹出控件
        /// </summary>
        /// <param name="mousePoint">弹出位置</param>
        /// <param name="dtype">0无 1知识库 2数据源</param>
        /// <param name="inputType">控件类型</param>
        /// <param name="elId">域ID</param>
        /// <param name="fieldvalue">域值</param>
        /// <param name="_valueChange">值改变会写病历</param>
        public static void ShowEmrToolTip(Point mousePoint, string dtype, string inputType, string elId, string fieldvalue, Action <string, string> _valueChange)
        {
            valueChange = _valueChange;
            switch (Convert.ToInt32(inputType))
            {
            case (int)InputType.List:
                if (dtype == "1")    //知识库
                {
                    KEntry ke = KnowledgeManage.KBEntries.Find(x => x.Value == elId);
                    if (ke != null)
                    {
                        List <ListItem> olist = new List <ListItem>();
                        foreach (KListItem item in ke.ListItems)
                        {
                            olist.Add(new ListItem(item.Text, item.Value));
                        }
                        listToolTip.LoadData(olist, fieldvalue);
                        listPopup.Show(mousePoint);
                    }
                }
                else if (dtype == "2")    //数据源
                {
                    object obj = DataSourceManage.GetFieldDataSource(elId);
                    if (obj != null)
                    {
                        DataTable       data  = (DataTable)obj;
                        List <ListItem> olist = new List <ListItem>();
                        for (int i = 0; i < data.Rows.Count; i++)
                        {
                            olist.Add(new ListItem(data.Rows[i][0].ToString(), data.Rows[i][1].ToString()));
                        }
                        listToolTip.LoadData(olist, fieldvalue);
                        listPopup.Show(mousePoint);
                    }
                }
                break;

            case (int)InputType.MultiList:
                if (dtype == "1")    //知识库
                {
                    KEntry ke = KnowledgeManage.KBEntries.Find(x => x.Value == elId);
                    if (ke != null)
                    {
                        List <ListItem> olist = new List <ListItem>();
                        foreach (KListItem item in ke.ListItems)
                        {
                            olist.Add(new ListItem(item.Text, item.Value));
                        }
                        mlistToolTip.LoadData(olist, fieldvalue);
                        mlistPopup.Show(mousePoint);
                    }
                }
                else if (dtype == "2")    //数据源
                {
                    object obj = DataSourceManage.GetFieldDataSource(elId);
                    if (obj != null)
                    {
                        DataTable       data  = (DataTable)obj;
                        List <ListItem> olist = new List <ListItem>();
                        for (int i = 0; i < data.Rows.Count; i++)
                        {
                            olist.Add(new ListItem(data.Rows[i][0].ToString(), data.Rows[i][1].ToString()));
                        }
                        mlistToolTip.LoadData(olist, fieldvalue);
                        mlistPopup.Show(mousePoint);
                    }
                }
                break;

            case (int)InputType.Date:
                dateToolTip.LoadData(null, fieldvalue);
                datePopup.Show(mousePoint);
                break;

            case (int)InputType.Time:
                timeToolTip.LoadData(null, fieldvalue);
                timePopup.Show(mousePoint);
                break;
            }
        }