public void AddMerit(Data.MeritRecord rec) { ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(rec.SchoolYear, rec.Semester); if (!MeritsBySchoolYear.ContainsKey(SchoolYearSemester)) MeritsBySchoolYear.Add(SchoolYearSemester, new List<Data.MeritRecord>()); MeritsBySchoolYear[SchoolYearSemester].Add(rec); }
public ServiceVO(DataRow row) { SchoolYearSemester = new ValueObj.SchoolYearSemester(("" + row["school_year"]).Trim(), ("" + row["semester"]).Trim()); StudentId = ("" + row["ref_student_id"]).Trim(); OccurTime = Utility.ConvertStringToDateTime(("" + row["occur_date"]).Trim()); Hours = decimal.Parse(("" + row["hours"]).Trim()); }
public ServiceVO(DataRow row) { SchoolYearSemester = new ValueObj.SchoolYearSemester(("" + row["school_year"]).Trim(), ("" + row["semester"]).Trim()); StudentId = ("" + row["ref_student_id"]).Trim(); OccurTime = Utility.ConvertStringToDateTime(("" + row["occur_date"]).Trim()); Hours = decimal.Parse(("" + row["hours"]).Trim()); }
public void AddMerit(Data.MeritRecord rec) { ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(rec.SchoolYear, rec.Semester); if (!MeritsBySchoolYear.ContainsKey(SchoolYearSemester)) { MeritsBySchoolYear.Add(SchoolYearSemester, new List <Data.MeritRecord>()); } MeritsBySchoolYear[SchoolYearSemester].Add(rec); }
public void AddDemerit(Data.DemeritRecord rec) { // 已銷過的不處理 if (rec.Cleared == "是") return; // 非懲戒的不處理 if (rec.MeritFlag != "0") return; ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(rec.SchoolYear, rec.Semester); if (!DemeritsBySchoolYear.ContainsKey(SchoolYearSemester)) DemeritsBySchoolYear.Add(SchoolYearSemester, new List<Data.DemeritRecord>()); DemeritsBySchoolYear[SchoolYearSemester].Add(rec); }
public void AddDemerit(Data.DemeritRecord rec) { // 已銷過的不處理 if (rec.Cleared == "是") { return; } // 非懲戒的不處理 if (rec.MeritFlag != "0") { return; } ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(rec.SchoolYear, rec.Semester); if (!DemeritsBySchoolYear.ContainsKey(SchoolYearSemester)) { DemeritsBySchoolYear.Add(SchoolYearSemester, new List <Data.DemeritRecord>()); } DemeritsBySchoolYear[SchoolYearSemester].Add(rec); }
/// <summary> /// 取得學生領域成績 /// </summary> /// <param name="StudentIdList"></param> /// <returns></returns> public static Dictionary <string, ValueObj.DomainsVO> GetDomainScore(List <string> StudentIdList) { // 學生每個學年度學期的領域分數 Dictionary <string, ValueObj.DomainsVO> result = new Dictionary <string, ValueObj.DomainsVO>(); List <JHSchool.Data.JHSemesterScoreRecord> SemesterScoreList = JHSchool.Data.JHSemesterScore.SelectByStudentIDs(StudentIdList); foreach (JHSchool.Data.JHSemesterScoreRecord rec in SemesterScoreList) { string studentId = rec.RefStudentID; if (!result.ContainsKey(studentId)) { result.Add(studentId, new ValueObj.DomainsVO()); } foreach (Data.DomainScore domainScore in rec.Domains.Values) { ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(domainScore.SchoolYear, domainScore.Semester); ValueObj.DomainsVO domainsVo = result[studentId]; domainsVo.AddDomain(SchoolYearSemester, studentId, domainScore.Domain, domainScore.Score); } } return(result); } // end of GetDomainScore
/// <summary> /// 處理學習歷程 /// </summary> /// <param name="record"></param> /// <returns></returns> public static Dictionary<int, ValueObj.SchoolYearSemester> ProcessSemesterHistory(JHSchool.Data.JHSemesterHistoryRecord record) { Dictionary<int, ValueObj.SchoolYearSemester> result = new Dictionary<int,ValueObj.SchoolYearSemester>(); /* * 1: 一上; 2: 一下; 3: 二上; 4: 二下; 5: 三上; 6: 三下 * */ result.Add(1, null); result.Add(2, null); result.Add(3, null); result.Add(4, null); result.Add(5, null); result.Add(6, null); foreach (var item in record.SemesterHistoryItems) { int gradeYear = item.GradeYear; if (gradeYear > 6) gradeYear -= 6; // 由[(年級-1)*2+學期]取得Key int key = (gradeYear - 1) * 2 + item.Semester; if (result.ContainsKey(key)) { result[key] = new ValueObj.SchoolYearSemester(item.SchoolYear, item.Semester); } } return result; }
/// <summary> /// 取得學生領域成績 /// </summary> /// <param name="StudentIdList"></param> /// <returns></returns> public static Dictionary<string, ValueObj.DomainsVO> GetDomainScore(List<string> StudentIdList) { // 學生每個學年度學期的領域分數 Dictionary<string, ValueObj.DomainsVO> result = new Dictionary<string,ValueObj.DomainsVO>(); List<JHSchool.Data.JHSemesterScoreRecord> SemesterScoreList = JHSchool.Data.JHSemesterScore.SelectByStudentIDs(StudentIdList); foreach (JHSchool.Data.JHSemesterScoreRecord rec in SemesterScoreList) { string studentId = rec.RefStudentID; if(!result.ContainsKey(studentId)) result.Add(studentId, new ValueObj.DomainsVO()); foreach(Data.DomainScore domainScore in rec.Domains.Values) { ValueObj.SchoolYearSemester SchoolYearSemester = new ValueObj.SchoolYearSemester(domainScore.SchoolYear, domainScore.Semester); ValueObj.DomainsVO domainsVo = result[studentId]; domainsVo.AddDomain(SchoolYearSemester, studentId, domainScore.Domain, domainScore.Score); } } return result; } // end of GetDomainScore
/// <summary> /// 處理德行表現 /// </summary> /// <param name="studentObj"></param> /// <param name="gradeMap"></param> /// <param name="clubsObj"></param> /// <param name="servicesObj"></param> private decimal Cal_VirtuousConduct(ValueObj.StudentVO studentObj, Dictionary <int, ValueObj.SchoolYearSemester> gradeMap, ValueObj.ClubsVO clubsObj, ValueObj.ServicesVO servicesObj) { int ItemIndex = Global.index_VirtuousConduct; // 取得大項目的條件 ValueObj.ItemConditionVO itemCondition = new ValueObj.ItemConditionVO(ItemIndex); // 取得子項目的條件 ValueObj.DetailItemConditionVO detailCondition = new ValueObj.DetailItemConditionVO(ItemIndex); // 取得需要看的學年度學期 List <ValueObj.SchoolYearSemester> needSchoolYearList = Utility.GetNeedSchoolSemester(itemCondition.NeedSemester, gradeMap); // 大項目名稱 string itemName = itemCondition.ItemName; decimal ItemTotalPoints = 0; #region 處理社團 // 社團名稱 string detailItemName = Global.DetailItemNameList[ItemIndex][0]; // 社團積分 decimal clubPoints = detailCondition.DetailItemListDic[detailItemName]; decimal clubTotalPoints = 0; if (clubsObj != null) { // loop 每個學期 foreach (ValueObj.SchoolYearSemester schoolYear in needSchoolYearList) { if (schoolYear == null) { continue; } List <ValueObj.ClubVO> clubList = clubsObj.GetClubsBySchoolYear(schoolYear); // 假如有參加過社團, +1分 if (clubList.Count > 0) { clubTotalPoints += 1; } } } // 取得detail item in student ValueObj.DetailItemVO detailItem = studentObj.DetailItemList[itemName][detailItemName]; // 回存此項目顯示的內容 detailItem.Value = "Count:" + clubTotalPoints.ToString(); // 假如超過上限, 就以上限為主 clubPoints = (clubTotalPoints > clubPoints) ? clubPoints : clubTotalPoints; // 回存此項目的積分 detailItem.Points = clubPoints; #endregion #region 處理服務學習 decimal ServiceHours = 6; // 服務學習名稱 detailItemName = Global.DetailItemNameList[ItemIndex][1]; // 服務學習積分 decimal servicePoints = detailCondition.DetailItemListDic[detailItemName]; decimal serviceTotalPoints = 0; // 特殊條件 // 取得三下的學年度學期 ValueObj.SchoolYearSemester specilSchoolYear = gradeMap[6]; // 截止時間 103/5/9 DateTime deadTime = new DateTime(2014, 5, 9); if (servicesObj != null) { // loop 每個學期 foreach (ValueObj.SchoolYearSemester schoolYear in needSchoolYearList) { if (schoolYear == null) { continue; } decimal hours = 0; List <ValueObj.ServiceVO> serviceList = servicesObj.GetServicesBySchoolYear(schoolYear); // 加總此學期的時數 foreach (var serviceObj in serviceList) { if (schoolYear == specilSchoolYear) { if (serviceObj.OccurTime.HasValue && (serviceObj.OccurTime.Value <= deadTime)) { hours += serviceObj.Hours; } } else { hours += serviceObj.Hours; } } // 假如超過6小時, +1分 if (hours >= ServiceHours) { serviceTotalPoints += 1; } } } // 取得detail item in student detailItem = studentObj.DetailItemList[itemName][detailItemName]; // 回存此項目顯示的內容 detailItem.Value = "Count:" + serviceTotalPoints.ToString(); // 假如超過上限, 就以上限為主 servicePoints = (serviceTotalPoints > servicePoints) ? servicePoints : serviceTotalPoints; // 回存此項目的積分 detailItem.Points = servicePoints; #endregion ItemTotalPoints = clubPoints + servicePoints; // 此學生在這個項目的積分 studentObj.ItemList[itemName] = ItemTotalPoints; return(ItemTotalPoints); }
/// <summary> /// 處理均衡學習 /// </summary> /// <param name="studentObj"></param> /// <param name="gradeMap"></param> /// <param name="domains"></param> private decimal Cal_BalanceLearning(ValueObj.StudentVO studentObj, Dictionary <int, ValueObj.SchoolYearSemester> gradeMap, ValueObj.DomainsVO domains) { int ItemIndex = Global.index_BalanceLearning; // 取得大項目的條件 ValueObj.ItemConditionVO itemCondition = new ValueObj.ItemConditionVO(ItemIndex); // 取得子項目的條件 ValueObj.DetailItemConditionVO detailCondition = new ValueObj.DetailItemConditionVO(ItemIndex); // 取得需要看的學年度學期 Dictionary <int, ValueObj.SchoolYearSemester> needSchoolYearList = Utility.GetNeedSchoolSemesterIndex(itemCondition.NeedSemester, gradeMap); // 大項目名稱 string itemName = itemCondition.ItemName; // 及格分數 decimal PassScore = 60; // 項目的積分 decimal ItemTotalPoints = 0; if (domains != null) { // loop 每個需要的領域 for (int intI = 0; intI < Global.DetailItemNameList[ItemIndex].Length; intI++) { // 子項目名稱 string detailItemName = Global.DetailItemNameList[ItemIndex][intI]; // 子項目積分 decimal points = detailCondition.DetailItemListDic[detailItemName]; decimal totalScore = 0; decimal avgScore = 0; decimal scoreCount = 0; // loop 領域的每個學期分數 foreach (KeyValuePair <int, ValueObj.SchoolYearSemester> pair in needSchoolYearList) { ValueObj.SchoolYearSemester schoolYear = pair.Value; if (schoolYear == null) { // 少了需要的學期 if (!_WarningStudentDic.ContainsKey(studentObj)) { _WarningStudentDic.Add(studentObj, new ValueObj.LackMsg()); } _WarningStudentDic[studentObj].AddHistoryLack(pair.Key); continue; } List <ValueObj.DomainVO> domainList = domains.GetDomainsBySechoolYear(schoolYear, detailItemName); if (domainList.Count == 0) { // 少了需要的領域 if (!_WarningStudentDic.ContainsKey(studentObj)) { _WarningStudentDic.Add(studentObj, new ValueObj.LackMsg()); } _WarningStudentDic[studentObj].AddDomainLack(pair.Key); continue; } foreach (ValueObj.DomainVO domain in domainList) { totalScore += domain.DomainScore; scoreCount++; } } // 取得detail item in student ValueObj.DetailItemVO detailItem = studentObj.DetailItemList[itemName][detailItemName]; // 領域的平均 // 原本是固定除以需要的學期, 這樣有少一個學期分數的話, 會很難看, 所以改成有幾個分數就除以幾 // avgScore = Math.Round((totalScore / needSchoolYearList.Count), 2, MidpointRounding.AwayFromZero); if (scoreCount > 0) { avgScore = Math.Round((totalScore / scoreCount), 2, MidpointRounding.AwayFromZero); } // 回存此項目顯示的內容 detailItem.Value = "總分: " + totalScore + ", 學期數: " + scoreCount + ", 平均: " + avgScore.ToString(); // 看學生有沒有得到此積分 if (avgScore >= PassScore) { ItemTotalPoints += points; // 回存此項目的積分 detailItem.Points = points; } } } else { // 完全沒有領域成績 if (!_WarningStudentDic.ContainsKey(studentObj)) { _WarningStudentDic.Add(studentObj, new ValueObj.LackMsg()); } foreach (int rec in needSchoolYearList.Keys) { _WarningStudentDic[studentObj].AddDomainLack(rec); } } // 假如超過上限, 就以上限為主 ItemTotalPoints = (ItemTotalPoints > itemCondition.MaxItemPoints) ? itemCondition.MaxItemPoints : ItemTotalPoints; // 此學生在這個項目的積分 studentObj.ItemList[itemName] = ItemTotalPoints; return(ItemTotalPoints); }