// 更改學生狀態
        private void UpdateStudentStatus(List <ClassItem> ClassItems, K12.Data.StudentRecord.StudentStatus oldStatus, K12.Data.StudentRecord.StudentStatus newStatus)
        {
            Dictionary <string, List <StudentItem> > StudentItems = new Dictionary <string, List <StudentItem> >();
            List <StudentItem> GraduateStudentItems = new List <StudentItem>();


            StudentItems = UpgradeClassDAL.getStudentItems(ClassItems, oldStatus);
            foreach (KeyValuePair <string, List <StudentItem> > si in StudentItems)
            {
                foreach (StudentItem sii in si.Value)
                {
                    sii.Status = newStatus;
                    GraduateStudentItems.Add(sii);
                }
            }
            UpgradeClassDAL.setStudentStatus(GraduateStudentItems);
        }
        private void wizardPage3_AfterPageDisplayed(object sender, WizardPageChangeEventArgs e)
        {
            this.progressBarX1.Value = 0;

            // 讀取畫面上選取學生狀態

            switch (cboStudStatus.Text)
            {
                case "一般":
                    _StudStatus = K12.Data.StudentRecord.StudentStatus.一般;
                    break;

                case "休學":
                    _StudStatus = K12.Data.StudentRecord.StudentStatus.休學;
                    break;
                case "輟學":
                    _StudStatus = K12.Data.StudentRecord.StudentStatus.輟學;
                    break;
                case "畢業或離校":
                    _StudStatus = K12.Data.StudentRecord.StudentStatus.畢業或離校;
                    break;
                case "刪除":
                    _StudStatus = K12.Data.StudentRecord.StudentStatus.刪除;
                    break;
            }

            lblWarningCount.Text = lblErrCount.Text = "0";
            this.wizardPage3.FinishButtonEnabled = eWizardButtonState.False;
            linkLabel1.Visible = false;
            labelX2.Text = "資料驗證中";
            linkLabel3.Tag = null;
            linkLabel3.Visible = false;
            Application.DoEvents();

            _BKWValidate = new BackgroundWorker();
            _BKWValidate.WorkerReportsProgress = true;
            _BKWValidate.WorkerSupportsCancellation = true;
            _BKWValidate.DoWork += new DoWorkEventHandler(_BKWValidate_DoWork);
            _BKWValidate.ProgressChanged += new ProgressChangedEventHandler(_BKWValidate_ProgressChanged);
            _BKWValidate.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_BKWValidate_RunWorkerCompleted);

            List<string> fields = new List<string>();
            string fileName = txtFile.Text;
            fields.AddRange(_RequiredFields);
            foreach (ListViewItem item in listView1.Items)
            {
                if (item.Checked)
                    fields.Add(item.Text);
            }
            _ErrorRows = new Dictionary<RowData, Dictionary<string, string>>();
            _WarningRows = new Dictionary<RowData, Dictionary<string, string>>();
            Workbook wb = new Workbook();
            wb.Copy(_WorkBook);
            _BKWValidate.RunWorkerAsync(new object[] { fields, _ImportFields, wb });
        }
        /// <summary>
        /// 取得班級學生
        /// </summary>
        /// <param name="ClassIDs"></param>
        /// <param name="Status"></param>
        /// <returns></returns>
        public static Dictionary <string, List <StudentItem> > getStudentItems(List <ClassItem> ClassItems, K12.Data.StudentRecord.StudentStatus Status)
        {
            Dictionary <string, List <StudentRecord> > classStud = new Dictionary <string, List <StudentRecord> >();

            foreach (StudentRecord studRec in Student.SelectAll())
            {
                if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般)
                {
                    if (classStud.ContainsKey(studRec.RefClassID))
                    {
                        classStud[studRec.RefClassID].Add(studRec);
                    }
                    else
                    {
                        List <StudentRecord> StudRecList = new List <StudentRecord>();
                        StudRecList.Add(studRec);
                        classStud.Add(studRec.RefClassID, StudRecList);
                    }
                }
            }

            Dictionary <string, List <StudentItem> > StudentItems = new Dictionary <string, List <StudentItem> >();

            foreach (ClassItem ci in ClassItems)
            {
                List <StudentItem> studItems = new List <StudentItem>();

                if (classStud.ContainsKey(ci.ClassID))
                {
                    foreach (StudentRecord studRec in classStud[ci.ClassID])
                    {
                        StudentItem si = new StudentItem();
                        si.StudentID = studRec.ID;
                        si.Status    = studRec.Status;
                        si.ClassName = studRec.Class.Name;
                        studItems.Add(si);
                        si = null;
                    }
                    StudentItems.Add(ci.ClassID, studItems);
                }
            }
            return(StudentItems);
        }