/// <summary>
        /// 載入多筆學生學期成績(依學年度學期篩選)(一般生)
        /// </summary>
        /// <param name="SchoolYear"></param>
        /// <param name="Semester"></param>
        /// <param name="StudentIDList"></param>
        public static void LoadSemesterScoreRecord(int SchoolYear, int Semester, List <string> ClassIDList, List <string> notRankStudentIDList)
        {
            _ClassStudCount.Clear();
            List <JHClassRecord> ClassRecList  = JHClass.SelectByIDs(ClassIDList);
            List <string>        StudentIDList = new List <string>();

            foreach (JHClassRecord ClassRec in ClassRecList)
            {
                foreach (JHStudentRecord studRec in ClassRec.Students)
                {
                    if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般 && !notRankStudentIDList.Contains(studRec.ID))//剔除不排名學生
                    {
                        StudentIDList.Add(studRec.ID);

                        if (_ClassStudCount.ContainsKey(studRec.Class.ID))
                        {
                            _ClassStudCount[studRec.Class.ID]++;
                        }
                        else
                        {
                            _ClassStudCount.Add(studRec.Class.ID, 1);
                        }
                    }
                }
            }

            // 取得多筆學生學年度學期成績
            _SemesterScoreRecordList = JHSemesterScore.SelectBySchoolYearAndSemester(StudentIDList, SchoolYear, Semester);
        }
Exemple #2
0
        private void txtClassName_TextChanged(object sender, EventArgs e)
        {
            bool pass = false, confuse = false;

            pictureBox1.Visible = false;
            txtSeatNo.Text      = "";
            if (txtClassName.Text != "")
            {
                foreach (JHClassRecord cr in JHClass.SelectAll())
                {
                    if (cr.Name == txtClassName.Text)
                    {
                        pictureBox1.Visible = true;
                        pass = true;
                    }
                    else if (cr.Name.StartsWith(txtClassName.Text))
                    {
                        confuse = true;
                    }
                }
                if (pass & confuse == false)
                {
                    txtSeatNo.Focus();
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 檢查每個班級是否有課程規劃表
        /// </summary>
        /// <returns></returns>
        private bool EachClassHasProgramPlan()
        {
            List <JHClassRecord> noProgramPlanClasses = new List <JHClassRecord>();

            foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
            {
                if (string.IsNullOrEmpty(cla.RefProgramPlanID))
                {
                    noProgramPlanClasses.Add(cla);
                }
            }

            if (noProgramPlanClasses.Count > 0)
            {
                ErrorViewer viewer = new ErrorViewer();
                viewer.SetColumns("班級", "錯誤訊息");
                foreach (var cla in noProgramPlanClasses)
                {
                    viewer.AddRow(cla.Name, "沒有設定課程規劃表。");
                }
                viewer.Show();
                return(false);
            }
            return(true);
        }
        public CreateCoursesDirectly()
        {
            List <JHClassRecord>  list = JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource);
            CreateClassCourseForm form = new CreateClassCourseForm(list);

            form.ShowDialog();
        }
Exemple #5
0
        public static List <RatingScope <ReportStudent> > ToGradeYearScopes(this IEnumerable <ReportStudent> students)
        {
            Dictionary <string, RatingScope <ReportStudent> > scopes = new Dictionary <string, RatingScope <ReportStudent> >();

            foreach (ReportStudent each in students)
            {
                string gradeYear = string.Empty;

                if (!string.IsNullOrEmpty(each.RefClassID))
                {
                    int?gy = JHClass.SelectByID(each.RefClassID).GradeYear;
                    if (gy.HasValue)
                    {
                        gradeYear = gy.Value.ToString();
                    }
                }

                if (!scopes.ContainsKey(gradeYear))
                {
                    scopes.Add(gradeYear, new RatingScope <ReportStudent>(gradeYear, "年排名"));
                }

                scopes[gradeYear].Add(each);
            }

            return(new List <RatingScope <ReportStudent> >(scopes.Values).SortName());
        }
        private void ChangeClassesProgramPlanID(string id)
        {
            _logSaver.ClearBatch();

            List <JHClassRecord> classList = new List <JHClassRecord>();

            foreach (var cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
            {
                cla.RefProgramPlanID = id;
                classList.Add(cla);

                string desc = string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    desc = string.Format("班級「{0}」不指定課程規劃", cla.Name);
                }
                else
                {
                    desc = string.Format("班級「{0}」指定課程規劃為:{1}", cla.Name, ProgramPlan.Instance.Items[id].Name);
                }
                _logSaver.AddBatch("成績系統.課程規劃", "班級指定課程規劃", desc);
            }
            if (classList.Count > 0)
            {
                JHClass.Update(classList);
                _logSaver.LogBatch();
            }
        }
Exemple #7
0
        public MainForm(List <string> classes)
        {
            InitializeComponent();

            this.MinimumSize = this.Size;
            this.MaximumSize = this.Size;

            cbExam.DisplayMember = "Name";
            cbScore.Items.Add("定期");
            cbScore.Items.Add("平時");
            cbScore.Items.Add("定期加平時平均");
            cbScore.SelectedIndex = 0;

            cbExam.Items.Add("");
            foreach (JHExamRecord exam in JHExam.SelectAll())
            {
                cbExam.Items.Add(exam);
            }
            cbExam.SelectedIndex = 0;

            cbExam.SelectedIndexChanged += new EventHandler(cbExam_SelectedIndexChanged);

            LoadingSubject.Visible = false;
            LoadingDomain.Visible  = false;

            //準備相關學生、班級資料。
            ReportStudent.SetClassMapping(JHClass.SelectAll());
            SelectedClasses = JHClass.SelectByIDs(classes); //要列印成績單的班級清單。
            AllStudents     = JHStudent.SelectAll().ToReportStudent();
        }
        protected override void OnSaveButtonClick(EventArgs e)
        {
            if (cboProgramPlan.SelectedItem != null)
            {
                string id = string.Empty;

                if (cboProgramPlan.SelectedItem is JHProgramPlanRecord)
                {
                    JHProgramPlanRecord record = cboProgramPlan.SelectedItem as JHProgramPlanRecord;
                    id = record.ID;
                }

                if (id != _programPlanID)
                {
                    JHClassRecord cla = JHClass.SelectByID(PrimaryKey);
                    cla.RefProgramPlanID = id;
                    JHClass.Update(cla);
                    //ClassRecord classRecord = Class.Instance.Items[PrimaryKey];
                    //ClassRecordEditor editor = classRecord.GetEditor();
                    //editor.RefProgramPlanID = id;
                    //editor.Save();
                }
            }
            base.OnSaveButtonClick(e);
        }
Exemple #9
0
        private void ChangeClassesScoreCalcRuleID(string id)
        {
            _logSaver.ClearBatch();
            List <ClassRecordEditor> classRecordEditors = new List <ClassRecordEditor>();

            foreach (var cla in Class.Instance.SelectedList)
            {
                ClassRecordEditor editor = cla.GetEditor();
                editor.RefScoreCalcRuleID = id;
                classRecordEditors.Add(editor);

                string desc = string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    desc = string.Format("班級「{0}」不指定計算規則", cla.Name);
                }
                else
                {
                    desc = string.Format("班級「{0}」指定計算規則為:{1}", cla.Name, ScoreCalcRule.Instance.Items[id].Name);
                }
                _logSaver.AddBatch("成績系統.計算規則", "班級指定計算規則", desc);
            }
            if (classRecordEditors.Count > 0)
            {
                classRecordEditors.SaveAllEditors();
                _logSaver.LogBatch();

                // 同步班級JHDAL
                List <string> classIDs = (from data in Class.Instance.SelectedList select data.ID).ToList();
                JHClass.RemoveByIDs(classIDs);
                JHClass.SelectByIDs(classIDs);
            }
        }
Exemple #10
0
        private void txtSeatNo_TextChanged(object sender, EventArgs e)
        {
            bool pass = false;

            pictureBox2.Visible = false;
            if (txtSeatNo.Text != "")
            {
                foreach (JHClassRecord cr in JHClass.SelectAll())
                {
                    if (cr.Name == txtClassName.Text)
                    {
                        foreach (JHStudentRecord studRec in JHStudent.SelectAll())
                        {
                            if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般 || studRec.Status == K12.Data.StudentRecord.StudentStatus.輟學)
                            {
                                if (studRec.Class != null && studRec.SeatNo.HasValue)
                                {
                                    if (studRec.Class.Name == txtClassName.Text && studRec.SeatNo.ToString() == txtSeatNo.Text)
                                    {
                                        pass = true;
                                    }
                                }
                            }
                        }
                    }
                }
                if (pass)
                {
                    pictureBox2.Visible = true;
                }
            }
        }
Exemple #11
0
 private void txtSeatNo_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter && txtSeatNo.Text != "")
     {
         foreach (JHClassRecord cr in JHClass.SelectAll())
         {
             if (cr.Name == txtClassName.Text)
             {
                 foreach (JHStudentRecord studRec in JHStudent.SelectAll())
                 {
                     // 只加入一般或輟學
                     if (studRec.Status == K12.Data.StudentRecord.StudentStatus.一般 || studRec.Status == K12.Data.StudentRecord.StudentStatus.輟學)
                     {
                         if (studRec.Class != null && studRec.SeatNo.HasValue)
                         {
                             if (studRec.SeatNo.Value.ToString() == txtSeatNo.Text && studRec.Class.Name == txtClassName.Text)
                             {
                                 if (!K12.Presentation.NLDPanels.Student.TempSource.Contains(studRec.ID))
                                 {
                                     List <string> ids = new List <string>();
                                     ids.Add(studRec.ID);
                                     K12.Presentation.NLDPanels.Student.AddToTemp(ids);
                                 }
                                 txtClassName.Focus();
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Exemple #12
0
        protected override void PrepareDataBackground()
        {
            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSemesterScoreRecord semsRecord in SemesterScores.Values)
            {
                RatingStudent student;

                if (!dicstuds.TryGetValue(semsRecord.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores = student.Scores[ThisToken];

                foreach (K12.Data.DomainScore domainRecord in semsRecord.Domains.Values)
                {
                    if (!domainRecord.Score.HasValue)
                    {
                        continue;                               //沒有成績就不處理。
                    }
                    string domain = domainRecord.Domain.Trim();

                    if (!SelectedDomains.Contains(domain))
                    {
                        continue; //不在處理的科目清單中。
                    }
                    if (!NameMapping.ContainsKey(domain))
                    {
                        throw new ArgumentException(string.Format("領域名稱「{0}」在此畫面沒有定議。", domain));
                    }

                    if (scores.Contains(domain))
                    {
                        throw new ArgumentException(string.Format("學生「{0}」在同一學期有「{1}」領域一次以上。", student.Name, domain));
                    }

                    scores.Add(domain, domainRecord.Score.Value);
                }

                if (semsRecord.LearnDomainScore.HasValue)
                {
                    scores.Add("學習領域", semsRecord.LearnDomainScore.Value);
                }

                if (semsRecord.CourseLearnScore.HasValue)
                {
                    scores.Add("課程學習", semsRecord.CourseLearnScore.Value);
                }
            }
        }
Exemple #13
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            Utility.MorItemDict = Utility.GetDLBehaviorConfigNameDict();
            // 回寫畫面預設值與使用全域值
            Global.TransferName   = txtTransName.Text;
            Global.RegManagerName = txtRegName.Text;
            K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["學籍表_相關資料"];
            cd["TransName"] = txtTransName.Text;
            cd["RegName"]   = txtRegName.Text;
            cd.Save();


            Report report = new Report();
            List <JHStudentRecord> list      = new List <JHStudentRecord>();
            List <JHStudentRecord> studList  = new List <JHStudentRecord>();
            List <JHStudentRecord> studListN = new List <JHStudentRecord>();

            if (_EnterType == EnterType.Student)
            {
                list = JHSchool.Data.JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource);
            }
            else
            {
                foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
                {
                    studList.Clear();
                    studListN.Clear();
                    // 取得一般生
                    foreach (JHStudentRecord studRec in cla.Students.Where(x => x.Status == K12.Data.StudentRecord.StudentStatus.一般))
                    {
                        // 如果有座號依座號排序
                        if (studRec.SeatNo.HasValue)
                        {
                            studList.Add(studRec);
                        }
                        else  // 沒有座號依學號
                        {
                            studListN.Add(studRec);
                        }
                    }
                    // sort
                    if (studList.Count > 0)
                    {
                        list.AddRange(studList.OrderBy(x => x.SeatNo.Value));
                    }
                    if (studListN.Count > 0)
                    {
                        list.AddRange(studListN.OrderBy(x => x.StudentNumber));
                    }
                }
            }

            list.Sort(SortStudentByClassSeatNo);
            report.SetStudents(list);
            report.GenerateReport();

            this.DialogResult = DialogResult.OK;
        }
Exemple #14
0
        public MainForm(List <string> classes)
        {
            InitializeComponent();

            //準備相關學生、班級資料。
            ReportStudent.SetClassMapping(JHClass.SelectAll());
            SelectedClasses = JHClass.SelectByIDs(classes); //要列印成績單的班級清單。
            AllStudents     = JHStudent.SelectAll().ToReportStudent();
        }
Exemple #15
0
        private void PreLoader_DoWork(object sender, DoWorkEventArgs e)
        {
            Students = new List <JHStudentRecord>();
            foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
            {
                Students.AddRange(cla.Students);
            }
            Students = Students.GetInSchoolStudents();

            e.Result = JHExam.SelectAll();
        }
Exemple #16
0
 void _BGWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     _ClassRecList.Clear();
     foreach (JHClassRecord classRec in JHClass.SelectAll())
     {
         if (classRec.RefTeacherID == PrimaryKey)
         {
             _ClassRecList.Add(classRec);
         }
     }
 }
        private void button1_Click(object sender, EventArgs e)
        {
            StudentScore.SetClassMapping();

            JHClassRecord cls = JHClass.SelectByID("24");//正興 301 班。

            txtMsg.Text = string.Empty;
            txtMsg.AppendText("計算班級:" + cls.Name + "\n");

            ThreadPool.QueueUserWorkItem(new WaitCallback(ReadAttendScore), cls);
        }
Exemple #18
0
 public static void LoadtmpClassRuleIDDict()
 {
     tmpClassRuleIDDict.Clear();
     foreach (JHClassRecord rec in JHClass.SelectAll())
     {
         if (rec.RefScoreCalcRuleID != null)
         {
             tmpClassRuleIDDict.Add(rec.ID, rec.RefScoreCalcRuleID);
         }
     }
 }
Exemple #19
0
        /// <summary>
        /// 設定班級對照表。
        /// </summary>
        public static void SetClassMapping()
        {
            JHClass.RemoveAll();
            IEnumerable <JHClassRecord> classes = JHClass.SelectAll();

            Classes = new Dictionary <string, JHClassRecord>();
            foreach (JHClassRecord each in classes)
            {
                Classes.Add(each.ID, each);
            }
        }
Exemple #20
0
        protected override void PrepareDataBackground()
        {
            List <JHSCETakeRecord> scetakes = JHSCETake.SelectByCourseAndExam(Courses.Values.ToKeys(), ExamId);

            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSCETakeRecord take in scetakes) //特別注意 take.Score 是 Extensions 裡面的 Score 不是實體欄位的 Score。
            {
                if (!take.Score.HasValue)
                {
                    continue;                       //沒有成績就不處理。
                }
                JHSCAttendRecord attend;
                JHCourseRecord   course;
                RatingStudent    student;

                if (!SCAttends.TryGetValue(take.RefSCAttendID, out attend))
                {
                    continue;  //找不到該修課記錄。
                }
                if (!Courses.TryGetValue(take.RefCourseID, out course))
                {
                    continue;  //找不到該課程。
                }
                if (!dicstuds.TryGetValue(attend.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores  = student.Scores[ThisToken];
                string          subject = course.Subject;

                if (!SelectedSubjects.Contains(subject))
                {
                    continue; //不在處理的科目清單中。
                }
                if (scores.Contains(subject))
                {
                    throw new ArgumentException(string.Format("學生「{0}」在同一學期修習「{1}」科目一次以上。", student.Name, subject));
                }

                scores.Add(subject, take.Score.Value);
            }
        }
Exemple #21
0
 private void txtClassName_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData == Keys.Enter && txtClassName.Text != "")
     {
         foreach (JHClassRecord cr in JHClass.SelectAll())
         {
             if (cr.Name == txtClassName.Text)
             {
                 txtSeatNo.Focus();
             }
         }
     }
 }
Exemple #22
0
        public MainForm(EnterType enterType)
        {
            InitializeComponent();
            this.MaximumSize = this.Size;
            this.MinimumSize = this.Size;
            this.Text        = Global.ReportName;
            _EnterType       = enterType;
            Options          = new Options();

            // 學生
            if (_EnterType == EnterType.Student)
            {
                Options.Students = JHSchool.Data.JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource);
            }
            else
            {
                // 班級
                List <JHStudentRecord> list      = new List <JHStudentRecord>();
                List <JHStudentRecord> studList  = new List <JHStudentRecord>();
                List <JHStudentRecord> studListN = new List <JHStudentRecord>();
                foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
                {
                    studList.Clear();
                    studListN.Clear();
                    // 過濾一般生
                    foreach (JHStudentRecord studRec in cla.Students.Where(x => x.Status == K12.Data.StudentRecord.StudentStatus.一般))
                    {
                        // 將是否有座號分開
                        if (studRec.SeatNo.HasValue)
                        {
                            studList.Add(studRec);
                        }
                        else
                        {
                            studListN.Add(studRec);
                        }
                    }
                    // 有座號依座號排序
                    if (studList.Count > 0)
                    {
                        list.AddRange(studList.OrderBy(x => x.SeatNo.Value));
                    }
                    // 沒有座號依學號排序
                    if (studListN.Count > 0)
                    {
                        list.AddRange(studListN.OrderBy(x => x.StudentNumber));
                    }
                }
                Options.Students = list;
            }
        }
Exemple #23
0
        private void LoadGradeYearToForm()
        {
            cboGradeYear.Items.Clear();
            List <string> GradeYearList = new List <string>();

            foreach (JHClassRecord classRec in JHClass.SelectAll())
            {
                if (classRec.GradeYear.HasValue)
                {
                    if (!GradeYearList.Contains(classRec.GradeYear.Value + ""))
                    {
                        GradeYearList.Add(classRec.GradeYear.Value + "");
                    }
                }
            }
            GradeYearList.Sort(GradeYearSort);
            cboGradeYear.Items.AddRange(GradeYearList.ToArray());
        }
Exemple #24
0
        protected override void PrepareDataBackground()
        {
            JHClass.RemoveAll();
            RatingStudent.SetClassMapping(JHClass.SelectAll()); //快取班級對照資訊。
            Dictionary <string, RatingStudent> dicstuds = Students.ToDictionary();

            //將學生的成績清除,並新增一個 Token 用來放成績。
            foreach (RatingStudent each in Students)
            {
                each.Clear();
                each.Scores.Add(ThisToken, new ScoreCollection());
            }

            foreach (JHSemesterScoreRecord semsRecord in SemesterScores.Values)
            {
                RatingStudent student;

                if (!dicstuds.TryGetValue(semsRecord.RefStudentID, out student))
                {
                    continue; //找不到該學生。
                }
                ScoreCollection scores = student.Scores[ThisToken];

                foreach (K12.Data.SubjectScore subjRecord in semsRecord.Subjects.Values)
                {
                    if (!subjRecord.Score.HasValue)
                    {
                        continue;                             //沒有成績就不處理。
                    }
                    string subject = subjRecord.Subject;

                    if (!SelectedSubjects.Contains(subject))
                    {
                        continue; //不在處理的科目清單中。
                    }
                    if (scores.Contains(subject))
                    {
                        throw new ArgumentException(string.Format("學生「{0}」在同一學期修習「{1}」科目一次以上。", student.Name, subject));
                    }

                    scores.Add(subject, subjRecord.Score.Value);
                }
            }
        }
        private void DomainScoreCalculateByGradeyear_Load(object sender, EventArgs e)
        {
            Util.SetSemesterDefaultItems(intSchoolYear, intSemester);

            StudentScore.SetClassMapping(); //裡面會對 Class 做 SelectAll 動作。

            int min = 9, max = 1;

            foreach (JHClassRecord each in JHClass.SelectAll())
            {
                if (!each.GradeYear.HasValue)
                {
                    continue;
                }

                min = Math.Min(each.GradeYear.Value, min);
                max = Math.Max(each.GradeYear.Value, max);
            }
            intGradeyear.MinValue = min;
            intGradeyear.MaxValue = max;
            intGradeyear.Value    = min;
        }
        protected override void OnPrimaryKeyChanged(EventArgs e)
        {
            SaveButtonVisible = CancelButtonVisible = false;
            JHClassRecord classRecord = JHClass.SelectByID(PrimaryKey);

            if (classRecord != null)
            {
                JHProgramPlanRecord programPlanRecord = GetProgramPlan(classRecord);
                if (programPlanRecord != null)
                {
                    _programPlanID = programPlanRecord.ID;
                    SetComboBoxSelection(programPlanRecord);
                }
                else
                {
                    _programPlanID = string.Empty;
                    SetComboBoxSelection(null);
                }
            }

            base.OnPrimaryKeyChanged(e);
        }
Exemple #27
0
        public static List <RatingScope <ReportStudent> > ToClassScopes(this IEnumerable <ReportStudent> students)
        {
            Dictionary <string, RatingScope <ReportStudent> > scopes = new Dictionary <string, RatingScope <ReportStudent> >();

            foreach (ReportStudent each in students)
            {
                string className = string.Empty;

                if (!string.IsNullOrEmpty(each.RefClassID))
                {
                    className = JHClass.SelectByID(each.RefClassID).Name;
                }

                if (!scopes.ContainsKey(className))
                {
                    scopes.Add(className, new RatingScope <ReportStudent>(className, "班排名"));
                }

                scopes[className].Add(each);
            }

            return(new List <RatingScope <ReportStudent> >(scopes.Values).SortName());
        }
Exemple #28
0
 internal List <JHStudentRecord> GetStudents()
 {
     if (_enterType == EnterType.Student)
     {
         return(JHStudent.SelectByIDs(K12.Presentation.NLDPanels.Student.SelectedSource));
     }
     else
     {
         List <JHStudentRecord> list = new List <JHStudentRecord>();
         // 取得班級學生(一般和輟學)
         foreach (JHClassRecord cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
         {
             foreach (JHStudentRecord stud in cla.Students)
             {
                 if (stud.Status == StudentRecord.StudentStatus.一般 || stud.Status == StudentRecord.StudentStatus.輟學)
                 {
                     list.Add(stud);
                 }
             }
         }
         return(list);
     }
 }
Exemple #29
0
        void _BGWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            _ClassRecord     = JHClass.SelectByID(PrimaryKey);
            _AllClassRecList = JHClass.SelectAll();

            // 教師名稱索引
            _TeacherNameDic.Clear();
            foreach (JHTeacherRecord TRec in JHTeacher.SelectAll())
            {
                if (TRec.Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                {
                    continue;
                }

                if (string.IsNullOrEmpty(TRec.Nickname))
                {
                    _TeacherNameDic.Add(TRec.ID, TRec.Name);
                }
                else
                {
                    _TeacherNameDic.Add(TRec.ID, TRec.Name + "(" + TRec.Nickname + ")");
                }
            }
        }
Exemple #30
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            if (!IsValid())
            {
                FISCA.Presentation.Controls.MsgBox.Show("輸入資料未通過驗證,請修正後再行儲存");
                return;
            }


            _ClassRecord.NamingRule = _NamingRule;

            // 年級
            int GrYear;

            if (int.TryParse(cboGradeYear.Text, out GrYear))
            {
                _ClassRecord.GradeYear = GrYear;
            }
            else
            {
                _ClassRecord.GradeYear = null;
            }

            // 班名轉型
            if (ValidateNamingRule(_NamingRule))
            {
                _ClassRecord.Name = ParseClassName(_NamingRule, GrYear);
            }
            else
            {
                if (ValidClassName(_ClassRecord.ID, txtClassName.Text))
                {
                    _ClassRecord.Name = txtClassName.Text;
                }
                else
                {
                    return;
                }
            }

            _ClassRecord.RefTeacherID = "";
            // 教師
            foreach (KeyValuePair <string, string> val in _TeacherNameDic)
            {
                if (val.Value == cboTeacher.Text)
                {
                    _ClassRecord.RefTeacherID = val.Key;
                }
            }
            _ClassRecord.DisplayOrder = txtSortOrder.Text;

            SaveButtonVisible   = false;
            CancelButtonVisible = false;
            // Log
            prlp.SetAfterSaveText("班級名稱", txtClassName.Text);
            prlp.SetAfterSaveText("班級命名規則", _ClassRecord.NamingRule);
            prlp.SetAfterSaveText("年級", cboGradeYear.Text);
            prlp.SetAfterSaveText("班導師", cboTeacher.Text);
            prlp.SetAfterSaveText("排列序號", txtSortOrder.Text);
            prlp.SetActionBy("學籍", "班級基本資料");
            prlp.SetAction("修改班級基本資料");
            prlp.SetDescTitle("班級名稱:" + _ClassRecord.Name + ",");
            prlp.SaveLog("", "", "class", PrimaryKey);
            JHClass.Update(_ClassRecord);
            Class.Instance.SyncDataBackground(PrimaryKey);
        }