Ejemplo n.º 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="row">分类</param>
        /// <param name="node">此分类的父节点</param>
        /// <param name="catalog">模板‘病历类别’</param>
        /// <param name="keyword">搜索关键字</param>
        private void SearchLoadTree(DataRow row, TreeListNode node, string catalog, IEnumerable<DataRow> allSearchedFolders, IEnumerable<DataRow> searchedLeafs, string keyword)
        {
            try
            {
                TreeListNode nd = treeListPersonTemplate.AppendNode(new object[] { row["ID"], row["NAME"], "Folder", row["ISPERSON"], row["CREATEUSERS"] }, node);
                nd.Tag = row;

                //查找叶子节点
                var leafRows = searchedLeafs.Where(p => p["PARENTID"].ToString() == row["ID"].ToString());
                if (null != leafRows && leafRows.Count() > 0)
                {
                    foreach (DataRow leaf in leafRows)
                    {
                        TreeListNode leafnd = treeListPersonTemplate.AppendNode(new object[] { leaf["Code"], leaf["NAME"], "Leaf", leaf["ISPERSON"], leaf["CREATEUSERS"] }, nd);
                        TempletItem item = new TempletItem(leaf);
                        item.CatalogName = row["NAME"].ToString();
                        leafnd.Tag = item;
                    }
                }

                var rows = allSearchedFolders.Where(p => p["Previd"].ToString() == row["ID"].ToString());
                foreach (DataRow dr in rows)
                {
                    SearchLoadTree(dr, nd, catalog, allSearchedFolders, searchedLeafs, keyword);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Ejemplo n.º 2
0
        private void DoDragDorpInfo(TreeList tree)
        {
            try
            {
                if (tree.FocusedNode == null)
                {
                    return;
                }
                KeyValuePair<string, object> data = new KeyValuePair<string, object>();
                if ((tree.FocusedNode != null) && (tree.FocusedNode.Tag != null))
                {

                    if (tree == treeListPersonTemplate)
                    {
                        TempletItem item = tree.FocusedNode.Tag as TempletItem;
                        if (item.Content.Contains("||chr(10)||chr(13)||"))//存在换行,替代插入数据库中 edit by ywk
                        {
                            item.Content = item.Content.Replace("'||chr(10)||chr(13)||'", "\r\n");
                        }
                        data = new KeyValuePair<string, object>(item.Content, ElementType.Text);
                    }
                }
                if (!string.IsNullOrEmpty(data.Key))
                {
                    tree.DoDragDrop(data, DragDropEffects.All);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        private void treeListPersonTemplate_MouseMove(object sender, MouseEventArgs e)
        {
            try
            {
                if (e.Button == MouseButtons.Left && m_IsAllowDrop)
                {
                    TreeList list = (TreeList)sender;
                    if ((list.FocusedNode != null) && (list.FocusedNode.Tag is TempletItem))
                    {
                        DoDragDorpInfo(list);
                    }
                }
                else
                {
                    m_IsAllowDrop = false;
                }

                TreeListHitInfo hitInfo = treeListPersonTemplate.CalcHitInfo(new Point(e.X, e.Y));
                if (hitInfo.Node != null)
                {
                    if (hitInfo.Node.GetValue("NODETYPE").ToString() == "Leaf" && hitInfo.Node.Tag is TempletItem)
                    {
                        TempletItem item = (TempletItem)hitInfo.Node.Tag;
                        InitToolTip(null == item ? "" : item.Content, treeListPersonTemplate, treeListPersonTemplate.PointToScreen(e.Location));
                    }
                }
            }
            catch (Exception ex)
            {
                MyMessageBox.Show(1, ex);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 小模板列表 - 加载树
        /// </summary>
        /// <param name="id"></param>
        /// <param name="row"></param>
        /// <param name="node"></param>
        /// <param name="catalog"></param>
        private void LoadTree(string id, DataRow row, TreeListNode node, string catalog)
        {

            try
            {
                TreeListNode nd = treeListPersonTemplate.AppendNode(new object[] { id, row["NAME"], "Folder", row["ISPERSON"], row["CREATEUSERS"] }, node);
                nd.Tag = row;

                //查找叶子节点
                DataRow[] leafRows = m_MyLeafs.Select("PARENTID='" + id + "' ");
                if (leafRows.Length > 0)
                {
                    foreach (DataRow leaf in leafRows)
                    {
                        TreeListNode leafnd = treeListPersonTemplate.AppendNode(new object[] { leaf["Code"], leaf["NAME"], "Leaf", leaf["ISPERSON"], leaf["CREATEUSERS"] }, nd);
                        TempletItem item = new TempletItem(leaf);
                        if (item.Content.Contains("||chr(10)||chr(13)||"))//存在换行,替代插入数据库中 edit by ywk
                        {
                            item.Content = item.Content.Replace("'||chr(10)||chr(13)||'", "\r\n");
                        }
                        item.CatalogName = row["NAME"].ToString();
                        leafnd.Tag = item;
                    }
                }

                DataRow[] rows = m_MyTreeFolders.Select("Previd='" + id + "' ");
                foreach (DataRow dr in rows)
                {
                    LoadTree(dr["ID"].ToString(), dr, nd, catalog);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }