Esempio n. 1
0
        public int SortTraDic(ClubTraObj a1, ClubTraObj b1)
        {
            string StudentA = "";

            if (a1.student.Class != null)
            {
                StudentA += a1.student.Class.DisplayOrder.PadLeft(10, '0');
                StudentA += a1.student.Class.Name.PadLeft(10, '0');
            }
            else
            {
                StudentA += "00000000000000000000";
            }

            StudentA += a1.student.SeatNo.HasValue ? a1.student.SeatNo.Value.ToString().PadLeft(10, '0') : "0000000000";
            StudentA += a1.student.Name.PadLeft(10, '0');

            string StudentB = "";

            if (b1.student.Class != null)
            {
                StudentB += b1.student.Class.DisplayOrder.PadLeft(10, '0');
                StudentB += b1.student.Class.Name.PadLeft(10, '0');
            }
            else
            {
                StudentB += "00000000000000000000";
            }
            StudentB += b1.student.SeatNo.HasValue ? b1.student.SeatNo.Value.ToString().PadLeft(10, '0') : "0000000000";
            StudentB += b1.student.Name.PadLeft(10, '0');

            return(StudentA.CompareTo(StudentB));
        }
Esempio n. 2
0
        public ClubTraMag()
        {
            //取得社團
            #region 資料取得

            List <string>     TeacherList = new List <string>();
            List <CLUBRecord> CLUBList    = tool._A.Select <CLUBRecord>(ClubAdmin.Instance.SelectedSource);
            foreach (CLUBRecord cr in CLUBList)
            {
                if (!TraDic.ContainsKey(cr.UID))
                {
                    TraDic.Add(cr.UID, new List <ClubTraObj>());
                }

                if (!CLUBDic.ContainsKey(cr.UID))
                {
                    CLUBDic.Add(cr.UID, cr);
                }

                #region 收集老師資訊

                if (!string.IsNullOrEmpty(cr.RefTeacherID))
                {
                    TeacherList.Add(cr.RefTeacherID);
                }

                if (!string.IsNullOrEmpty(cr.RefTeacherID2))
                {
                    TeacherList.Add(cr.RefTeacherID2);
                }

                if (!string.IsNullOrEmpty(cr.RefTeacherID3))
                {
                    TeacherList.Add(cr.RefTeacherID3);
                }

                #endregion
            }

            //社團老師Record
            TeacherDic = GetTeacher(TeacherList);

            //取得社團修課記錄
            List <SCJoin> SCJoinList   = tool._A.Select <SCJoin>(string.Format("ref_club_id in ('{0}')", string.Join("','", ClubAdmin.Instance.SelectedSource)));
            List <string> SCJoinIDList = new List <string>();
            List <string> StudentList  = new List <string>();
            foreach (SCJoin each in SCJoinList)
            {
                if (!SCJoinIDList.Contains(each.UID))
                {
                    SCJoinIDList.Add(each.UID);
                }

                if (!StudentList.Contains(each.RefStudentID))
                {
                    StudentList.Add(each.RefStudentID);
                }
            }
            //取得學生
            foreach (StudentRecord student in Student.SelectByIDs(StudentList))
            {
                if (tool.CheckStatus(student))
                {
                    if (!StudentDic.ContainsKey(student.ID))
                    {
                        StudentDic.Add(student.ID, student);
                    }
                }
            }

            //取得社團結算記錄
            List <ResultScoreRecord> RSRList = tool._A.Select <ResultScoreRecord>(string.Format("ref_scjoin_id in ('{0}')", string.Join("','", SCJoinIDList)));
            foreach (ResultScoreRecord each in RSRList)
            {
                if (!RSRDic.ContainsKey(each.RefSCJoinID))
                {
                    RSRDic.Add(each.RefSCJoinID, each);
                }
            }

            #endregion

            #region 建立主資料清單

            foreach (SCJoin each in SCJoinList)
            {
                if (TraDic.ContainsKey(each.RefClubID))
                {
                    ClubTraObj ctObj = new ClubTraObj();
                    ctObj.SCJ = each;
                    if (StudentDic.ContainsKey(each.RefStudentID))
                    {
                        ctObj.student = StudentDic[each.RefStudentID];
                        if (RSRDic.ContainsKey(each.UID))
                        {
                            ctObj.RSR = RSRDic[each.UID];
                        }
                        TraDic[each.RefClubID].Add(ctObj);
                    }
                }
            }

            #endregion
        }