Beispiel #1
0
 private void tv_AfterSelect(object sender, TreeViewEventArgs e)
 {
     if (e.Node.Name.ToString().ToLower().StartsWith("child"))
     {
         this.CurrTn = e.Node;
         AccordRecipeEdit obj = e.Node.Tag as AccordRecipeEdit;
         ((clsCtl_AccordRecipeList)this.objController).m_mthShow(obj.RecipeID_Chr);
     }
 }
Beispiel #2
0
        private void tv_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Name.ToString().ToLower().StartsWith("child"))
            {
                this.CurrTn = e.Node;
                AccordRecipeEdit obj = e.Node.Tag as AccordRecipeEdit;
                this.txtRecName.Text  = obj.OrigeName;
                this.txtUserCode.Text = obj.UserCode_Chr;
                this.txtPyCode.Text   = obj.PyCode_Chr;
                this.txtWbCode.Text   = obj.WbCode_Chr;
                this.txtReMark.Text   = obj.ReMark_Vchr;
                if (obj.Privilege_Int == "0")
                {
                    this.cboUseScope.SelectedIndex = 2;
                }
                else if (obj.Privilege_Int == "1")
                {
                    this.cboUseScope.SelectedIndex = 0;
                }
                else if (obj.Privilege_Int == "2")
                {
                    this.cboUseScope.SelectedIndex = 1;
                }

                if (obj.Status_Int == "1")
                {
                    this.cboStatus.SelectedIndex = 0;
                }
                else
                {
                    this.cboStatus.SelectedIndex = 1;
                }

                ((clsCtl_AccordRecipeEdit)this.objController).m_mthShow(obj.RecipeID_Chr);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 建树
        /// </summary>
        public void m_mthCreateTree(string EmpID)
        {
            DataTable dt;

            try
            {
                this.m_objViewer.Cursor = Cursors.WaitCursor;
                long l = this.objSvc.m_lngFindAccordRecipe(EmpID, out dt);
                if (l > 0)
                {
                    this.m_objViewer.tv.BeginUpdate();
                    this.m_objViewer.tv.Nodes.Clear();

                    DataView DV = new DataView(dt);
                    DV.RowFilter = "status_int = 1";
                    DV.Sort      = "recipename_chr asc";

                    ArrayList RecArr = new ArrayList();
                    DataRow   dr     = null;
                    for (int i = 0; i < DV.Count; i++)
                    {
                        dr = DV[i].Row;

                        AccordRecipeEdit objAR = new AccordRecipeEdit();
                        objAR.RecipeID_Chr   = dr["recipeid_chr"].ToString().Trim();
                        objAR.Recipename_Chr = dr["recipename_chr"].ToString().Trim();
                        objAR.UserCode_Chr   = dr["usercode_chr"].ToString().Trim();
                        objAR.PyCode_Chr     = dr["pycode_chr"].ToString().Trim();
                        objAR.WbCode_Chr     = dr["wbcode_chr"].ToString().Trim();
                        objAR.Privilege_Int  = dr["privilege_int"].ToString();
                        objAR.Status_Int     = dr["status_int"].ToString();
                        objAR.ReMark_Vchr    = dr["diseasename_vchr"].ToString();
                        objAR.OrigeName      = dr["recipename_chr"].ToString().Trim();
                        RecArr.Add(objAR);
                    }

                    this.m_objViewer.tv.Nodes.Add("协定处方模板列表");
                    TreeNode FirstNode = null;
                    TreeNode FindNode  = this.m_objViewer.tv.Nodes[0];
                    FindNode.Tag                = "root";
                    FindNode.Name               = "root";
                    FindNode.ImageIndex         = 1;
                    FindNode.SelectedImageIndex = 1;

                    int  count  = 0;
                    bool Exists = false;

                    foreach (AccordRecipeEdit objRecipe in RecArr)
                    {
                        FindNode = this.m_objViewer.tv.Nodes[0];

                        string[] SplitArr = objRecipe.LevelNameArr;

                        for (int i = 0; i < SplitArr.Length; i++)
                        {
                            Exists = false;
                            for (int j = 0; j < FindNode.Nodes.Count; j++)
                            {
                                if (SplitArr[i] == FindNode.Nodes[j].Text)
                                {
                                    Exists   = true;
                                    FindNode = FindNode.Nodes[j];
                                    break;
                                }
                            }

                            if (Exists)
                            {
                                if (i == SplitArr.Length - 1)
                                {
                                    TreeNode tnAdd = new TreeNode(SplitArr[i].Trim());
                                    FindNode.Parent.Nodes.Add(tnAdd);
                                    tnAdd.Tag                = objRecipe;
                                    tnAdd.ImageIndex         = 0;
                                    tnAdd.SelectedImageIndex = 5;
                                    tnAdd.Name               = "child->" + SplitArr[i].Trim();
                                }
                            }
                            else
                            {
                                TreeNode tnAdd = new TreeNode(SplitArr[i].Trim());
                                FindNode.Nodes.Add(tnAdd);
                                if (i == SplitArr.Length - 1)
                                {
                                    tnAdd.Tag                = objRecipe;
                                    tnAdd.ImageIndex         = 0;
                                    tnAdd.SelectedImageIndex = 5;
                                    tnAdd.Name               = "child->" + SplitArr[i].Trim();
                                }
                                else
                                {
                                    tnAdd.ImageIndex         = 2;
                                    tnAdd.SelectedImageIndex = 5;
                                    tnAdd.Name = "parent->" + SplitArr[i].Trim();
                                }
                                if (count == 0)
                                {
                                    FirstNode = tnAdd;
                                    count++;
                                }

                                FindNode = tnAdd;
                            }
                        }
                    }

                    this.m_objViewer.tv.EndUpdate();
                    this.m_objViewer.tv.SelectedNode = FirstNode;
                }
            }
            finally
            {
                this.m_objViewer.Cursor = Cursors.Default;
            }
        }
Beispiel #4
0
        /// <summary>
        /// 递归查找树节点
        /// </summary>
        /// <param name="treeNode"></param>
        /// <param name="FindStr"></param>
        /// <param name="ChildFlag"></param>
        /// <param name="FindFlag"></param>
        private void FindRecursive(TreeNode treeNode, string FindStr, bool ChildFlag, ref bool FindFlag)
        {
            foreach (TreeNode tn in treeNode.Nodes)
            {
                //if (tn.Tag == null)
                //{
                //    continue;
                //}

                if (FindFlag)
                {
                    return;
                }

                if (ChildFlag)
                {
                    if (tn.Name.ToString().ToLower().StartsWith("child"))
                    {
                        AccordRecipeEdit objAR = tn.Tag as AccordRecipeEdit;
                        if (objAR.UserCode_Chr.ToLower().StartsWith(FindStr) || objAR.PyCode_Chr.ToLower().StartsWith(FindStr) ||
                            objAR.WbCode_Chr.ToLower().StartsWith(FindStr) || objAR.Recipename_Chr.ToLower().StartsWith(FindStr))
                        {
                            if (!tn.IsSelected)
                            {
                                this.m_objViewer.tv.SelectedNode = tn;
                            }

                            if (!tn.IsExpanded)
                            {
                                tn.Expand();
                            }

                            FindFlag = true;

                            return;
                        }
                    }
                    else
                    {
                        FindRecursive(tn, FindStr, ChildFlag, ref FindFlag);
                    }
                }
                else
                {
                    string tnName = tn.Name.ToString().ToLower().Replace("parent->", "").Replace("child->", "");
                    if (tnName.StartsWith(FindStr))
                    {
                        if (!tn.IsSelected)
                        {
                            this.m_objViewer.tv.SelectedNode = tn;
                        }

                        if (!tn.IsExpanded)
                        {
                            tn.Expand();
                        }

                        FindFlag = true;

                        return;
                    }
                    else
                    {
                        FindRecursive(tn, FindStr, ChildFlag, ref FindFlag);
                    }
                }
            }
        }