Пример #1
0
        int SortTraDic(ClassClubTraObj a1, ClassClubTraObj b1)
        {
            int x = a1.studentRecord.SeatNo.HasValue ? a1.studentRecord.SeatNo.Value : 0;
            int y = b1.studentRecord.SeatNo.HasValue ? b1.studentRecord.SeatNo.Value : 0;

            return(x.CompareTo(y));
        }
Пример #2
0
        /// <summary>
        /// 取得資料模型
        /// </summary>
        private Dictionary <string, List <ClassClubTraObj> > GetTraDic(成績取得器 Point)
        {
            成績取得器 _GetPoint = Point;
            Dictionary <string, List <ClassClubTraObj> > dic = new Dictionary <string, List <ClassClubTraObj> >();

            foreach (ClassRecord each in ClassDic.Values)
            {
                if (!dic.ContainsKey(each.ID))
                {
                    dic.Add(each.ID, new List <ClassClubTraObj>());
                }
            }

            //建立資料內容
            foreach (StudentRecord student in _GetPoint._StudentDic.Values)
            {
                if (string.IsNullOrEmpty(student.RefClassID))
                {
                    continue;
                }

                if (!ClassDic.ContainsKey(student.RefClassID))
                {
                    continue;
                }

                ClassRecord cr = ClassDic[student.RefClassID];

                ClassClubTraObj obj = new ClassClubTraObj();
                obj.studentRecord = student; //學生
                obj.classRecord   = cr;      //班級

                //如果有社團記錄
                if (_GetPoint._SCJoinDic.ContainsKey(student.ID))
                {
                    List <SCJoin> scjList = _GetPoint._SCJoinDic[student.ID];
                    foreach (SCJoin each in scjList)
                    {
                        if (_GetPoint._ClubDic.ContainsKey(each.RefClubID))
                        {
                            CLUBRecord cc = _GetPoint._ClubDic[each.RefClubID];
                            if (cc.SchoolYear == _SchoolYear && cc.Semester == _Semester && cc.UID == each.RefClubID)
                            {
                                obj.club   = _GetPoint._ClubDic[each.RefClubID];
                                obj.SCJoin = each; //社團記錄

                                if (_GetPoint._RSRDic.ContainsKey(each.UID))
                                {
                                    obj.RSR = _GetPoint._RSRDic[each.UID]; //社團記錄
                                }
                            }
                        }
                    }
                }

                if (obj.RSR == null)
                {
                    if (_GetPoint._RSRDic_s.ContainsKey(obj.studentRecord.ID))
                    {
                        foreach (ResultScoreRecord each in _GetPoint._RSRDic_s[obj.studentRecord.ID])
                        {
                            if (each.SchoolYear == _SchoolYear && each.Semester == _Semester)
                            {
                                obj.RSR = each;
                            }
                        }
                    }
                }


                if (dic.ContainsKey(cr.ID))
                {
                    //只列印不及格學生
                    if (_PrintLost)
                    {
                        if (obj.RSR != null) //有結算記錄(不管是否有社團記錄)
                        {
                            if (obj.RSR.ResultScore.HasValue)
                            {
                                if (obj.RSR.ResultScore.Value >= 60) //當成績低於60分才加入清單內
                                {
                                    continue;
                                }
                            }
                        }

                        dic[cr.ID].Add(obj);
                    }
                    else
                    {
                        //列印所有學生
                        dic[cr.ID].Add(obj);
                    }
                }
            }

            return(dic);
        }