Example #1
0
 internal StudentHelper(StudentInformationProvider provider, AccessHelper accesshelper)
 {
     _Provider     = provider;
     _AccessHelper = accesshelper;
 }
 /// <summary>
 /// 建構子 不指定學年度學期
 /// </summary>
 internal FillSemesterInfoEventArgs(AccessHelper accessHelper, IEnumerable <T> list)
     : base(accessHelper, list)
 {
     _AllSemester = true;
 }
 internal FillScoreInfoEventArgs(AccessHelper accessHelper, bool filterRepeat, IEnumerable <T> list)
     : base(accessHelper, list)
 {
     _FilterRepeat = filterRepeat;
 }
 internal ClassHelper(ClassInformationProvider provider, AccessHelper accesshelper)
 {
     _Provider     = provider;
     _AccessHelper = accesshelper;
 }
 /// <summary>
 /// 建構子 指定學年度學期
 /// </summary>
 internal FillSemesterInfoEventArgs(AccessHelper accessHelper, int schoolyear, int semester, IEnumerable <T> list)
     : base(accessHelper, list)
 {
     _SchoolYear = schoolyear;
     _Semester   = semester;
 }
Example #6
0
 internal CourseHelper(CourseInformationProvider provider, AccessHelper accesshelper)
 {
     _Provider     = provider;
     _AccessHelper = accesshelper;
 }
 /// <summary>
 /// 初始
 /// </summary>
 internal FillEventArgs(AccessHelper accessHelper, IEnumerable <T> list)
 {
     _AccessHelper = accessHelper;
     _List         = list;
 }
Example #8
0
 /// <summary>
 /// 初始
 /// </summary>
 internal FillFieldEventArgs(AccessHelper accessHelper, string fieldName, IEnumerable <T> list)
     : base(accessHelper, list)
 {
     _FieldName = fieldName;
 }
Example #9
0
        public static Dictionary <string, List <StudentSCETakeRec> > GetStudentSCETakeDict(List <string> StudentIDList, string ExamID, int SchoolYear, int Semester)
        {
            Dictionary <string, List <StudentSCETakeRec> > value = new Dictionary <string, List <StudentSCETakeRec> >();

            if (StudentIDList.Count > 0 && ExamID != "")
            {
                SmartSchool.Customization.Data.AccessHelper acc = new SmartSchool.Customization.Data.AccessHelper();

                // 取得及格標準
                List <SmartSchool.Customization.Data.StudentRecord> StudentRecList = acc.StudentHelper.GetStudents(StudentIDList);
                Dictionary <string, Dictionary <string, decimal> >  passScoreDict  = GetStudentApplyLimitDict(StudentRecList);
                Dictionary <string, string> StudGradYearDict = new Dictionary <string, string>();

                foreach (SmartSchool.Customization.Data.StudentRecord rec in StudentRecList)
                {
                    if (!StudGradYearDict.ContainsKey(rec.StudentID))
                    {
                        if (rec.RefClass != null)
                        {
                            StudGradYearDict.Add(rec.StudentID, rec.RefClass.GradeYear);
                        }
                    }
                }

                // 取得學期對照年為主
                List <SHSemesterHistoryRecord> SemsH = SHSemesterHistory.SelectByStudentIDs(StudentIDList);
                foreach (SHSemesterHistoryRecord rec in SemsH)
                {
                    foreach (K12.Data.SemesterHistoryItem item in rec.SemesterHistoryItems)
                    {
                        if (item.SchoolYear == SchoolYear && item.Semester == Semester)
                        {
                            if (!StudGradYearDict.ContainsKey(item.RefStudentID))
                            {
                                StudGradYearDict.Add(item.RefStudentID, item.GradeYear.ToString());
                            }
                            else
                            {
                                StudGradYearDict[item.RefStudentID] = item.GradeYear.ToString();
                            }
                        }
                    }
                }

                List <SHCourseRecord> CourseRecList = SHCourse.SelectBySchoolYearAndSemester(SchoolYear, Semester);
                Dictionary <string, SHCourseRecord> CourseRecDict = new Dictionary <string, SHCourseRecord>();
                foreach (SHCourseRecord rec in CourseRecList)
                {
                    if (!CourseRecDict.ContainsKey(rec.ID))
                    {
                        CourseRecDict.Add(rec.ID, rec);
                    }
                }

                QueryHelper qh    = new QueryHelper();
                string      query = "select sc_attend.ref_student_id as sid,course.id as cid,course.course_name,course.subject,sce_take.score as sce_score,course.credit as credit from sc_attend inner join course on sc_attend.ref_course_id=course.id inner join sce_take on sc_attend.id=sce_take.ref_sc_attend_id where sc_attend.ref_student_id in(" + string.Join(",", StudentIDList.ToArray()) + ") and course.school_year=" + SchoolYear + " and course.semester=" + Semester + " and sce_take.ref_exam_id in(" + ExamID + ")";
                DataTable   dt    = qh.Select(query);
                foreach (DataRow dr in dt.Rows)
                {
                    string SubjCode = "";
                    string sid      = dr["sid"].ToString();
                    if (!value.ContainsKey(sid))
                    {
                        value.Add(sid, new List <StudentSCETakeRec>());
                    }

                    string            cid     = dr["cid"].ToString();
                    StudentSCETakeRec scetRec = new StudentSCETakeRec();
                    scetRec.StudentID = sid;

                    if (CourseRecDict.ContainsKey(cid))
                    {
                        string Req = "", notNq = "";
                        if (CourseRecDict[cid].Required)
                        {
                            Req = "必修";
                        }
                        else
                        {
                            Req = "選修";
                        }

                        if (CourseRecDict[cid].NotIncludedInCredit)
                        {
                            notNq = "是";
                        }
                        else
                        {
                            notNq = "否";
                        }

                        SubjCode = CourseRecDict[cid].Subject + "_" + CourseRecDict[cid].Credit.Value + "_" + Req + "_" + CourseRecDict[cid].RequiredBy + "_" + CourseRecDict[cid].Entry + "_" + notNq;
                    }
                    scetRec.SubjectCode = SubjCode;
                    string GrStr = "";
                    if (StudGradYearDict.ContainsKey(sid))
                    {
                        GrStr = StudGradYearDict[sid] + "_及";
                    }

                    scetRec.Score = "-1";

                    decimal dd, passScore = 0;
                    if (decimal.TryParse(dr["sce_score"].ToString(), out dd))
                    {
                        // 取得及格標準
                        if (passScoreDict.ContainsKey(sid))
                        {
                            if (passScoreDict[sid].ContainsKey(GrStr))
                            {
                                passScore = passScoreDict[sid][GrStr];
                            }
                        }

                        // 不及格標 *
                        if (dd < passScore)
                        {
                            scetRec.Score = "*" + string.Format("{0:##0.00}", dd);
                        }
                        else
                        {
                            scetRec.Score = string.Format("{0:##0.00}", dd);
                        }

                        scetRec.Status = "1";
                    }
                    else
                    {
                        // 缺考
                        scetRec.Status = "4";
                    }

                    scetRec.SubjectCredit = dr["credit"].ToString();

                    value[sid].Add(scetRec);
                }
            }
            return(value);
        }
Example #10
0
        public static Dictionary<string, List<StudentSCETakeRec>> GetStudentSCETakeDict(List<string> StudentIDList,string ExamID,int SchoolYear,int Semester)
        {
            Dictionary<string, List<StudentSCETakeRec>> value = new Dictionary<string, List<StudentSCETakeRec>>();
               if(StudentIDList.Count>0 && ExamID !="")
               {
               SmartSchool.Customization.Data.AccessHelper acc = new SmartSchool.Customization.Data.AccessHelper ();

               // 取得及格標準
               List<SmartSchool.Customization.Data.StudentRecord> StudentRecList = acc.StudentHelper.GetStudents(StudentIDList);
               Dictionary<string, Dictionary<string, decimal>> passScoreDict = GetStudentApplyLimitDict(StudentRecList);
               Dictionary<string, string> StudGradYearDict = new Dictionary<string, string>();

               foreach(SmartSchool.Customization.Data.StudentRecord rec in StudentRecList)
               {
                   if (!StudGradYearDict.ContainsKey(rec.StudentID))
                       if(rec.RefClass !=null)
                            StudGradYearDict.Add(rec.StudentID, rec.RefClass.GradeYear);
               }

               // 取得學期對照年為主
               List<SHSemesterHistoryRecord> SemsH = SHSemesterHistory.SelectByStudentIDs(StudentIDList);
               foreach(SHSemesterHistoryRecord rec in SemsH)
               {
                   foreach(K12.Data.SemesterHistoryItem item in rec.SemesterHistoryItems )
                   {
                       if(item.SchoolYear==SchoolYear && item.Semester== Semester)
                       {
                           if (!StudGradYearDict.ContainsKey(item.RefStudentID))
                               StudGradYearDict.Add(item.RefStudentID, item.GradeYear.ToString());
                           else
                               StudGradYearDict[item.RefStudentID] = item.GradeYear.ToString();
                       }
                   }
               }

               List<SHCourseRecord> CourseRecList = SHCourse.SelectBySchoolYearAndSemester(SchoolYear, Semester);
               Dictionary<string, SHCourseRecord> CourseRecDict = new Dictionary<string, SHCourseRecord>();
               foreach (SHCourseRecord rec in CourseRecList)
                   if (!CourseRecDict.ContainsKey(rec.ID))
                       CourseRecDict.Add(rec.ID, rec);

               QueryHelper qh = new QueryHelper();
               string query = "select sc_attend.ref_student_id as sid,course.id as cid,course.course_name,course.subject,sce_take.score as sce_score,course.credit as credit from sc_attend inner join course on sc_attend.ref_course_id=course.id inner join sce_take on sc_attend.id=sce_take.ref_sc_attend_id where sc_attend.ref_student_id in("+string.Join(",",StudentIDList.ToArray())+") and course.school_year="+SchoolYear+" and course.semester="+Semester+" and sce_take.ref_exam_id in("+ExamID+")";
               DataTable dt = qh.Select(query);
               foreach(DataRow dr in dt.Rows)
               {
                   string SubjCode = "";
                   string sid = dr["sid"].ToString();
                   if (!value.ContainsKey(sid))
                       value.Add(sid, new List<StudentSCETakeRec>());

                   string cid = dr["cid"].ToString();
                   StudentSCETakeRec scetRec = new StudentSCETakeRec();
                   scetRec.StudentID = sid;

                   if(CourseRecDict.ContainsKey(cid))
                   {
                       string Req="",notNq="";
                       if(CourseRecDict[cid].Required)
                           Req="必修";
                       else
                           Req="選修";

                       if(CourseRecDict[cid].NotIncludedInCredit)
                           notNq="是";
                       else
                           notNq="否";

                       SubjCode = CourseRecDict[cid].Subject + "_" + CourseRecDict[cid].Credit.Value + "_" + Req + "_" + CourseRecDict[cid].RequiredBy + "_" + CourseRecDict[cid].Entry + "_" + notNq;
                   }
                   scetRec.SubjectCode = SubjCode;
                   string GrStr="";
                   if (StudGradYearDict.ContainsKey(sid))
                       GrStr = StudGradYearDict[sid]+"_及";

                   scetRec.Score = "-1";

                   decimal dd, passScore = 0;
                   if (decimal.TryParse(dr["sce_score"].ToString(),out dd))
                   {
                       // 取得及格標準
                       if(passScoreDict.ContainsKey(sid))
                           if (passScoreDict[sid].ContainsKey(GrStr))
                                passScore=passScoreDict[sid][GrStr];

                       // 不及格標 *
                       if(dd<passScore)
                           scetRec.Score ="*"+ string.Format("{0:##0.00}", dd);
                       else
                        scetRec.Score = string.Format("{0:##0.00}", dd);

                       scetRec.Status = "1";
                   }else
                   {
                       // 缺考
                       scetRec.Status = "4";
                   }

                   scetRec.SubjectCredit = dr["credit"].ToString();

                   value[sid].Add(scetRec);
               }
               }
            return value;
        }
Example #11
0
 internal TeacherHelper(TeacherInformationProvider provider, AccessHelper accesshelper)
 {
     _Provider     = provider;
     _AccessHelper = accesshelper;
 }
 public GettingLectureTeacherEventArgs(AccessHelper accessHelper, CourseRecord course)
 {
     _AccessHelper = accessHelper;
     _Course       = course;
 }