Esempio n. 1
0
 public void AddEntry(SemesterEntryScoreInfo info)
 {
     if (info.GradeYear == this._grade_year)
     {
         if (!this._entries.ContainsKey(info.Entry))
         {
             this._entries.Add(info.Entry, new ScoreData());
         }
         ScoreData data  = this._entries[info.Entry];
         decimal   score = info.Score;
         if (!((info.Score <= 100M) || this._config.AllowOver))
         {
             score = 100M;
         }
         data.SetInfo(info.Entry, info.Semester, score);
     }
 }
Esempio n. 2
0
 public void AddSubject(SemesterSubjectScoreInfo info)
 {
     if (info.Detail.GetAttribute("不計學分") != "是")
     {
         bool noScore = info.Detail.GetAttribute("不需評分") != "是";
         if (info.GradeYear == this._grade_year)
         {
             ScoreData data      = null;
             bool      addNewOne = true;
             foreach (ScoreData var in this._subjects.Values)
             {
                 if (var.Name == info.Subject)
                 {
                     addNewOne = false;
                     if (info.Semester == 1)
                     {
                         if (!((var.FirstCredit <= 0) && string.IsNullOrEmpty(var.FirstRequire)))
                         {
                             addNewOne = true;
                         }
                     }
                     else if ((info.Semester == 2) && !((var.SecondCredit <= 0) && string.IsNullOrEmpty(var.SecondRequire)))
                     {
                         addNewOne = true;
                     }
                     if (!addNewOne)
                     {
                         data = var;
                         data.SetInfo(info.Subject, info.Semester, info.Require, info.CreditDec(), noScore ? info.Score : -1M);
                         data.SetLevel(info.Level, info.Semester);
                         break;
                     }
                 }
             }
             if (addNewOne)
             {
                 if (!this._subjects.ContainsKey(info.Subject + "_" + info.Level))
                 {
                     this._subjects.Add(info.Subject + "_" + info.Level, new ScoreData());
                 }
                 data = this._subjects[info.Subject + "_" + info.Level];
                 data.SetInfo(info.Subject, info.Semester, info.Require, info.CreditDec(), noScore ? info.Score : -1M);
                 data.SetLevel(info.Level, info.Semester);
             }
             if (!info.Pass && this._standard.ContainsKey(info.GradeYear))
             {
                 if (info.Score >= this._standard[info.GradeYear])
                 {
                     data.SetSign(info.Semester, this._config.ResitSign);
                 }
                 else
                 {
                     data.SetSign(info.Semester, this._config.RepeatSign);
                 }
             }
         }
         XmlHelper helper = new XmlHelper(info.Detail);
         if (info.Pass && (helper.GetText("@不計學分") != "是"))
         {
             if (info.GradeYear == this._grade_year)
             {
                 if (info.Semester == 1)
                 {
                     this._firstTotalCredit += info.CreditDec();
                 }
                 else if (info.Semester == 2)
                 {
                     this._secondTotalCredit += info.CreditDec();
                 }
             }
             if (info.SchoolYear <= this._config.SchoolYear)
             {
                 this._beforeTotalCredit += info.CreditDec();
             }
         }
     }
 }