public void SetSLRInStudent(SLRecord slr) { if (StudentDic.ContainsKey(slr.RefStudentID)) { string sKey = slr.SchoolYear + "/" + slr.Semester; Dictionary<string, decimal> SLRDic = StudentDic[slr.RefStudentID].SLRDic; // 假如找到同一個學年度跟學期, 就把服務時間加總 if (SLRDic.ContainsKey(sKey)) { SLRDic[sKey] += slr.Hours; } // 沒有找到同一個學年度跟學期, 就把資料新增進去 else { SLRDic.Add(sKey, slr.Hours); } // 所有學生的學年度跟學期的聯集 if(!this.SLRSchoolYearSemesterDic.ContainsKey(sKey)) { this.SLRSchoolYearSemesterDic.Add(sKey, 0); } } }
public void SetSLRInStudent(SLRecord slr) { if (StudentDic.ContainsKey(slr.RefStudentID)) { string sKey = slr.SchoolYear + "/" + slr.Semester; Dictionary <string, decimal> SLRDic = StudentDic[slr.RefStudentID].SLRDic; // 假如找到同一個學年度跟學期, 就把服務時間加總 if (SLRDic.ContainsKey(sKey)) { SLRDic[sKey] += slr.Hours; } // 沒有找到同一個學年度跟學期, 就把資料新增進去 else { SLRDic.Add(sKey, slr.Hours); } // 所有學生的學年度跟學期的聯集 if (!this.SLRSchoolYearSemesterDic.ContainsKey(sKey)) { this.SLRSchoolYearSemesterDic.Add(sKey, 0); } } }