/// <summary> /// 複製科目成績物件 /// </summary> /// <returns></returns> public object Clone() { SubjectScore cloneSubjectScore = new SubjectScore(); cloneSubjectScore.Domain = this.Domain; cloneSubjectScore.Subject = this.Subject; cloneSubjectScore.Period = this.Period; cloneSubjectScore.Credit = this.Credit; cloneSubjectScore.Score = this.Score; cloneSubjectScore.Effort = this.Effort; cloneSubjectScore.Text = this.Text; cloneSubjectScore.Comment = this.Comment; return cloneSubjectScore; }
/// <summary> /// 從XML載入設定值 /// <![CDATA[ /// ]]> /// </summary> /// <param name="element"></param> public virtual void Load(XmlElement element) { XmlHelper helper = new XmlHelper(element); ID = helper.GetString("@ID"); RefStudentID = helper.GetString("RefStudentId"); SchoolYear = helper.GetInteger("SchoolYear", 0); Semester = helper.GetInteger("Semester", 0); GradeYear = helper.GetInteger("GradeYear", 0); LearnDomainScore = K12.Data.Decimal.ParseAllowNull(helper.GetString("ScoreInfo/LearnDomainScore")); CourseLearnScore = K12.Data.Decimal.ParseAllowNull(helper.GetString("ScoreInfo/CourseLearnScore")); Subjects = new Dictionary<string, SubjectScore>(); foreach (var subjectElement in helper.GetElements("ScoreInfo/SemesterSubjectScoreInfo/Subject")) { subjectElement.SetAttribute("ID", ID); subjectElement.SetAttribute("RefStudentID", RefStudentID); subjectElement.SetAttribute("SchoolYear", K12.Data.Int.GetString(SchoolYear)); subjectElement.SetAttribute("Semester", K12.Data.Int.GetString(Semester)); SubjectScore subjectScore = new SubjectScore(subjectElement); if (!Subjects.ContainsKey(subjectScore.Subject)) Subjects.Add(subjectScore.Subject, subjectScore); } Domains = new Dictionary<string, DomainScore>(); foreach (var domainElement in helper.GetElements("ScoreInfo/Domains/Domain")) { domainElement.SetAttribute("ID", ID); domainElement.SetAttribute("RefStudentID", RefStudentID); domainElement.SetAttribute("SchoolYear", K12.Data.Int.GetString(SchoolYear)); domainElement.SetAttribute("Semester", K12.Data.Int.GetString(Semester)); DomainScore domainScore = new DomainScore(domainElement); if (!Domains.ContainsKey(domainScore.Domain)) Domains.Add(domainScore.Domain, domainScore); } }