Ejemplo n.º 1
0
 private void createTreeRoot()
 {
     treeT.Nodes.Clear();
     DevComponents.AdvTree.Node node = null;
     node      = new DevComponents.AdvTree.Node("我的任务");
     node.Name = "mytask";
     node.Expand();
     node.ImageIndex = 0;
     treeT.Nodes.Add(node);
     node            = new DevComponents.AdvTree.Node("住院医嘱");
     node.Name       = "medorder";
     node.ImageIndex = 1;
     treeT.Nodes.Add(node);
     node      = new DevComponents.AdvTree.Node("住院病历");
     node.Name = "medemr";
     node.Expand();
     node.ImageIndex = 2;
     treeT.Nodes.Add(node);
     node            = new DevComponents.AdvTree.Node("护理文书");
     node.Name       = "medbook";
     node.ImageIndex = 3;
     treeT.Nodes.Add(node);
     node            = new DevComponents.AdvTree.Node("知情文件");
     node.Name       = "infofiles";
     node.ImageIndex = 4;
     treeT.Nodes.Add(node);
     node            = new DevComponents.AdvTree.Node("病历首页");
     node.Name       = "homepage";
     node.ImageIndex = 5;
     treeT.Nodes.Add(node);
 }
 public void loadTreeData(List <EmrCatalogue> clglist, List <EMR.Controls.Entity.EmrTemplateTree> templatelist)
 {
     treeT.Nodes.Clear();
     DevComponents.AdvTree.Node node = null;
     foreach (EmrCatalogue clg in clglist)
     {
         node             = new DevComponents.AdvTree.Node(clg.NodeText);
         node.Tag         = clg;
         node.ContextMenu = rightMenuStrip;
         node.ImageIndex  = 0;
         DevComponents.AdvTree.Node nodeT = null;
         foreach (EMR.Controls.Entity.EmrTemplateTree t in templatelist.FindAll(x => x.CatalogueCode == clg.NodeCode))
         {
             nodeT             = new DevComponents.AdvTree.Node(t.TemplateText);
             nodeT.Tag         = t;
             nodeT.ContextMenu = rightMenuStrip;
             nodeT.ImageIndex  = 1;
             node.Nodes.Add(nodeT);
         }
         if (expandnodes != null && expandnodes.FindIndex(x => x == clg.NodeCode) != -1)
         {
             node.Expand();
         }
         treeT.Nodes.Add(node);
     }
 }
Ejemplo n.º 3
0
        private void createTreeOrder(List <EMR.Controls.Entity.EmrCatalogue> clglist, List <EMR.Controls.Entity.EmrWriteRecord> recordlist)
        {
            DevComponents.AdvTree.Node pnode = treeT.Nodes.Find("medemr", false)[0];
            DevComponents.AdvTree.Node node  = null;

            foreach (EMR.Controls.Entity.EmrCatalogue clg in clglist)
            {
                node             = new DevComponents.AdvTree.Node(clg.NodeText);
                node.Tag         = clg;
                node.ContextMenu = rightMenuStrip;
                node.ImageIndex  = 6;
                node.NodeClick  += new EventHandler(node_NodeClick);
                DevComponents.AdvTree.Node nodeT = null;
                foreach (EMR.Controls.Entity.EmrWriteRecord t in recordlist.FindAll(x => x.CatalogueCode == clg.NodeCode))
                {
                    nodeT                  = new DevComponents.AdvTree.Node(t.RecordText);
                    nodeT.Tag              = t;
                    nodeT.ContextMenu      = rightMenuStrip;
                    nodeT.ImageIndex       = 7;
                    nodeT.NodeDoubleClick += new EventHandler(WriteRecord_NodeDoubleClick);
                    node.Nodes.Add(nodeT);

                    if (selectRecordId == t.ID)
                    {
                        //node.Expand();
                        treeT.SelectedNode = nodeT;
                    }
                }
                if (expandnodes != null && expandnodes.FindIndex(x => x == clg.NodeCode) != -1)
                {
                    node.Expand();
                }
                pnode.Nodes.Add(node);
            }
        }
Ejemplo n.º 4
0
        private void BindDictTree()
        {
            this.atDict.Nodes.Clear();
            Dictionary <string, int> dict = dictLogic.GetDictGroup(new SYS_DictItemParam()
            {
                Condition = !string.IsNullOrEmpty(txtCondition.Text.Trim())
                ?txtCondition.Text.Trim():null
            });

            List <SYS_DictItemResult> dictList = dictLogic.GetList(new SYS_DictItemParam()
            {
                Condition = !string.IsNullOrEmpty(txtCondition.Text.Trim())
              ?txtCondition.Text.Trim():null
            });

            DevComponents.AdvTree.Node dictGroupNode = null;
            foreach (string key in dict.Keys)
            {
                dictGroupNode = new DevComponents.AdvTree.Node();
                dictGroupNode.VerticalCellLayoutAlignment = DevComponents.AdvTree.eHorizontalAlign.Left;
                dictGroupNode.CellLayout = DevComponents.AdvTree.eCellLayout.Vertical;
                dictGroupNode.Text       = key + ",共[" + dict[key] + "]个";
                dictGroupNode.Name       = "trnGroup" + key;
                dictGroupNode.Tag        = key + "," + dictGroupNode.Level;
                dictGroupNode.Image      = global::ZNLCRM.UI.Properties.Resources.flag_1;
                atDict.Nodes.Add(dictGroupNode);
                List <SYS_DictItemResult>  tempDictList = dictList.Where(a => a.DictGroupName == key && !string.IsNullOrEmpty(key)).ToList();
                DevComponents.AdvTree.Node dictNode     = null;
                foreach (SYS_DictItemResult rst in tempDictList)
                {
                    dictNode = new DevComponents.AdvTree.Node();
                    dictNode.VerticalCellLayoutAlignment = DevComponents.AdvTree.eHorizontalAlign.Left;
                    dictNode.CellLayout = DevComponents.AdvTree.eCellLayout.Vertical;
                    dictNode.Text       = rst.ItemName + "[" + rst.ItemCode + "]";
                    dictNode.Name       = "trnDict" + rst.DictItemID;
                    dictNode.Tag        = key + "," + rst.DictItemID + "," + rst.ItemCode;
                    dictNode.Image      = global::ZNLCRM.UI.Properties.Resources.flag_2;
                    dictGroupNode.Nodes.Add(dictNode);
                }
                if (nodeName == dictGroupNode.Name)
                {
                    dictGroupNode.Expand();
                }
            }
        }
        private void LoadTree()
        {
            DevComponents.AdvTree.Node _nd = null;
            foreach (var c in m_categories)
            {
                _nd             = new DevComponents.AdvTree.Node();
                _nd.Text        = c.Value;
                _nd.Tag         = c.Key;
                _nd.Name        = string.Format("MDEPT{0}", c.Key);
                _nd.Style       = _header_style;
                _nd.ContextMenu = contextMenuFolder;
                advTree1.Nodes.Add(_nd); _nd = null;
            }
            var nlist = from k in datam.DATA_CHURCH_SUB_UNIT.Values
                        group k by k.sb_unit_category.ToByte() into new_group
                        select new
            {
                _key    = new_group.Key,
                gp_data = new_group
            };

            DevComponents.AdvTree.Node _parent = null;
            foreach (var k in nlist)
            {
                _parent = null;
                _parent = advTree1.FindNodeByName(string.Format("MDEPT{0}", k._key));
                foreach (var sd in k.gp_data)
                {
                    _nd                         = new DevComponents.AdvTree.Node();
                    _nd.Text                    = sd.sb_unit_name;
                    _nd.Tag                     = sd;
                    _nd.Name                    = string.Format("DEPT{0}", sd.sb_unit_id);
                    _nd.Style                   = _sb_dept_style;
                    _nd.ContextMenu             = contextMenuFile;
                    _parent.Nodes.Add(_nd); _nd = null;
                }
                if (_parent != null)
                {
                    _parent.Expand();
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 初始化树的主要方法
        /// </summary>
        /// <param name="list"></param>
        /// <param name="pAppForm"></param>
        private static void Ini_trees(ArrayList list, Plugin.Application.IAppGISRef pAppForm)
        {
            ImageList imglist = pAppForm.DataTree.ImageList;

            pAppForm.DataTree.Nodes.Clear();
            pAppForm.DataTree.Columns.Clear();
            DevComponents.AdvTree.Node Firstnode = new DevComponents.AdvTree.Node();
            Firstnode.Text  = Overridfunction.name;
            Firstnode.Image = imglist.Images[3];
            foreach (IFeatureClass TempClass in list)
            {
                IDataset ds = TempClass as IDataset;
                DevComponents.AdvTree.Node TempNode = new DevComponents.AdvTree.Node();
                TempNode.Text  = ds.Name;
                TempNode.Image = imglist.Images[6];
                Firstnode.Nodes.Add(TempNode);
            }
            Firstnode.Expand();
            pAppForm.DataTree.Nodes.Add(Firstnode);
        }
Ejemplo n.º 7
0
        public void   BindNode(DevComponents.AdvTree.Node parentNode, int pzid, List <CRM_ZoneResult> zoneList)
        {
            List <CRM_ZoneResult> fZoneList = zoneList.Where(a => a.PZID == pzid).ToList();

            foreach (CRM_ZoneResult rst in fZoneList)
            {
                DevComponents.AdvTree.Node trNode = new DevComponents.AdvTree.Node();
                trNode.VerticalCellLayoutAlignment = DevComponents.AdvTree.eHorizontalAlign.Left;
                trNode.CellLayout = DevComponents.AdvTree.eCellLayout.Vertical;
                trNode.Name       = "trn" + rst.ZID;
                trNode.Text       = rst.Name_CN;
                trNode.Tag        = rst.ZType;
                BindNode(trNode, rst.ZID, zoneList);
                parentNode.Nodes.Add(trNode);
                if (rst.ZID == pzid)
                {
                    trNode.Expand();
                }
            }
        }
Ejemplo n.º 8
0
        //创建树图节点
        private DevComponents.AdvTree.Node CreateAdvTreeNode(DevComponents.AdvTree.NodeCollection nodeCol, string strText, string strName, Image pImage, bool bExpand)
        {
            DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
            node.Text  = strText;
            node.Image = pImage;
            if (strName != null)
            {
                node.Name = strName;
            }

            if (bExpand == true)
            {
                node.Expand();
            }
            //添加树图列节点
            DevComponents.AdvTree.Cell aCell = new DevComponents.AdvTree.Cell();
            aCell.Images.Image = null;
            node.Cells.Add(aCell);
            nodeCol.Add(node);
            return(node);
        }
Ejemplo n.º 9
0
        public new void Layout(List <string> PrimaryKeys)
        {
            //選取的結點的完整路徑
            mPrimaryKeys = PrimaryKeys;

            List <string> selectPath = new List <string>();

            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion
            advTree1.Nodes.Clear();
            items.Clear();


            SortedList <int?, List <string> > gradeYearList = new SortedList <int?, List <string> >();
            List <string> nullGradeList = new List <string>();
            List <string> nullClassList = new List <string>();
            Dictionary <ClassRecord, List <string> > classList      = new Dictionary <ClassRecord, List <string> >();
            Dictionary <ClassRecord, int?>           classGradeYear = new Dictionary <ClassRecord, int?>();
            List <ClassRecord> classes = new List <ClassRecord>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            rootNode.Text = "所有學生(" + PrimaryKeys.Count + ")";

            foreach (var key in PrimaryKeys)
            {
                var         studentRec = Student.Instance.Items[key];
                ClassRecord classRec   = studentRec.Class;
                string      gradeYear  = (classRec == null ? "" : classRec.GradeYear);

                //JHSchool.C001
                //if (User.Acl["JHSchool.C001"].PermissionString != gradeYear)
                //    continue;

                int gyear = 0;
                int?g;
                if (int.TryParse(gradeYear, out gyear))
                {
                    g = gyear;
                    if (!gradeYearList.ContainsKey(g))
                    {
                        gradeYearList.Add(g, new List <string>());
                    }
                    gradeYearList[g].Add(key);
                }
                else
                {
                    g = null;
                    nullGradeList.Add(key);
                }
                if (classRec != null)
                {
                    if (!classList.ContainsKey(classRec))
                    {
                        classList.Add(classRec, new List <string>());
                        classes.Add(classRec);
                    }
                    classList[classRec].Add(key);
                    if (!classGradeYear.ContainsKey(classRec))
                    {
                        classGradeYear.Add(classRec, g);
                    }
                }
                else
                {
                    nullClassList.Add(key);
                }
            }
            classes.Sort();

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                switch (gyear)
                {
                //case 1:
                //    gyearNode.Text = "一年級";
                //    break;
                //case 2:
                //    gyearNode.Text = "二年級";
                //    break;
                //case 3:
                //    gyearNode.Text = "三年級";
                //    break;
                //case 4:
                //    gyearNode.Text = "四年級";
                //    break;
                default:
                    gyearNode.Text = "" + gyear + "年級";
                    break;
                }

                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";

                items.Add(gyearNode, gradeYearList[gyear]);

                rootNode.Nodes.Add(gyearNode);

                foreach (var classRec in classes)
                {
                    if (classGradeYear[classRec] == gyear)
                    {
                        DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                        classNode.Text = classRec.Name + "(" + classList[classRec].Count + ")";

                        items.Add(classNode, classList[classRec]);

                        gyearNode.Nodes.Add(classNode);
                    }
                }
            }
            if (nullGradeList.Count > 0)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();

                gyearNode.Text = "未分年級(" + nullGradeList.Count + ")";

                items.Add(gyearNode, nullGradeList);

                rootNode.Nodes.Add(gyearNode);

                foreach (var classRec in classes)
                {
                    if (classGradeYear[classRec] == null)
                    {
                        DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                        classNode.Text = classRec.Name + "(" + classList[classRec].Count + ")";

                        items.Add(classNode, classList[classRec]);

                        gyearNode.Nodes.Add(classNode);
                    }
                }
                if (nullClassList.Count > 0)
                {
                    DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                    classNode.Text = "未分班(" + nullClassList.Count + ")";

                    items.Add(classNode, nullClassList);

                    gyearNode.Nodes.Add(classNode);
                }
            }

            rootNode.Expand();

            advTree1.Nodes.Add(rootNode);

            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                {
                    advTree1.SelectedNode = selectNode;
                }
            }


            //advTree1.Focus();
        }
        public new void Layout(List<string> PrimaryKeys)
        {
            //选取的结点的完整路径
            mPrimaryKeys = PrimaryKeys;

            List<string> selectPath = new List<string>();
            #region 记录选取的结点的完整路径
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion
            advTree1.Nodes.Clear();
            items.Clear();

            SortedList<int?, List<string>> gradeYearList = new SortedList<int?, List<string>>();
            List<string> nullGradeList = new List<string>();
            List<string> nullClassList = new List<string>();
            Dictionary<ClassRecord, List<string>> classList = new Dictionary<ClassRecord, List<string>>();
            Dictionary<ClassRecord, int?> classGradeYear = new Dictionary<ClassRecord, int?>();
            List<ClassRecord> classes = new List<ClassRecord>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            rootNode.Text = "所有学生(" + PrimaryKeys.Count + ")";

            foreach (var key in PrimaryKeys)
            {
                var studentRec = Student.Instance.Items[key];
                ClassRecord classRec = studentRec.Class;
                string gradeYear = (classRec == null ? "" : classRec.GradeYear);

                //JHSchool.C001
                //if (User.Acl["JHSchool.C001"].PermissionString != gradeYear)
                //    continue;

                int gyear = 0;
                int? g;
                if (int.TryParse(gradeYear, out gyear))
                {
                    g = gyear;
                    if (!gradeYearList.ContainsKey(g))
                        gradeYearList.Add(g, new List<string>());
                    gradeYearList[g].Add(key);
                }
                else
                {
                    g = null;
                    nullGradeList.Add(key);
                }
                if (classRec != null)
                {
                    if (!classList.ContainsKey(classRec))
                    {
                        classList.Add(classRec, new List<string>());
                        classes.Add(classRec);
                    }
                    classList[classRec].Add(key);
                    if (!classGradeYear.ContainsKey(classRec))
                        classGradeYear.Add(classRec, g);
                }
                else
                    nullClassList.Add(key);
            }
            classes.Sort();

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                switch (gyear)
                {
                    //case 1:
                    //    gyearNode.Text = "一年级";
                    //    break;
                    //case 2:
                    //    gyearNode.Text = "二年级";
                    //    break;
                    //case 3:
                    //    gyearNode.Text = "三年级";
                    //    break;
                    //case 4:
                    //    gyearNode.Text = "四年级";
                    //    break;
                    default:
                        gyearNode.Text = "" + gyear + "年级";
                        break;

                }

                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";

                items.Add(gyearNode, gradeYearList[gyear]);

                rootNode.Nodes.Add(gyearNode);

                foreach (var classRec in classes)
                {
                    if (classGradeYear[classRec] == gyear)
                    {
                        DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                        classNode.Text = classRec.Name + "(" + classList[classRec].Count + ")";

                        items.Add(classNode, classList[classRec]);

                        gyearNode.Nodes.Add(classNode);
                    }
                }
            }
            if (nullGradeList.Count > 0)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();

                gyearNode.Text = "未分年级(" + nullGradeList.Count + ")";

                items.Add(gyearNode, nullGradeList);

                rootNode.Nodes.Add(gyearNode);

                foreach (var classRec in classes)
                {
                    if (classGradeYear[classRec] == null)
                    {
                        DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                        classNode.Text = classRec.Name + "(" + classList[classRec].Count + ")";

                        items.Add(classNode, classList[classRec]);

                        gyearNode.Nodes.Add(classNode);
                    }
                }
                if (nullClassList.Count > 0)
                {
                    DevComponents.AdvTree.Node classNode = new DevComponents.AdvTree.Node();

                    classNode.Text = "未分班(" + nullClassList.Count + ")";

                    items.Add(classNode, nullClassList);

                    gyearNode.Nodes.Add(classNode);
                }
            }

            rootNode.Expand();

            advTree1.Nodes.Add(rootNode);

            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                    advTree1.SelectedNode = selectNode;
            }

            //advTree1.Focus();
        }
Ejemplo n.º 11
0
        public new void Layout(List<string> PrimaryKeys)
        {
            //選取的結點的完整路徑
            List<string> selectPath = new List<string>();
            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            // 取得刪除教師 ID
            List<string> DeletedTeacheIDList = new List<string>();
            List<string> checkDeletedTeacheIDList = new List<string>();
            List<K12.Data.TeacherRecord> TeacherRecs = K12.Data.Teacher.SelectAll();
            foreach (K12.Data.TeacherRecord tr in TeacherRecs)
                if (tr.Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                    DeletedTeacheIDList.Add(tr.ID);

            SortedList<int?, List<string>> gradeYearList = new SortedList<int?, List<string>>();
            List<string> noGradYearList = new List<string>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            int TotalCount = 0;

            foreach (var key in PrimaryKeys)
            {
                // 過濾刪除教師
                if (DeletedTeacheIDList.Contains(key))
                {
                    checkDeletedTeacheIDList.Add(key);
                    continue;
                }
                var teacherRec = Teacher.Instance.Items[key];

                foreach (var classRec in Class.Instance.GetTecaherSupervisedClass(teacherRec))
                {
                    string gradeYear = (classRec == null ? "" : classRec.GradeYear);

                    int gyear = 0;
                    int? g;
                    if (int.TryParse(gradeYear, out gyear))
                    {
                        g = gyear;
                        if (!gradeYearList.ContainsKey(g))
                            gradeYearList.Add(g, new List<string>());

                        if (!gradeYearList[g].Contains(key))
                            gradeYearList[g].Add(key);
                    }
                    else
                    {
                        g = null;

                        if (!noGradYearList.Contains(key))
                            noGradYearList.Add(key);
                    }
                }
            }

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                switch (gyear)
                {
                    //case 1:
                    //    gyearNode.Text = "一年級";
                    //    break;
                    //case 2:
                    //    gyearNode.Text = "二年級";
                    //    break;
                    //case 3:
                    //    gyearNode.Text = "三年級";
                    //    break;
                    //case 4:
                    //    gyearNode.Text = "四年級";
                    //    break;
                    default:
                        gyearNode.Text = "" + gyear + "年級";
                        break;

                }
                // TotalCount += gradeYearList[gyear].Count;
                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";
                items.Add(gyearNode, gradeYearList[gyear]);
                rootNode.Nodes.Add(gyearNode);
            }

            List<string> tmp = new List<string>();

            foreach (List<string> strList in gradeYearList.Values)
            {
                foreach (string str in strList)
                    if (!tmp.Contains(str))
                        tmp.Add(str);
            }

            if (noGradYearList.Count > 0)
            {
                //                TotalCount += noGradYearList.Count;
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "未分年級" + "(" + noGradYearList.Count + ")";
                items.Add(gyearNode, noGradYearList);

                rootNode.Nodes.Add(gyearNode);
            }

            rootNode.Text = "所有班導師(" + TotalCount + ")";

            rootNode.Expand();

            advTree1.Nodes.Add(rootNode);
            // 這裡在加入所有班導師
            teacherKeys.Clear();

            //foreach (List<string> str in gradeYearList.Values)
            //    teacherKeys.AddRange(str);
            // 有年級
            foreach (string str in tmp)
                teacherKeys.Add(str);
            // 無年級
            foreach (string str in noGradYearList)
                if (!teacherKeys.Contains(str))
                    teacherKeys.Add(str);

            TotalCount = teacherKeys.Count;

            rootNode.Text = "所有班導師(" + TotalCount + ")";

            //items.Add(rootNode, PrimaryKeys);
            items.Add(rootNode, teacherKeys);
            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                    advTree1.SelectedNode = selectNode;
            }

            // 加入刪除教師
            if (checkDeletedTeacheIDList.Count > 0)
            {

                //TotalCount += DeletedTeacheIDList.Count;
                DevComponents.AdvTree.Node DelTeacheNode = new DevComponents.AdvTree.Node();
                DelTeacheNode.Text = "刪除教師" + "(" + checkDeletedTeacheIDList.Count + ")";
                items.Add(DelTeacheNode, checkDeletedTeacheIDList);
                advTree1.Nodes.Add(DelTeacheNode);
                //rootNode.Nodes.Add(DelTeacheNode);
            }

            // 非班導師
            // 是班導師ID

            List<string> isClassTeacherID = new List<string>();
            List<string> NotClassTeacherID = new List<string>();
            foreach (K12.Data.ClassRecord classRec in K12.Data.Class.SelectAll())
            {
                isClassTeacherID.Add(classRec.RefTeacherID);
            }

            foreach (K12.Data.TeacherRecord teachRec in K12.Data.Teacher.SelectAll())
            {

                if (!isClassTeacherID.Contains(teachRec.ID))
                {
                    if (teachRec.Status == K12.Data.TeacherRecord.TeacherStatus.一般)
                        NotClassTeacherID.Add(teachRec.ID);
                }
            }
            DevComponents.AdvTree.Node NotClassTeacherNode = new DevComponents.AdvTree.Node();
            NotClassTeacherNode.Text = "非班導師 (" + NotClassTeacherID.Count + ")";
            items.Add(NotClassTeacherNode, NotClassTeacherID);
            advTree1.Nodes.Add(NotClassTeacherNode);

            //advTree1.Focus();
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 根据范围查找数据填充窗体
        /// </summary>
        /// <param name="pMap">被查询的地图对象</param>
        /// <param name="pGeometry">查询范围</param>
        public void FillData(IMap pMap, IGeometry pGeometry)
        {
            advTree.Nodes.Clear();
            m_dataSourceGrid.Clear();

            if (pGeometry == null)
            {
                labelItemMemo.Text = "查找到0个要素";
                return;
            }

            UID pUID = new UIDClass();

            pUID.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";   //UID for IFeatureLayer
            IEnumLayer pEnumLayer = pMap.get_Layers(pUID, true);

            pEnumLayer.Reset();
            ILayer pLayer = pEnumLayer.Next();

            //获取查询的图层
            List <ILayer> listLays = new List <ILayer>();

            switch (m_enumQueryMode)
            {
            case enumQueryMode.Top:
            case enumQueryMode.Visiable:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    if (pLayer.Visible == true)
                    {
                        listLays.Add(pLayer);
                    }

                    pLayer = pEnumLayer.Next();
                }
                break;

            case enumQueryMode.Selectable:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    IFeatureLayer pTemp = pLayer as IFeatureLayer;
                    if (pTemp.Selectable == true)
                    {
                        listLays.Add(pLayer);
                    }

                    pLayer = pEnumLayer.Next();
                }
                break;

            case enumQueryMode.All:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    listLays.Add(pLayer);
                    pLayer = pEnumLayer.Next();
                }
                break;
            }

            if (listLays.Count == 0)
            {
                labelItemMemo.Text = "查找到0个要素";
                return;
            }

            progressBarItem.Visible = true;
            this.Refresh();
            progressBarItem.Maximum = listLays.Count;
            progressBarItem.Minimum = 0;
            progressBarItem.Value   = 0;

            int  intCnt = 0;
            bool bFirst = true;

            //循环图层查找要素
            foreach (ILayer pLay in listLays)
            {
                progressBarItem.Value = progressBarItem.Value + 1;

                IFeatureLayer  pFeatLay       = pLay as IFeatureLayer;
                ISpatialFilter pSpatialFilter = new SpatialFilterClass();
                pSpatialFilter.Geometry      = pGeometry;
                pSpatialFilter.GeometryField = "SHAPE";
                pSpatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;
                IFeatureLayerDefinition pLayerDef = pFeatLay as IFeatureLayerDefinition;
                if (pLayerDef.DefinitionExpression != "")
                {
                    pSpatialFilter.WhereClause = pLayerDef.DefinitionExpression;
                }
                if (pFeatLay.FeatureClass.FeatureCount(pSpatialFilter) == 0)
                {
                    continue;
                }

                //添加图层节点
                DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
                node.Text = pLay.Name;
                node.Tag  = pLay;
                node.Expand();
                advTree.Nodes.Add(node);

                IFeatureCursor pFeatureCursor = pFeatLay.FeatureClass.Search(pSpatialFilter, false);
                IFeature       pFeat          = pFeatureCursor.NextFeature();
                while (pFeat != null && intCnt <= 100)//ZQ  201129  modify
                {
                    //添加要素节点
                    DevComponents.AdvTree.Node featnode = new DevComponents.AdvTree.Node();
                    featnode.Text = pFeat.OID.ToString();
                    featnode.Tag  = pFeat;
                    node.Nodes.Add(featnode);

                    if (bFirst == true)
                    {
                        advTree.SelectedNode = featnode;
                        m_dataSourceGrid.Clear();

                        for (int i = 0; i < pFeat.Fields.FieldCount; i++)
                        {
                            if (pFeat.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                            {
                                m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).Name, pFeat.Shape.GeometryType.ToString() });
                            }
                            else
                            {
                                m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).Name, pFeat.get_Value(i) });
                            }
                        }
                        bFirst = false;
                    }

                    pFeat = pFeatureCursor.NextFeature();

                    intCnt++;
                }

                if (m_enumQueryMode == enumQueryMode.Top)
                {
                    progressBarItem.Value = listLays.Count;
                    break;
                }
            }

            labelItemMemo.Text      = "查找到" + intCnt.ToString() + "个要素";
            progressBarItem.Visible = false;
            this.Refresh();
            DefaultSelNde();
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 根据范围查找数据填充窗体
        /// </summary>
        /// <param name="pMap">被查询的地图对象</param>
        /// <param name="pGeometry">查询范围</param>
        public void FillData(IMap pMap, IGeometry pGeometry)
        {
            advTree.Nodes.Clear();
            m_dataSourceGrid.Clear();

            if (pGeometry == null)
            {
                labelItemMemo.Text = "0个要素";
                return;
            }

            int  intCnt = 0;
            bool bFirst = true;

            IFeatureLayer pFeatLay = getEditLayer.isExistLayer(m_pMapControl.Map) as IFeatureLayer;

            if (pFeatLay == null)
            {
                MessageBox.Show("请设置编辑图层!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            IWorkspaceEdit iWE = (pFeatLay.FeatureClass as IDataset).Workspace as IWorkspaceEdit;

            if (!iWE.IsBeingEdited())
            {
                iWE.StartEditing(false);
            }
            ISpatialFilter pSpatialFilter = new SpatialFilterClass();

            pSpatialFilter.Geometry      = pGeometry;
            pSpatialFilter.GeometryField = "SHAPE";
            pSpatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;


            //添加图层节点
            DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
            node.Text = pFeatLay.Name;
            node.Tag  = pFeatLay;
            node.Expand();
            advTree.Nodes.Add(node);

            IFeatureCursor pFeatureCursor = pFeatLay.FeatureClass.Update(pSpatialFilter, false);

            updateFCur = pFeatureCursor;
            IFeature pFeat = pFeatureCursor.NextFeature();

            while (pFeat != null)
            {
                //添加要素节点
                DevComponents.AdvTree.Node featnode = new DevComponents.AdvTree.Node();
                featnode.Text = pFeat.OID.ToString();
                featnode.Tag  = pFeat;
                node.Nodes.Add(featnode);

                if (bFirst == true)
                {
                    advTree.SelectedNode = featnode;
                    m_dataSourceGrid.Clear();

                    for (int i = 0; i < pFeat.Fields.FieldCount; i++)
                    {
                        if (pFeat.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                        {
                            string strGeometryType = "";
                            if (pFeat.FeatureType == esriFeatureType.esriFTSimple)
                            {
                                switch (pFeat.Shape.GeometryType)
                                {
                                case esriGeometryType.esriGeometryPoint:
                                    strGeometryType = "点";
                                    break;

                                case esriGeometryType.esriGeometryPolyline:
                                    strGeometryType = "线";
                                    break;

                                case esriGeometryType.esriGeometryPolygon:
                                    strGeometryType = "多边形";
                                    break;
                                }
                            }
                            else if (pFeat.FeatureType == esriFeatureType.esriFTAnnotation)
                            {
                                strGeometryType = "注记";
                            }
                            if (string.IsNullOrEmpty(strGeometryType))
                            {
                                strGeometryType = pFeat.Shape.GeometryType.ToString();
                            }
                            m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).AliasName, strGeometryType });
                        }
                        else
                        {
                            m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).AliasName, pFeat.get_Value(i) });
                        }
                    }
                    bFirst = false;
                }

                pFeat = pFeatureCursor.NextFeature();

                intCnt++;
            }

            //if (m_enumAttributeEditMode == enumAttributeEditMode.Top)
            //{
            //    progressBarItem.Value = listLays.Count;
            //    break;
            //}


            labelItemMemo.Text = intCnt.ToString() + "个要素";
            //progressBarItem.Visible = false;
            //this.Refresh();

            DefaultSelNde(pFeatLay as IFeatureSelection);
            setSysFdReadonly();
        }
Ejemplo n.º 14
0
        public new void Layout(List <string> PrimaryKeys)
        {
            //選取的結點的完整路徑
            List <string> selectPath = new List <string>();

            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();
            rootNode.Text = "所有教師(" + PrimaryKeys.Count + ")";


            SortedList <string, List <string> > categoryList = new SortedList <string, List <string> >();
            List <string> noCategroyList = new List <string>();

            foreach (var key in PrimaryKeys)
            {
                var teacherRec = Teacher.Instance.Items[key];

                string category = teacherRec.Category;

                if (!string.IsNullOrEmpty(category))
                {
                    if (!categoryList.ContainsKey(category))
                    {
                        categoryList.Add(category, new List <string>());
                    }
                    categoryList[category].Add(key);
                }
                else
                {
                    noCategroyList.Add(key);
                }
            }

            foreach (var categoryKey in categoryList.Keys)
            {
                DevComponents.AdvTree.Node categoryNode = new DevComponents.AdvTree.Node();
                categoryNode.Text = categoryKey + "(" + categoryList[categoryKey].Count + ")";
                items.Add(categoryNode, categoryList[categoryKey]);
                rootNode.Nodes.Add(categoryNode);
            }

            if (noCategroyList.Count > 0)
            {
                DevComponents.AdvTree.Node categoryNode = new DevComponents.AdvTree.Node();
                categoryNode.Text = "未分類(" + noCategroyList.Count + ")";
                items.Add(categoryNode, noCategroyList);
                rootNode.Nodes.Add(categoryNode);
            }

            rootNode.Expand();

            advTree1.Nodes.Add(rootNode);
            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                {
                    advTree1.SelectedNode = selectNode;
                }
            }

            // advTree1.Focus();
        }
Ejemplo n.º 15
0
        public new void Layout(List<string> PrimaryKeys)
        {
            //選取的結點的完整路徑
            List<string> selectPath = new List<string>();
            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            //用來記錄年級及班級對應的資料結構,第一維記錄年級,第二維記錄年級下的班級編號
            SortedList<int?, List<string>> gradeYearList = new SortedList<int?, List<string>>();

            //用來記錄未分類的班級編號
            List<string> nullGradeList = new List<string>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            rootNode.Text = "所有班級(" + PrimaryKeys.Count + ")";

            //取得所有班級編號
            foreach (var key in PrimaryKeys)
            {
                //根據學生記錄取得班級記錄
                ClassRecord classRec = Class.Instance[key];

                //根據班級記錄取得年級,若是年級為null則年級為空白
                string gradeYear = (classRec == null ? "" : classRec.GradeYear);
                int gyear = 0;
                int? g;

                //將gradeYear轉型成int
                if (int.TryParse(gradeYear, out gyear))
                {
                    g = gyear;
                    if (!gradeYearList.ContainsKey(g))
                        gradeYearList.Add(g, new List<string>());

                    //將班級編號加入所屬年級的集合當中
                    gradeYearList[g].Add(key);
                }
                else
                {
                    //加入沒有分類的班級
                    g = null;
                    nullGradeList.Add(key);
                }
            }

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "" + gyear + "年級";

                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";

                items.Add(gyearNode, gradeYearList[gyear]);

                rootNode.Nodes.Add(gyearNode);
            }

            if (nullGradeList.Count > 0)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "未分年級(" + nullGradeList.Count + ")";
                items.Add(gyearNode, nullGradeList);

                rootNode.Nodes.Add(gyearNode);
            }

            advTree1.Nodes.Add(rootNode);

            rootNode.Expand();

            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                    advTree1.SelectedNode = selectNode;
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 根据条件查找数据填充窗体,用来进行SQL查询
        /// </summary>
        /// <param name="pMap">被查询的地图对象</param>
        public void FillData(IFeatureLayer pFeatLay, IQueryFilter pQueryFilter, esriSelectionResultEnum pSelectionResult)
        {
            advTree.Nodes.Clear();
            m_dataSourceGrid.Clear();

            //获取查询的图层
            progressBarItem.Visible = false;
            this.Refresh();
            int  intCnt = 0;//记录要素的个数
            bool bFirst = true;

            //添加图层节点
            DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
            node.Text = pFeatLay.Name;
            node.Tag  = pFeatLay;
            node.Expand();
            advTree.Nodes.Add(node);
            //进行查询操作
            IFeatureSelection pFeatureSelection = pFeatLay as IFeatureSelection;

            pFeatureSelection.SelectFeatures(pQueryFilter, pSelectionResult, false);
            //保存查询的结果,包括要素类和查找到的要素
            //循环取得选中Feature的ID来得到Feature
            IFeature pFeature;
            IEnumIDs pEnumIDs = pFeatureSelection.SelectionSet.IDs;
            int      iIDIndex = pEnumIDs.Next();

            while (iIDIndex != -1 && intCnt <= 100)//ZQ  20110729 modify
            {
                pFeature = pFeatLay.FeatureClass.GetFeature(iIDIndex);
                //添加要素节点
                DevComponents.AdvTree.Node featnode = new DevComponents.AdvTree.Node();
                featnode.Text = pFeature.OID.ToString();
                featnode.Tag  = pFeature;
                node.Nodes.Add(featnode);

                if (bFirst == true)
                {
                    advTree.SelectedNode = featnode;
                    m_dataSourceGrid.Clear();

                    for (int i = 0; i < pFeature.Fields.FieldCount; i++)
                    {
                        if (pFeature.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                        {
                            m_dataSourceGrid.Rows.Add(new object[] { pFeature.Fields.get_Field(i).Name, pFeature.Shape.GeometryType.ToString() });
                        }
                        else
                        {
                            m_dataSourceGrid.Rows.Add(new object[] { pFeature.Fields.get_Field(i).Name, pFeature.get_Value(i) });
                        }
                    }
                    bFirst = false;
                }
                iIDIndex = pEnumIDs.Next();
                intCnt++;
            }

            labelItemMemo.Text = "查找到" + intCnt.ToString() + "个要素";
            pFeatureSelection.Clear();
            this.Refresh();
            DefaultSelNde();
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 根据范围查找数据填充窗体
        /// </summary>
        /// <param name="pMap">被查询的地图对象</param>
        /// <param name="pGeometry">查询范围</param>
        public void FillData(IMap pMap, IGeometry pGeometry)
        {
            advTree.Nodes.Clear();
            m_dataSourceGrid.Clear();

            if (pGeometry == null)
            {
                labelItemMemo.Text = "0个要素";
                return;
            }

            UID pUID = new UIDClass();

            pUID.Value = "{40A9E885-5533-11d0-98BE-00805F7CED21}";   //UID for IFeatureLayer
            IEnumLayer pEnumLayer = pMap.get_Layers(pUID, true);

            pEnumLayer.Reset();
            ILayer pLayer = pEnumLayer.Next();

            //获取查询的图层
            List <ILayer> listLays = new List <ILayer>();

            switch (m_enumAttributeEditMode)
            {
            case enumAttributeEditMode.Top:
            case enumAttributeEditMode.Visiable:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    if (pLayer.Visible == true)
                    {
                        listLays.Add(pLayer);
                    }

                    pLayer = pEnumLayer.Next();
                }
                break;

            case enumAttributeEditMode.Selectable:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    IFeatureLayer pTemp = pLayer as IFeatureLayer;
                    if (pTemp.Selectable == true)
                    {
                        listLays.Add(pLayer);
                    }

                    pLayer = pEnumLayer.Next();
                }
                break;

            case enumAttributeEditMode.CurEdit:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();    //将当前编辑图层加进来
                while (pLayer != null)
                {
                    IFeatureLayer pTemp = pLayer as IFeatureLayer;
                    if (pTemp.Selectable == true)
                    {
                        listLays.Add(pLayer);
                    }

                    pLayer = pEnumLayer.Next();
                }
                break;

            case enumAttributeEditMode.All:
                pEnumLayer.Reset();
                pLayer = pEnumLayer.Next();
                while (pLayer != null)
                {
                    listLays.Add(pLayer);
                    pLayer = pEnumLayer.Next();
                }
                break;
            }

            if (listLays.Count == 0)
            {
                labelItemMemo.Text = "查找到0个要素";
                return;
            }

            progressBarItem.Visible = true;
            this.Refresh();
            progressBarItem.Maximum = listLays.Count;
            progressBarItem.Minimum = 0;
            progressBarItem.Value   = 0;

            int  intCnt = 0;
            bool bFirst = true;

            //循环图层查找要素
            foreach (ILayer pLay in listLays)
            {
                progressBarItem.Value = progressBarItem.Value + 1;

                IFeatureLayer  pFeatLay       = pLay as IFeatureLayer;
                ISpatialFilter pSpatialFilter = new SpatialFilterClass();
                pSpatialFilter.Geometry      = pGeometry;
                pSpatialFilter.GeometryField = "SHAPE";
                pSpatialFilter.SpatialRel    = esriSpatialRelEnum.esriSpatialRelIntersects;
                if (pFeatLay.FeatureClass.FeatureCount(pSpatialFilter) == 0)
                {
                    continue;
                }

                //添加图层节点
                DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
                node.Text = pLay.Name;
                node.Tag  = pLay;
                node.Expand();
                advTree.Nodes.Add(node);

                IFeatureCursor pFeatureCursor = pFeatLay.FeatureClass.Update(pSpatialFilter, false);
                updateFCur = pFeatureCursor;
                IFeature pFeat = pFeatureCursor.NextFeature();
                while (pFeat != null)
                {
                    //添加要素节点
                    DevComponents.AdvTree.Node featnode = new DevComponents.AdvTree.Node();
                    featnode.Text = pFeat.OID.ToString();
                    featnode.Tag  = pFeat;
                    node.Nodes.Add(featnode);

                    if (bFirst == true)
                    {
                        advTree.SelectedNode = featnode;
                        m_dataSourceGrid.Clear();

                        for (int i = 0; i < pFeat.Fields.FieldCount; i++)
                        {
                            if (pFeat.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                            {
                                string strGeometryType = "";
                                if (pFeat.FeatureType == esriFeatureType.esriFTSimple)
                                {
                                    switch (pFeat.Shape.GeometryType)
                                    {
                                    case esriGeometryType.esriGeometryPoint:
                                        strGeometryType = "点";
                                        break;

                                    case esriGeometryType.esriGeometryPolyline:
                                        strGeometryType = "线";
                                        break;

                                    case esriGeometryType.esriGeometryPolygon:
                                        strGeometryType = "多边形";
                                        break;
                                    }
                                }
                                else if (pFeat.FeatureType == esriFeatureType.esriFTAnnotation)
                                {
                                    strGeometryType = "注记";
                                }
                                if (string.IsNullOrEmpty(strGeometryType))
                                {
                                    strGeometryType = pFeat.Shape.GeometryType.ToString();
                                }
                                m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).AliasName, strGeometryType });
                            }
                            else
                            {
                                m_dataSourceGrid.Rows.Add(new object[] { pFeat.Fields.get_Field(i).AliasName, pFeat.get_Value(i) });
                            }
                        }
                        bFirst = false;
                    }

                    pFeat = pFeatureCursor.NextFeature();

                    intCnt++;
                }

                if (m_enumAttributeEditMode == enumAttributeEditMode.Top)
                {
                    progressBarItem.Value = listLays.Count;
                    break;
                }
            }

            labelItemMemo.Text      = intCnt.ToString() + "个要素";
            progressBarItem.Visible = false;
            this.Refresh();

            DefaultSelNde();
        }
Ejemplo n.º 18
0
        public new void Layout(List <string> PrimaryKeys)
        {
            //選取的結點的完整路徑
            List <string> selectPath = new List <string>();

            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            // 取得刪除教師 ID
            List <string> DeletedTeacheIDList                = new List <string>();
            List <string> checkDeletedTeacheIDList           = new List <string>();
            List <JHSchool.Data.JHTeacherRecord> TeacherRecs = JHSchool.Data.JHTeacher.SelectAll();
            foreach (JHSchool.Data.JHTeacherRecord tr in TeacherRecs)
            {
                if (tr.Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                {
                    DeletedTeacheIDList.Add(tr.ID);
                }
            }

            SortedList <int?, List <string> > gradeYearList = new SortedList <int?, List <string> >();
            List <string> noGradYearList = new List <string>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            int TotalCount = 0;

            foreach (var key in PrimaryKeys)
            {
                // 過濾刪除教師
                if (DeletedTeacheIDList.Contains(key))
                {
                    checkDeletedTeacheIDList.Add(key);
                    continue;
                }
                var teacherRec = Teacher.Instance.Items[key];

                foreach (var classRec in Class.Instance.GetTecaherSupervisedClass(teacherRec))
                {
                    string gradeYear = (classRec == null ? "" : classRec.GradeYear);

                    int gyear = 0;
                    int?g;
                    if (int.TryParse(gradeYear, out gyear))
                    {
                        g = gyear;
                        if (!gradeYearList.ContainsKey(g))
                        {
                            gradeYearList.Add(g, new List <string>());
                        }

                        if (!gradeYearList[g].Contains(key))
                        {
                            gradeYearList[g].Add(key);
                        }
                    }
                    else
                    {
                        g = null;

                        if (!noGradYearList.Contains(key))
                        {
                            noGradYearList.Add(key);
                        }
                    }
                }
            }

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                switch (gyear)
                {
                //case 1:
                //    gyearNode.Text = "一年級";
                //    break;
                //case 2:
                //    gyearNode.Text = "二年級";
                //    break;
                //case 3:
                //    gyearNode.Text = "三年級";
                //    break;
                //case 4:
                //    gyearNode.Text = "四年級";
                //    break;
                default:
                    gyearNode.Text = "" + gyear + "年級";
                    break;
                }
                // TotalCount += gradeYearList[gyear].Count;
                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";
                items.Add(gyearNode, gradeYearList[gyear]);
                rootNode.Nodes.Add(gyearNode);
            }

            List <string> tmp = new List <string>();

            foreach (List <string> strList in gradeYearList.Values)
            {
                foreach (string str in strList)
                {
                    if (!tmp.Contains(str))
                    {
                        tmp.Add(str);
                    }
                }
            }



            if (noGradYearList.Count > 0)
            {
//                TotalCount += noGradYearList.Count;
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "未分年級" + "(" + noGradYearList.Count + ")";
                items.Add(gyearNode, noGradYearList);

                rootNode.Nodes.Add(gyearNode);
            }



            rootNode.Text = "所有班導師(" + TotalCount + ")";

            rootNode.Expand();

            advTree1.Nodes.Add(rootNode);
            // 這裡在加入所有班導師
            teacherKeys.Clear();

            //foreach (List<string> str in gradeYearList.Values)
            //    teacherKeys.AddRange(str);
            // 有年級
            foreach (string str in tmp)
            {
                teacherKeys.Add(str);
            }
            // 無年級
            foreach (string str in noGradYearList)
            {
                if (!teacherKeys.Contains(str))
                {
                    teacherKeys.Add(str);
                }
            }

            TotalCount = teacherKeys.Count;

            rootNode.Text = "所有班導師(" + TotalCount + ")";

            //items.Add(rootNode, PrimaryKeys);
            items.Add(rootNode, teacherKeys);
            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                {
                    advTree1.SelectedNode = selectNode;
                }
            }


            // 加入刪除教師
            if (checkDeletedTeacheIDList.Count > 0)
            {
                //TotalCount += DeletedTeacheIDList.Count;
                DevComponents.AdvTree.Node DelTeacheNode = new DevComponents.AdvTree.Node();
                DelTeacheNode.Text = "刪除教師" + "(" + checkDeletedTeacheIDList.Count + ")";
                items.Add(DelTeacheNode, checkDeletedTeacheIDList);
                advTree1.Nodes.Add(DelTeacheNode);
                //rootNode.Nodes.Add(DelTeacheNode);
            }

            // 非班導師
            // 是班導師ID

            List <string> isClassTeacherID  = new List <string>();
            List <string> NotClassTeacherID = new List <string>();
            foreach (JHSchool.Data.JHClassRecord classRec in JHSchool.Data.JHClass.SelectAll())
            {
                isClassTeacherID.Add(classRec.RefTeacherID);
            }

            foreach (JHSchool.Data.JHTeacherRecord teachRec in JHSchool.Data.JHTeacher.SelectAll())
            {
                if (!isClassTeacherID.Contains(teachRec.ID))
                {
                    if (teachRec.Status == K12.Data.TeacherRecord.TeacherStatus.一般)
                    {
                        NotClassTeacherID.Add(teachRec.ID);
                    }
                }
            }
            DevComponents.AdvTree.Node NotClassTeacherNode = new DevComponents.AdvTree.Node();
            NotClassTeacherNode.Text = "非班導師 (" + NotClassTeacherID.Count + ")";
            items.Add(NotClassTeacherNode, NotClassTeacherID);
            advTree1.Nodes.Add(NotClassTeacherNode);

            //advTree1.Focus();
        }
Ejemplo n.º 19
0
        public new void Layout(List<string> PrimaryKeys)
        {
            //选取的结点的完整路径
            List<string> selectPath = new List<string>();
            #region 记录选取的结点的完整路径
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            //用来记录年级及班级对应的数据结构,第一维记录年级,第二维记录年级下的班级编号
            SortedList<int?, List<string>> gradeYearList = new SortedList<int?, List<string>>();

            //用来记录未分类的班级编号
            List<string> nullGradeList = new List<string>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            rootNode.Text = "所有班级(" + PrimaryKeys.Count + ")";

            //取得所有班级编号
            foreach (var key in PrimaryKeys)
            {
                //根据学生记录取得班级记录
                ClassRecord classRec = Class.Instance[key];

                //根据班级记录取得年级,若是年级为null则年级为空白
                string gradeYear = (classRec == null ? "" : classRec.GradeYear);
                int gyear = 0;
                int? g;

                //将gradeYear转型成int
                if (int.TryParse(gradeYear, out gyear))
                {
                    g = gyear;
                    if (!gradeYearList.ContainsKey(g))
                        gradeYearList.Add(g, new List<string>());

                    //将班级编号加入所属年级的集合当中
                    gradeYearList[g].Add(key);
                }
                else
                {
                    //加入没有分类的班级
                    g = null;
                    nullGradeList.Add(key);
                }
            }

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "" + gyear + "年级";

                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";

                items.Add(gyearNode, gradeYearList[gyear]);

                rootNode.Nodes.Add(gyearNode);
            }

            if (nullGradeList.Count > 0)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "未分年级(" + nullGradeList.Count + ")";
                items.Add(gyearNode, nullGradeList);

                rootNode.Nodes.Add(gyearNode);
            }

            advTree1.Nodes.Add(rootNode);

            rootNode.Expand();

            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                    advTree1.SelectedNode = selectNode;
            }
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 根据条件查找数据填充窗体,用来进行SQL查询
        /// </summary>
        /// <param name="pMap">被查询的地图对象</param>
        public void FillData(IFeatureLayer pFeatLay, IQueryFilter pAttributeEditFilter, esriSelectionResultEnum pSelectionResult)
        {
            advTree.Nodes.Clear();
            m_dataSourceGrid.Clear();

            //获取查询的图层

            progressBarItem.Visible = false;
            this.Refresh();
            int  intCnt = 0;//记录要素的个数
            bool bFirst = true;


            //添加图层节点
            DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node();
            node.Text = pFeatLay.Name;
            node.Tag  = pFeatLay;
            node.Expand();
            advTree.Nodes.Add(node);
            //进行查询操作
            IFeatureSelection pFeatureSelection = pFeatLay as IFeatureSelection;

            pFeatureSelection.SelectFeatures(pAttributeEditFilter, pSelectionResult, false);
            //保存查询的结果,包括要素类和查找到的要素
            //循环取得选中Feature的ID来得到Feature

            IFeature pFeature;
            IEnumIDs pEnumIDs = pFeatureSelection.SelectionSet.IDs;
            int      iIDIndex = pEnumIDs.Next();

            while (iIDIndex != -1)
            {
                pFeature = pFeatLay.FeatureClass.GetFeature(iIDIndex);
                //添加要素节点
                DevComponents.AdvTree.Node featnode = new DevComponents.AdvTree.Node();
                featnode.Text = pFeature.OID.ToString();
                featnode.Tag  = pFeature;
                node.Nodes.Add(featnode);

                if (bFirst == true)
                {
                    advTree.SelectedNode = featnode;
                    m_dataSourceGrid.Clear();

                    for (int i = 0; i < pFeature.Fields.FieldCount; i++)
                    {
                        if (pFeature.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
                        {
                            string strGeometryType = "";
                            if (pFeature.FeatureType == esriFeatureType.esriFTSimple)
                            {
                                switch (pFeature.Shape.GeometryType)
                                {
                                case esriGeometryType.esriGeometryPoint:
                                    strGeometryType = "点";
                                    break;

                                case esriGeometryType.esriGeometryPolyline:
                                    strGeometryType = "线";
                                    break;

                                case esriGeometryType.esriGeometryPolygon:
                                    strGeometryType = "多边形";
                                    break;
                                }
                            }
                            else if (pFeature.FeatureType == esriFeatureType.esriFTAnnotation)
                            {
                                strGeometryType = "注记";
                            }
                            if (string.IsNullOrEmpty(strGeometryType))
                            {
                                strGeometryType = pFeature.Shape.GeometryType.ToString();
                            }
                            m_dataSourceGrid.Rows.Add(new object[] { pFeature.Fields.get_Field(i).AliasName, strGeometryType });
                        }
                        else
                        {
                            m_dataSourceGrid.Rows.Add(new object[] { pFeature.Fields.get_Field(i).AliasName, pFeature.get_Value(i) });
                        }
                    }
                    bFirst = false;
                }
                iIDIndex = pEnumIDs.Next();
                intCnt++;
            }

            labelItemMemo.Text      = intCnt.ToString() + "个要素";
            progressBarItem.Visible = false;
            this.Refresh();

            DefaultSelNde();
        }
Ejemplo n.º 21
0
        //递归遍历xmlnode初始化treenode
        //shduan 20110731
        private void getTreeNodeFromXMLNode(XmlNode vXmlNode, DevComponents.AdvTree.Node vNode)
        {
            foreach (XmlNode vSubXmlNode in vXmlNode.ChildNodes)//全国0
            {
                if (vSubXmlNode.Name != "Town")
                {
                    string strXZQName = vSubXmlNode.Attributes["ItemName"].Value;
                    string strXZQCode = vSubXmlNode.Attributes["XzqCode"].Value;
                    DevComponents.AdvTree.Node vSubNode = new DevComponents.AdvTree.Node();
                    vSubNode.CheckBoxVisible = true;
                    if (m_ListXian != null && m_ListXian.Contains(strXZQCode))
                    {
                        vSubNode.CheckState = CheckState.Checked;
                        if (vNode.CheckState == CheckState.Unchecked)
                        {
                            vNode.CheckState = CheckState.Checked;
                        }
                        if (vNode.Parent != null && vNode.Parent.CheckState != CheckState.Checked)
                        {
                            vNode.Parent.CheckState = CheckState.Checked;
                        }
                    }
                    vSubNode.Text    = strXZQName;
                    vSubNode.Name    = strXZQCode;
                    vSubNode.Tag     = vSubXmlNode.Name;
                    vSubNode.DataKey = vSubXmlNode as object;
                    //added by chulili 20110818 设置节点图标
                    switch (vSubXmlNode.Name)
                    {
                    case "Province":
                        vSubNode.ImageIndex = 35;
                        //vSubNode.SelectedImageIndex = 35;
                        break;

                    case "City":
                        vSubNode.ImageIndex = 37;
                        //vSubNode.SelectedImageIndex = 37;
                        break;

                    case "County":
                        vSubNode.ImageIndex = 36;
                        //vSubNode.SelectedImageIndex = 36;
                        break;

                    case "Town":
                        vSubNode.ImageIndex = 34;
                        //vNode.SelectedImageIndex = 36;
                        break;

                    case "Village":
                        vSubNode.ImageIndex = 34;
                        //vNode.SelectedImageIndex = 36;
                        break;
                    }
                    //end added by chulili 20110818
                    vNode.Nodes.Add(vSubNode);
                    getTreeNodeFromXMLNode(vSubXmlNode, vSubNode);
                    try
                    {
                        if (vSubXmlNode.Attributes["Expand"].Value == "1")
                        {
                            vSubNode.Expand();
                        }
                    }
                    catch
                    {
                    }
                }
            }
            if (vNode.Tag.ToString() == "XZQTree") //如果行政区代码为0就就展开,若不是则不展开,防止递归展开所以子节点 xisheng 20110803
            {
                vNode.Expand();
            }
        }
Ejemplo n.º 22
0
        void ExtracurricularActivitiesView_SourceChanged(object sender, EventArgs e)
        {
            if (advTree1.SelectedNode != null)
            {
                if (advTree1.SelectedNode.Tag != null)
                {
                    CurrNode = "" + advTree1.SelectedNode.Tag;
                }
            }

            Dic.Clear();
            advTree1.Nodes.Clear();

            DevComponents.AdvTree.Node Node1 = new DevComponents.AdvTree.Node();
            Node1.Text = "所有分類(" + Source.Count() + ")";
            Node1.Tag  = "All";
            advTree1.Nodes.Add(Node1); //加入

            if (Source.Count != 0)
            {
                AccessHelper _AccessHelper = new AccessHelper();

                string            str      = string.Join("','", Source);
                List <CLUBRecord> clubList = _AccessHelper.Select <CLUBRecord>("uid in ('" + str + "')");

                clubList.Sort(SortClub); //Sort

                List <string> list = new List <string>();

                foreach (CLUBRecord each in clubList)
                {
                    if (string.IsNullOrEmpty(each.ClubCategory) || each.ClubCategory == "未分類")
                    {
                        list.Add(each.UID);
                        continue;
                    }

                    if (!Dic.ContainsKey(each.ClubCategory))
                    {
                        Dic.Add(each.ClubCategory, new List <string>());
                    }

                    Dic[each.ClubCategory].Add(each.UID);
                }

                Dic.Add("未分類", list);

                foreach (string each in Dic.Keys)
                {
                    //增加分類Node
                    DevComponents.AdvTree.Node Node2 = new DevComponents.AdvTree.Node();
                    Node2.Text = each + "(" + Dic[each].Count + ")";
                    Node2.Tag  = each;
                    Node1.Nodes.Add(Node2);
                }

                if (string.IsNullOrEmpty(CurrNode) || CurrNode == "All")
                {
                    advTree1.SelectedNode = Node1;
                    SetListPaneSource(Source, false, false);
                }
                else
                {
                    foreach (DevComponents.AdvTree.Node each in Node1.Nodes)
                    {
                        if ("" + each.Tag == CurrNode)
                        {
                            if (Dic.ContainsKey(CurrNode))
                            {
                                advTree1.SelectedNode = each;
                                SetListPaneSource(Dic[CurrNode], false, false);
                                return;
                            }
                        }
                    }
                }
                Node1.Expand();
            }
            else
            {
                SetListPaneSource(Source, false, false);
            }
        }
Ejemplo n.º 23
0
        //ygc 20130419 根据行政区XML文件初始化树图
        private void InitialTreeView(string XZQXmlPath)
        {
            advXZQ.Nodes.Clear();
            XmlDocument cXmlDoc = new XmlDocument();

            if (cXmlDoc != null)
            {
                cXmlDoc.Load(XZQXmlPath);
                //changed by chulili 准确找到行政区节点
                string  strSearch  = "//XZQTree";
                XmlNode vChinaNode = cXmlDoc.SelectSingleNode(strSearch);
                string  xnlattr    = vChinaNode.Attributes["ItemName"].Value;
                DevComponents.AdvTree.Node vRootNode = new DevComponents.AdvTree.Node();
                vRootNode.Text       = xnlattr;
                vRootNode.Name       = xnlattr;
                vRootNode.Tag        = vChinaNode.Name;
                vRootNode.ImageIndex = 38;
                vRootNode.DataKey    = vChinaNode as object;
                vRootNode.CheckState = CheckState.Checked;
                advXZQ.Nodes.Add(vRootNode);//行政区节点
                DevComponents.AdvTree.Node tNode1 = advXZQ.Nodes[0];
                if (!vChinaNode.HasChildNodes)
                {
                    return;
                }
                vRootNode.Expand();
                foreach (XmlNode vSubXmlNode in vChinaNode.ChildNodes)//全国0//改为省节点
                {
                    //shduan 20110731
                    string strXZQName = vSubXmlNode.Attributes["ItemName"].Value;
                    string strXZQCode = vSubXmlNode.Attributes["XzqCode"].Value;
                    DevComponents.AdvTree.Node vNode = new DevComponents.AdvTree.Node();
                    vNode.CheckBoxVisible = true;
                    vNode.Text            = strXZQName;
                    vNode.Name            = strXZQCode;
                    vNode.Tag             = vSubXmlNode.Name;
                    vNode.DataKey         = vSubXmlNode as object;
                    //added by chulili 20110818 设置节点图标
                    switch (vSubXmlNode.Name)
                    {
                    case "Province":
                        vNode.ImageIndex = 35;
                        //vNode.SelectedImageIndex = 35;
                        break;

                    case "City":
                        vNode.ImageIndex = 37;
                        //vNode.SelectedImageIndex = 37;
                        break;

                    case "County":
                        vNode.ImageIndex = 36;
                        //vNode.SelectedImageIndex = 36;
                        break;

                    case "Town":
                        vNode.ImageIndex = 34;
                        //vNode.SelectedImageIndex = 36;
                        break;

                    case "Village":
                        //vNode.ImageIndex = 36;
                        //vNode.SelectedImageIndex = 36;
                        break;
                    }
                    //end added by chulili 20110818
                    tNode1.Nodes.Add(vNode);
                    getTreeNodeFromXMLNode(vSubXmlNode, vNode);
                    try
                    {
                        if (vSubXmlNode.Attributes["Expand"].Value == "1")
                        {
                            vNode.Expand();
                        }
                    }
                    catch
                    {
                    }
                }
                //tNode1.Expand();
            }
            cXmlDoc = null;
        }
        private void LoadTree()
        {
            DevComponents.AdvTree.Node _nd = null;
            foreach (var c in datam.DEPARTMENT_INNER_COLLECTION)
            {
                _nd             = new DevComponents.AdvTree.Node();
                _nd.Text        = c.Value;
                _nd.Tag         = c.Key;
                _nd.Name        = string.Format("MDEPT{0}", c.Key);
                _nd.Style       = _dept_style;
                _nd.ContextMenu = contextMenuFolder;
                advTree1.Nodes.Add(_nd); _nd = null;
            }
            var nlist = from k in datam.DATA_DEPARTMENT.Values
                        where k.is_visible & k.dept_type == em.dept_typeS.main
                        group k by k.parent_id into new_group
                        select new
            {
                _key    = new_group.Key,
                gp_data = new_group
            };

            DevComponents.AdvTree.Node _parent = null;
            foreach (var k in nlist)
            {
                _parent = null;
                _parent = advTree1.FindNodeByName(string.Format("MDEPT{0}", k._key));
                foreach (var sd in k.gp_data)
                {
                    _nd       = new DevComponents.AdvTree.Node();
                    _nd.Text  = sd.dept_name;
                    _nd.Tag   = sd;
                    _nd.Name  = string.Format("DEPT{0}", sd.dept_id);
                    _nd.Style = _sb_dept_style;
                    if (sd.dept_id != -5000)
                    {
                        _nd.ContextMenu = contextMenuFile;
                    }
                    _parent.Nodes.Add(_nd); _nd = null;
                }
                if (_parent != null)
                {
                    _parent.Expand();
                }
            }
            nlist = from k in datam.DATA_DEPARTMENT.Values
                    where k.is_visible & k.dept_type == em.dept_typeS.sub
                    group k by k.parent_id into new_group
                    select new
            {
                _key    = new_group.Key,
                gp_data = new_group
            };

            foreach (var k in nlist)
            {
                _parent = null;
                _parent = advTree1.FindNodeByName(string.Format("DEPT{0}", k._key));
                foreach (var sd in k.gp_data)
                {
                    _nd                         = new DevComponents.AdvTree.Node();
                    _nd.Text                    = sd.dept_name;
                    _nd.Tag                     = sd;
                    _nd.Name                    = string.Format("DEPT{0}", sd.dept_id);
                    _nd.Style                   = _sb_dept_style2;
                    _nd.ContextMenu             = contextMenuFile;
                    _parent.Nodes.Add(_nd); _nd = null;
                }
                if (_parent != null)
                {
                    _parent.Expand();
                }
            }
        }
Ejemplo n.º 25
0
        public new void Layout(List <string> PrimaryKeys)
        {
            //選取的結點的完整路徑

            List <string> selectPath = new List <string>();

            #region 記錄選取的結點的完整路徑
            var selectNode = advTree1.SelectedNode;
            if (selectNode != null)
            {
                while (selectNode != null)
                {
                    selectPath.Insert(0, selectNode.Text);
                    selectNode = selectNode.Parent;
                }
            }
            #endregion

            advTree1.Nodes.Clear();
            items.Clear();

            //用來記錄年級及班級對應的資料結構,第一維記錄年級,第二維記錄年級下的班級編號
            SortedList <int?, List <string> > gradeYearList = new SortedList <int?, List <string> >();

            //用來記錄未分類的班級編號
            List <string> nullGradeList = new List <string>();

            DevComponents.AdvTree.Node rootNode = new DevComponents.AdvTree.Node();

            rootNode.Text = "所有班級(" + PrimaryKeys.Count + ")";

            //取得所有班級編號
            foreach (var key in PrimaryKeys)
            {
                //根據學生記錄取得班級記錄
                ClassRecord classRec = Class.Instance[key];

                //根據班級記錄取得年級,若是年級為null則年級為空白
                string gradeYear = (classRec == null ? "" : classRec.GradeYear);
                int    gyear     = 0;
                int?   g;

                //將gradeYear轉型成int
                if (int.TryParse(gradeYear, out gyear))
                {
                    g = gyear;
                    if (!gradeYearList.ContainsKey(g))
                    {
                        gradeYearList.Add(g, new List <string>());
                    }

                    //將班級編號加入所屬年級的集合當中
                    gradeYearList[g].Add(key);
                }
                else
                {
                    //加入沒有分類的班級
                    g = null;
                    nullGradeList.Add(key);
                }
            }

            foreach (var gyear in gradeYearList.Keys)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                switch (gyear)
                {
                //case 1:
                //    gyearNode.Text = "一年級";
                //    break;
                //case 2:
                //    gyearNode.Text = "二年級";
                //    break;
                //case 3:
                //    gyearNode.Text = "三年級";
                //    break;
                //case 4:
                //    gyearNode.Text = "四年級";
                //    break;
                default:
                    gyearNode.Text = "" + gyear + "年級";
                    break;
                }


                gyearNode.Text += "(" + gradeYearList[gyear].Count + ")";

                items.Add(gyearNode, gradeYearList[gyear]);

                rootNode.Nodes.Add(gyearNode);
            }

            if (nullGradeList.Count > 0)
            {
                DevComponents.AdvTree.Node gyearNode = new DevComponents.AdvTree.Node();
                gyearNode.Text = "未分年級(" + nullGradeList.Count + ")";
                items.Add(gyearNode, nullGradeList);

                rootNode.Nodes.Add(gyearNode);
            }

            advTree1.Nodes.Add(rootNode);

            rootNode.Expand();

            items.Add(rootNode, PrimaryKeys);

            if (selectPath.Count != 0)
            {
                selectNode = SelectNode(selectPath, 0, advTree1.Nodes);
                if (selectNode != null)
                {
                    advTree1.SelectedNode = selectNode;
                }
            }

            // advTree1.Focus();
        }