コード例 #1
0
ファイル: EventHub.cs プロジェクト: ischoolinc/SHEvaluation
        public void InvokGraduationPlanUpdated(string id)
        {
            GraduationPlanInfo oldInfo = null;
            GraduationPlanInfo newInfo = null;

            if (GraduationPlan.GraduationPlan.Instance._Items.ContainsKey(id))
            {
                oldInfo = GraduationPlan.GraduationPlan.Instance._Items[id];
                DSResponse        resp     = QueryGraduationPlan.GetGraduationPlan(id);
                List <XmlElement> SortList = new List <XmlElement>();
                XmlElement        gPlan    = resp.GetContent().GetElement("GraduationPlan");
                if (gPlan != null)
                {
                    newInfo = new GraduationPlanInfo(gPlan);
                    GraduationPlan.GraduationPlan.Instance._Items[id] = newInfo;
                }
                else
                {
                    GraduationPlan.GraduationPlan.Instance._Items.Remove(id);
                }
            }
            if (GraduationPlanUpdated != null)
            {
                GraduationPlanUpdated.Invoke(this, new UpdateGraduationPlanEventArgs(oldInfo, newInfo));
            }
        }
コード例 #2
0
        private void StartCheck()
        {
            _GPlanMapping = new Dictionary <GraduationPlanInfo, ButtonItem>();
            List <GraduationPlanInfo> gplanList = new List <GraduationPlanInfo>();

            foreach (ButtonItem item in itemPanel1.Items)
            {
                GraduationPlanInfo gplan = (GraduationPlanInfo)item.Tag;
                _GPlanMapping.Add(gplan, item);
                gplanList.Add(gplan);
            }
            _BKWChecker.RunWorkerAsync(gplanList);
        }
コード例 #3
0
        private void StartCheck()
        {
            _GPlanMapping = new Dictionary <GraduationPlanInfo, Node>();
            List <GraduationPlanInfo> gplanList = new List <GraduationPlanInfo>();

            foreach (Node node in advTree1.Nodes)
            {
                foreach (Node childNode in node.Nodes)
                {
                    GraduationPlanInfo gplan = (GraduationPlanInfo)childNode.Tag;
                    _GPlanMapping.Add(gplan, childNode);
                    gplanList.Add(gplan);
                }
            }
            _BKWChecker.RunWorkerAsync(gplanList);
        }
 public GraduationPlanUpdateDetailForm(GraduationPlanInfo graduationPlanInfo, string action)
 {
     InitializeComponent();
     this.GraduationPlanInfo = graduationPlanInfo;
     if (action == "差異更新")
     {
         this.LoadCombo();
         this.CurrentGraduationPlan = ((OldGraduationPlanInfo)(this.cboGraduationName.SelectedItem));
         checkBoxShowOnly.Checked   = true;
         this.FillDataGridView(this.GraduationPlanInfo.DicOldGraduationPlanInfos[CurrentGraduationPlan.SysID].OldContentXml, this.checkBoxShowOnly.Checked);
     }
     else if (action == "新增")
     {
         this.SettView(action);
         this.FillDataGridViewShowNew();
     }
 }
コード例 #5
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (_GraduationPlanEditor.IsDirty)
            {
                if (DialogResult.No == MsgBox.Show("變更尚未儲存,確定離開?", MessageBoxButtons.YesNo))
                {
                    return;
                }
                GraduationPlanInfo info = (GraduationPlanInfo)this.advTree1.SelectedNode.Tag;
                _GraduationPlanEditor.SetSource(info.GraduationPlanElement);
                SaveAdvTreeExpandStatus();
            }
            GraduationPlanCreator graduationPlanCreator = new GraduationPlanCreator();

            if (graduationPlanCreator.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                _GraduationPlanEditor.SetSource(graduationPlanCreator._CopyElement);
                _SelectItem = null;
            }
        }
コード例 #6
0
        /// <summary>
        /// 取得全新課程規化表 之XML
        /// </summary>

        public string GetNewGraduationContent(GraduationPlanInfo graduationInfo)
        {
            // 2.產生各科課程規畫表資料
            {
                XmlDocument xmlDoc = new XmlDocument();

                XmlElement eleGraduationPlan = xmlDoc.CreateElement("GraduationPlan");

                Dictionary <string, int> dicSubjectLevel = new Dictionary <string, int>();
                int rows = 1;

                foreach (CourseInfo courseInfo in graduationInfo.GetAllCourseInfoList())
                {
                    eleGraduationPlan.SetAttribute("SchoolYear", courseInfo.EnterYear);
                    #region 填入XML

                    int startLevel = dicSubjectLevel.ContainsKey(courseInfo.NewSubjectName) ? dicSubjectLevel[courseInfo.NewSubjectName] + 1 : 1;

                    //放個學期的學分數
                    Dictionary <int, string> dicCreditEachSemester = courseInfo.DicCreditEachSemester;

                    int level = startLevel;
                    foreach (int semester in dicCreditEachSemester.Keys)
                    {
                        XmlElement eleSubject = xmlDoc.CreateElement("Subject");

                        #region 生成XML

                        eleSubject.SetAttribute("Category", "");
                        eleSubject.SetAttribute("Credit", dicCreditEachSemester[semester]);
                        eleSubject.SetAttribute("Domain", (courseInfo.領域名稱));
                        eleSubject.SetAttribute("Entry", courseInfo.Entry);
                        eleSubject.SetAttribute("GradeYear", Helper.GetGradeYear(semester).GradeYear.ToString());

                        if (!dicSubjectLevel.ContainsKey(courseInfo.NewSubjectName))
                        {
                            dicSubjectLevel.Add(courseInfo.NewSubjectName, level);
                            eleSubject.SetAttribute("Level", level.ToString());
                            eleSubject.SetAttribute("FullName", courseInfo.NewSubjectName + " " + Helper.GetRomaNumber(level));
                            level++;
                        }
                        else
                        {
                            dicSubjectLevel[courseInfo.NewSubjectName] = level;
                            eleSubject.SetAttribute("Level", level.ToString());

                            // todo  LEVEL 問題
                            // if (_DicForFullNameMap.ContainsKey(level))
                            {
                                courseInfo.NewSubjectNameWithLevel = courseInfo.NewSubjectName + " " + Helper.GetRomaNumber(level);
                                eleSubject.SetAttribute("FullName", courseInfo.NewSubjectNameWithLevel);
                                level++;
                            }
                        }
                        eleSubject.SetAttribute("NotIncludedInCalc", "False");
                        eleSubject.SetAttribute("NotIncludedInCredit", "False");
                        eleSubject.SetAttribute("Required", courseInfo.Required);
                        eleSubject.SetAttribute("RequiredBy", courseInfo.RequiredBy);
                        eleSubject.SetAttribute("Semester", Helper.GetGradeYear(semester).Semester.ToString());
                        eleSubject.SetAttribute("SubjectName", courseInfo.NewSubjectName);

                        eleSubject.SetAttribute("課程代碼", courseInfo.新課程代碼);
                        eleSubject.SetAttribute("課程類別", courseInfo.課程類別說明);
                        eleSubject.SetAttribute("開課方式", courseInfo.開課方式);
                        eleSubject.SetAttribute("科目屬性", courseInfo.科目屬性說明);
                        eleSubject.SetAttribute("領域名稱", courseInfo.領域名稱);
                        eleSubject.SetAttribute("課程名稱", courseInfo.NewSubjectName);
                        eleSubject.SetAttribute("學分", dicCreditEachSemester[semester]);
                        eleSubject.SetAttribute("授課學期學分", courseInfo.授課學期學分);
                        eleGraduationPlan.AppendChild(eleSubject);
                        {
                            XmlElement grouping = xmlDoc.CreateElement("Grouping");
                            grouping.SetAttribute("RowIndex", (rows).ToString());
                            grouping.SetAttribute("startLevel", startLevel.ToString());
                            eleSubject.AppendChild(grouping);
                        }
                        #endregion
                    }
                    #endregion
                    rows++;
                }
                return(eleGraduationPlan.OuterXml);
            }
        }
コード例 #7
0
        private void item_Click(object sender, EventArgs e)
        {
            if (_SelectButton != null)
            {
                _SelectButton.Checked = false;
            }
            ButtonItem         item = (ButtonItem)sender;
            GraduationPlanInfo info = (GraduationPlanInfo)item.Tag;

            _SelectButton = item;
            item.Checked  = true;

            tabControl2.Visible       = true & (_SelectButton != null);
            tabControlPanel3.Visible  = tabControlPanel2.Visible = tabItem2.Visible = tabItem1.Visible = true;
            tabControl2.SelectedTab   = tabItem1;
            tabControl2.SelectedPanel = tabControlPanel2;

            labelX2.Text = labelX1.Text = item.Text;
            _GraduationPlanEditor.SetSource(info.GraduationPlanElement);
            listViewEx1.SuspendLayout();
            listViewEx1.Items.Clear();
            listViewEx1.Groups.Clear();
            Dictionary <ClassRecord, int> classCount      = new Dictionary <ClassRecord, int>();
            List <StudentRecord>          noClassStudents = new List <StudentRecord>();

            foreach (StudentRecord stu in _AccessHelper.StudentHelper.GetAllStudent())
            {
                if (GraduationPlan.GraduationPlan.Instance.GetStudentGraduationPlan(stu.StudentID) == info)
                {
                    if (stu.RefClass != null)
                    {
                        if (!classCount.ContainsKey(stu.RefClass))
                        {
                            classCount.Add(stu.RefClass, 0);
                        }
                        classCount[stu.RefClass]++;
                    }
                    else
                    {
                        noClassStudents.Add(stu);
                    }
                }
            }
            foreach (ClassRecord var in classCount.Keys)
            {
                string groupKey;
                int    a;
                if (int.TryParse(var.GradeYear, out a))
                {
                    groupKey = var.GradeYear + " 年級";
                }
                else
                {
                    groupKey = var.GradeYear;
                }
                ListViewGroup group = listViewEx1.Groups[groupKey];
                if (group == null)
                {
                    group = listViewEx1.Groups.Add(groupKey, groupKey);
                }
                listViewEx1.Items.Add(new ListViewItem(var.ClassName + "(" + classCount[var] + ") ", 0, group));
            }
            if (noClassStudents.Count > 0)
            {
                ListViewGroup group = listViewEx1.Groups["未分班"];
                if (group == null)
                {
                    group = listViewEx1.Groups.Add("未分班", "未分班");
                }
                foreach (StudentRecord stu in noClassStudents)
                {
                    listViewEx1.Items.Add(new ListViewItem(stu.StudentName + "[" + stu.StudentNumber + "]  ", 1, group));
                }
            }
            listViewEx1.ResumeLayout();
            tabControl2.Visible = true;
            buttonX3.Enabled    = true;
        }
コード例 #8
0
        void bkw_DoWork(object sender, DoWorkEventArgs e)
        {
            BackgroundWorker   bkw  = (BackgroundWorker)sender;
            SelectSemesterForm form = e.Argument as SelectSemesterForm;

            AccessHelper accessHelper = new AccessHelper();

            bkw.ReportProgress(1);
            double totleClass = accessHelper.ClassHelper.GetSelectedClass().Count;

            if (totleClass <= 0)
            {
                totleClass = 0;
            }
            double processedClass = 0;

            foreach (ClassRecord classRec in accessHelper.ClassHelper.GetSelectedClass())
            {
                processedClass += 1;
                #region 班級開課
                int gradeYear = 0;
                if (!int.TryParse(classRec.GradeYear, out gradeYear))
                {
                    continue;
                }
                //班級內每個學生的課程規劃表
                Dictionary <GraduationPlanInfo, List <StudentRecord> > graduations = new Dictionary <GraduationPlanInfo, List <StudentRecord> >();
                #region 整理班級內每個學生的課程規劃表
                foreach (StudentRecord studentRec in classRec.Students)
                {
                    //取得學生的課程規劃表
                    GraduationPlanInfo info = GraduationPlan.GraduationPlan.Instance.GetStudentGraduationPlan(studentRec.StudentID);
                    if (info != null)
                    {
                        if (!graduations.ContainsKey(info))
                        {
                            graduations.Add(info, new List <StudentRecord>());
                        }
                        graduations[info].Add(studentRec);
                    }
                }
                #endregion
                //所有課程規劃表中要開的課程
                Dictionary <string, GraduationPlanSubject> courseList = new Dictionary <string, GraduationPlanSubject>();
                //課程的科目
                Dictionary <string, string> subjectList = new Dictionary <string, string>();
                //課程的級別
                Dictionary <string, string> levelList = new Dictionary <string, string>();
                //有此課程的課程規劃表
                Dictionary <string, List <GraduationPlanInfo> > graduationList = new Dictionary <string, List <GraduationPlanInfo> >();
                #region 整裡所有要開的課程
                foreach (GraduationPlanInfo gplan in graduations.Keys)
                {
                    foreach (GraduationPlanSubject gplanSubject in gplan.SemesterSubjects(gradeYear, form.Semester))
                    {
                        // 如果開選課程沒有勾起,只開必修課程。
                        if (!form.isCreateAll)
                        {
                            if (gplanSubject.Required == "選修")
                            {
                                continue;
                            }
                        }

                        string key = gplanSubject.SubjectName.Trim() + "^_^" + gplanSubject.Level;
                        if (!courseList.ContainsKey(key))
                        {
                            //新增一個要開的課程
                            courseList.Add(key, gplanSubject);
                            subjectList.Add(key, gplanSubject.SubjectName.Trim());
                            levelList.Add(key, gplanSubject.Level);
                            graduationList.Add(key, new List <GraduationPlanInfo>());
                        }
                        graduationList[key].Add(gplan);
                    }
                }
                #endregion
                //本學期已開的課程
                Dictionary <string, CourseRecord> existSubject = new Dictionary <string, CourseRecord>();
                string qry_class_course = "" +
                                          "SELECT DISTINCT " +
                                          "course.id AS course_id " +
                                          " FROM course " +
                                          " WHERE ref_class_id = " + classRec.ClassID +
                                          " AND course.school_year=" + form.SchoolYear +
                                          " AND course.semester= " + form.Semester + ";";

                QueryHelper   qh_class_course = new QueryHelper();
                DataTable     dt_class_course = qh_class_course.Select(qry_class_course);
                List <string> courseIDList    = new List <string>();

                foreach (DataRow dr in dt_class_course.Rows)
                {
                    courseIDList.Add(dr["course_id"].ToString());
                }

                #region 整裡本學期已開的課程
                List <CourseRecord> tmpCourse = accessHelper.CourseHelper.GetCourse(courseIDList);
                foreach (CourseRecord courseRec in tmpCourse)
                {
                    string key = courseRec.Subject + "^_^" + courseRec.SubjectLevel;
                    if (!existSubject.ContainsKey(key))
                    {
                        existSubject.Add(key, courseRec);
                    }
                }

                #endregion
                #region 開課
                List <SmartSchool.Feature.Course.AddCourse.InsertCourse> newCourses = new List <SmartSchool.Feature.Course.AddCourse.InsertCourse>();
                foreach (string key in courseList.Keys)
                {
                    //是原來沒有的課程
                    if (!existSubject.ContainsKey(key))
                    {
                        GraduationPlanSubject cinfo = courseList[key];
                        newCourses.Add(new SmartSchool.Feature.Course.AddCourse.InsertCourse(
                                           classRec.ClassName + " " + cinfo.FullName,
                                           cinfo.SubjectName.Trim(),
                                           cinfo.Level,
                                           classRec.ClassID,
                                           form.SchoolYear.ToString(),
                                           form.Semester.ToString(),
                                           cinfo.Credit,
                                           (cinfo.NotIncludedInCredit) ? "是" : "否",
                                           (cinfo.NotIncludedInCalc) ? "是" : "否",
                                           cinfo.Entry,
                                           cinfo.Required == "必修" ? "必" : "選",
                                           cinfo.RequiredBy
                                           ));
                    }
                }
                if (newCourses.Count > 0)
                {
                    SmartSchool.Feature.Course.AddCourse.Insert(newCourses);
                    SmartSchool.Broadcaster.Events.Items["課程/新增"].Invoke();
                }
                #endregion
                #region 重新整理已開的課程
                existSubject.Clear();


                DataTable dt_class_courseN = qh_class_course.Select(qry_class_course);
                courseIDList.Clear();
                foreach (DataRow dr in dt_class_courseN.Rows)
                {
                    courseIDList.Add(dr["course_id"].ToString());
                }

                List <CourseRecord> tmpCourse2 = accessHelper.CourseHelper.GetCourse(courseIDList);
                foreach (CourseRecord courseRec in tmpCourse2)
                {
                    string key = courseRec.Subject + "^_^" + courseRec.SubjectLevel;
                    if (!existSubject.ContainsKey(key))
                    {
                        existSubject.Add(key, courseRec);
                    }
                }

                //填入修課學生
                accessHelper.CourseHelper.FillStudentAttend(existSubject.Values);


                #endregion
                #region 加入學生修課
                DSXmlHelper insertSCAttendHelper = new DSXmlHelper("InsertSCAttend");
                bool        addAttend            = false;
                foreach (StudentRecord studentRec in classRec.Students)
                {
                    if (GraduationPlan.GraduationPlan.Instance.GetStudentGraduationPlan(studentRec.StudentID) != null)
                    {
                        foreach (GraduationPlanSubject subject in GraduationPlan.GraduationPlan.Instance.GetStudentGraduationPlan(studentRec.StudentID).SemesterSubjects(gradeYear, form.Semester))
                        {
                            string key   = subject.SubjectName.Trim() + "^_^" + subject.Level;
                            bool   found = false;
                            if (existSubject.ContainsKey(key))
                            {
                                foreach (StudentAttendCourseRecord attend in existSubject[key].StudentAttendList)
                                {
                                    if (attend.StudentID == studentRec.StudentID)
                                    {
                                        found = true;
                                    }
                                }


                                if (!found)
                                {
                                    XmlElement attend = insertSCAttendHelper.AddElement("Attend");
                                    DSXmlHelper.AppendChild(attend, "<RefStudentID>" + studentRec.StudentID + "</RefStudentID>");
                                    DSXmlHelper.AppendChild(attend, "<RefCourseID>" + existSubject[key].CourseID + "</RefCourseID>");

                                    //insertSCAttendHelper.AddElement(".", attend);
                                    addAttend = true;
                                }
                            }
                        }
                    }
                }
                if (addAttend)
                {
                    SmartSchool.Feature.Course.AddCourse.AttendCourse(insertSCAttendHelper);
                }
                #endregion
                #endregion
                //回報進度
                bkw.ReportProgress((int)(processedClass * 100d / totleClass));
            }
        }
コード例 #9
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            Dictionary <string, List <CourseInfoExport> > courseInfoModels = new Dictionary <string, List <CourseInfoExport> >();
            List <string> selectedGraduationID = new List <string>();
            List <string> noDatas = new List <string>();

            #region 取得ID
            if (this.dataGridViewX1.SelectedRows.Count > 0) //檢查筆數
            {
                foreach (DataGridViewRow row in this.dataGridViewX1.SelectedRows)
                {
                    GraduationPlanInfo graduationPlanInfo = row.Tag as GraduationPlanInfo;
                    if (graduationPlanInfo.DicOldGraduationPlanInfos.Count > 0)
                    {
                        foreach (string oldSysID in graduationPlanInfo.DicOldGraduationPlanInfos.Keys)
                        {
                            selectedGraduationID.Add(oldSysID); //把舊系統ID 給他
                        }
                    }
                    else
                    {
                        noDatas.Add(graduationPlanInfo.GraduationName);
                    }
                }
            }
            else // 選擇筆數
            {
                foreach (DataGridViewCell cell in this.dataGridViewX1.SelectedCells)
                {
                    DataGridViewRow    row = dataGridViewX1.Rows[cell.RowIndex];
                    GraduationPlanInfo graduationPlanInfo = row.Tag as GraduationPlanInfo;
                    if (graduationPlanInfo.DicOldGraduationPlanInfos.Count > 0)
                    {
                        foreach (string graduationName in graduationPlanInfo.DicOldGraduationPlanInfos.Keys)
                        {
                            selectedGraduationID.Add(graduationName);
                        }
                    }
                    else
                    {
                        noDatas.Add(graduationPlanInfo.Name);
                    }
                }
            }

            if (noDatas.Count > 0)
            {
                MsgBox.Show($"{string.Join("\n", noDatas)} \n沒有對應舊課程規表");
                return;
            }
            #endregion

            #region 取得資料
            DataTable dt = DataService.GetOldGraduationInfosByID(selectedGraduationID); // 資料庫撈資料
            foreach (DataRow dr in dt.Rows)
            {
                CourseInfoExport courseInfoExport = new CourseInfoExport();
                courseInfoExport.ID      = "" + dr["ID"];
                courseInfoExport.課程規劃表名稱 = "" + dr["name"];
                courseInfoExport.領域名稱    = "" + dr["領域"];
                courseInfoExport.學期      = "" + dr["學期"];
                courseInfoExport.分項名稱    = "" + dr["分項"];
                courseInfoExport.年級      = "" + dr["年級"];
                courseInfoExport.科目名稱    = "" + dr["科目"];
                courseInfoExport.科目級別    = "" + dr["科目級別"];
                courseInfoExport.校訂部訂    = "" + dr["校部訂"];
                courseInfoExport.必選修     = "" + dr["必選修"];
                courseInfoExport.學分數     = "" + dr["學分數"];
                courseInfoExport.計學分     = "" + dr["不計學分"] == "True" ? "是" : "";
                courseInfoExport.需評分     = "" + dr["不需評分"] == "True" ? "是" : "";
                courseInfoExport.科目代碼    = "" + dr["課程代碼"];

                if (!courseInfoModels.ContainsKey(courseInfoExport.課程規劃表名稱))
                {
                    courseInfoModels.Add(courseInfoExport.課程規劃表名稱, new List <CourseInfoExport>());
                }
                courseInfoModels[courseInfoExport.課程規劃表名稱].Add(courseInfoExport);
            }
            #endregion

            // 裝進Excel
            foreach (string graduationName in courseInfoModels.Keys)
            {
                int      rowNum   = 1;
                Workbook template = new Workbook(new MemoryStream(Properties.Resources.匯出課程規劃表樣版));
                foreach (CourseInfoExport courseInfo in courseInfoModels[graduationName])
                {
                    int cols = 0;
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.課程規劃表名稱);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.領域名稱);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.分項名稱);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.年級);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.學期);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.科目名稱);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.科目級別);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.校訂部訂);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.必選修);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.學分數);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.計學分);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.需評分);
                    template.Worksheets[0].Cells[rowNum, cols++].PutValue(courseInfo.科目代碼);
                    rowNum++;
                }
                Report(template, graduationName); //產出 excel
            }
        }
コード例 #10
0
ファイル: EventHub.cs プロジェクト: ischoolinc/SHEvaluation
 public UpdateGraduationPlanEventArgs(GraduationPlanInfo oldInfo, GraduationPlanInfo newInfo)
 {
     _OldInfo = oldInfo;
     _NewInfo = newInfo;
 }
コード例 #11
0
        /// <summary>
        /// Node被點擊
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void advTree1_NodeClick(object sender, TreeNodeMouseEventArgs e)
        {
            if (_GraduationPlanEditor.IsDirty)
            {
                if (DialogResult.No == MsgBox.Show("變更尚未儲存,確定離開?", MessageBoxButtons.YesNo))
                {
                    return;
                }
            }


            if (!(e.Node.Tag is GraduationPlanInfo))
            {
                // 假如使用者點到母節點, 清掉選擇選項, 以免有問題
                _SelectItem = null;
                BtnEnabled(false);
                return;
            }


            if (_SelectItem != null)
            {
                _SelectItem.Checked = false;
            }
            Node item = e.Node;

            GraduationPlanInfo info = (GraduationPlanInfo)item.Tag;

            _SelectItem  = item;
            item.Checked = true;

            tabControl2.Visible       = true & (_SelectItem != null);
            tabControlPanel3.Visible  = tabControlPanel2.Visible = tabItem2.Visible = tabItem1.Visible = true;
            tabControl2.SelectedTab   = tabItem1;
            tabControl2.SelectedPanel = tabControlPanel2;

            labelX2.Text = labelX1.Text = GetNodeFullPath(item);
            _GraduationPlanEditor.SetSource(info.GraduationPlanElement);
            listViewEx1.SuspendLayout();
            listViewEx1.Items.Clear();
            listViewEx1.Groups.Clear();
            Dictionary <ClassRecord, int> classCount      = new Dictionary <ClassRecord, int>();
            List <StudentRecord>          noClassStudents = new List <StudentRecord>();

            foreach (StudentRecord stu in _AccessHelper.StudentHelper.GetAllStudent())
            {
                if (GraduationPlan.GraduationPlan.Instance.GetStudentGraduationPlan(stu.StudentID) == info)
                {
                    if (stu.RefClass != null)
                    {
                        if (!classCount.ContainsKey(stu.RefClass))
                        {
                            classCount.Add(stu.RefClass, 0);
                        }
                        classCount[stu.RefClass]++;
                    }
                    else
                    {
                        noClassStudents.Add(stu);
                    }
                }
            }
            foreach (ClassRecord var in classCount.Keys)
            {
                string groupKey;
                int    a;
                if (int.TryParse(var.GradeYear, out a))
                {
                    groupKey = var.GradeYear + " 年級";
                }
                else
                {
                    groupKey = var.GradeYear;
                }
                ListViewGroup group = listViewEx1.Groups[groupKey];
                if (group == null)
                {
                    group = listViewEx1.Groups.Add(groupKey, groupKey);
                }
                listViewEx1.Items.Add(new ListViewItem(var.ClassName + "(" + classCount[var] + ") ", 0, group));
            }
            if (noClassStudents.Count > 0)
            {
                ListViewGroup group = listViewEx1.Groups["未分班"];
                if (group == null)
                {
                    group = listViewEx1.Groups.Add("未分班", "未分班");
                }
                foreach (StudentRecord stu in noClassStudents)
                {
                    listViewEx1.Items.Add(new ListViewItem(stu.StudentName + "[" + stu.StudentNumber + "]  ", 1, group));
                }
            }
            listViewEx1.ResumeLayout();
            tabControl2.Visible = true;
            BtnEnabled(true);
        }