private void ProduceData(List <SHStudentRecord> pStudents)
        {
            List <MeritRecord> meritRecords = Merit.SelectByStudentIDs(pStudents.Select(x => x.ID));

            foreach (MeritRecord mr in meritRecords)
            {
                if (!_PersonalMeritRecordInfo.ContainsKey(mr.RefStudentID))
                {
                    _PersonalMeritRecordInfo.Add(mr.RefStudentID, new List <MeritRecord>());
                }

                _PersonalMeritRecordInfo[mr.RefStudentID].Add(mr);
            }

            List <DemeritRecord> demeritRecords = Demerit.SelectByStudentIDs(pStudents.Select(x => x.ID));

            foreach (DemeritRecord dr in demeritRecords)
            {
                if (!_PersonalDemeritRecordInfo.ContainsKey(dr.RefStudentID))
                {
                    _PersonalDemeritRecordInfo.Add(dr.RefStudentID, new List <DemeritRecord>());
                }

                _PersonalDemeritRecordInfo[dr.RefStudentID].Add(dr);
            }
        }
Beispiel #2
0
        private void GetMeDemrit(Dictionary <string, StudRecord> studDic)
        {
            //取得學生所有的獎懲紀錄
            List <MeritRecord> meriteList = Merit.SelectByStudentIDs(studDic.Keys);

            foreach (MeritRecord each in meriteList)
            {
                if (studDic.ContainsKey(each.RefStudentID))
                {
                    studDic[each.RefStudentID].MeritList.Add(each);
                }
            }

            List <DemeritRecord> demeriteList = Demerit.SelectByStudentIDs(studDic.Keys);

            foreach (DemeritRecord each in demeriteList)
            {
                if (studDic.ContainsKey(each.RefStudentID))
                {
                    studDic[each.RefStudentID].DemeritList.Add(each);

                    //懲戒資料內包含留查資料
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// 取得所有資料
        /// </summary>
        private void SetStudentBoxs()
        {
            List <string> StudentIDList = K12.Presentation.NLDPanels.Student.SelectedSource;

            ListStudent = Student.SelectByIDs(StudentIDList); //取得學生
            ListStudent.Sort(new Comparison <StudentRecord>(ParseStudent));

            ListPhone  = Phone.SelectByStudentIDs(StudentIDList);                      //取得電話資料
            ListParent = Parent.SelectByStudentIDs(StudentIDList);                     //取得監護人資料

            ListAddress           = Address.SelectByStudentIDs(StudentIDList);         //取得地址資料
            ListMerit             = Merit.SelectByStudentIDs(StudentIDList);           //取得獎勵資料(一對多)
            ListDeMerit           = Demerit.SelectByStudentIDs(StudentIDList);         //取得懲戒資料(一對多)
            ListMoralScore        = SHMoralScore.SelectByStudentIDs(StudentIDList);    //取得日常生活表現資料(一對多)
            ListUpdataRecord      = UpdateRecord.SelectByStudentIDs(StudentIDList);    //取得異動資料(一對多)
            ListJHSemesterHistory = SemesterHistory.SelectByStudentIDs(StudentIDList); //取得學生學期歷程
            //ListAssnCode = _accessHelper.Select<AssnCode>(); //取得所有社團記錄

            ListAutoSummary = AutoSummary.Select(StudentIDList, null);
            ListAutoSummary.Sort(SortSchoolYearSemester);
        }
        public Dictionary <string, int> GetMerit(List <一名學生> StudentList)
        {
            //取得學生ID
            StudentDic = GetStudentIDList(StudentList);

            //取得獎懲資料
            List <MeritRecord>   MeritList   = Merit.SelectByStudentIDs(StudentDic.Keys);
            List <DemeritRecord> DemeritList = Demerit.SelectByStudentIDs(StudentDic.Keys);

            //取得功過相抵換算值
            _Reduce = K12.Data.MeritDemeritReduce.Select();


            foreach (MeritRecord mr in MeritList)
            {
                if (StudentDic.ContainsKey(mr.RefStudentID))
                {
                    int studINT = 0;

                    int a = mr.MeritA.HasValue ? mr.MeritA.Value : 0;
                    int b = mr.MeritB.HasValue ? mr.MeritB.Value : 0;
                    int c = mr.MeritC.HasValue ? mr.MeritC.Value : 0;

                    if (_Reduce.MeritAToMeritB.HasValue)
                    {
                        int aa = a * _Reduce.MeritAToMeritB.Value;
                        studINT += aa * _Reduce.MeritBToMeritC.Value;
                    }

                    if (_Reduce.MeritBToMeritC.HasValue)
                    {
                        studINT += b * _Reduce.MeritBToMeritC.Value;
                    }

                    studINT += c;

                    StudentDic[mr.RefStudentID] += studINT;
                }
            }

            foreach (DemeritRecord mr in DemeritList)
            {
                if (mr.Cleared == "是") //銷過資料則離開
                {
                    continue;
                }

                if (mr.MeritFlag == "2") //留查資料則離開
                {
                    continue;
                }

                if (StudentDic.ContainsKey(mr.RefStudentID))
                {
                    int studINT = 0;

                    int a = mr.DemeritA.HasValue ? mr.DemeritA.Value : 0;
                    int b = mr.DemeritB.HasValue ? mr.DemeritB.Value : 0;
                    int c = mr.DemeritC.HasValue ? mr.DemeritC.Value : 0;

                    if (_Reduce.MeritAToMeritB.HasValue)
                    {
                        int aa = a * _Reduce.MeritAToMeritB.Value;
                        studINT += aa * _Reduce.MeritBToMeritC.Value;
                    }

                    if (_Reduce.MeritBToMeritC.HasValue)
                    {
                        studINT += b * _Reduce.MeritBToMeritC.Value;
                    }

                    studINT += c;

                    StudentDic[mr.RefStudentID] -= studINT;
                }
            }

            return(StudentDic);
        }