Example #1
0
    //-----------------------------
    // Miscellaneous other methods.
    //-----------------------------

    public bool VerifyCompletion(Course c)
    {
        bool outcome = false;

        // Step through all TranscriptEntries, looking for one
        // which reflects a Section of the Course of interest.

        foreach (TranscriptEntry te in TranscriptEntries)
        {
            Section s = te.Section;

            if (s.IsSectionOf(c))
            {
                // Ensure that the grade was high enough.

                if (TranscriptEntry.PassingGrade(te.Grade))
                {
                    outcome = true;

                    // We've found one, so we can afford to
                    // terminate the loop now.

                    break;
                }
            }
        }

        return(outcome);
    }
Example #2
0
    //************************************************
    //
    public bool PostGrade(Student s, string grade)
    {
        // Make sure that we haven't previously assigned a
        // grade to this Student by looking in the Dictionary
        // for an entry using this Student as the key.  If
        // we discover that a grade has already been assigned,
        // we return a value of false to indicate that
        // we are at risk of overwriting an existing grade.
        // (A different method, EraseGrade(), can then be written
        // to allow a Professor to change his/her mind.)

        if (AssignedGrades.ContainsKey(s) == true)
        {
            return(false);
        }

        // First, we create a new TranscriptEntry object.  Note
        // that we are passing in a reference to THIS Section,
        // because we want the TranscriptEntry object,
        // as an association class ..., to maintain object
        // references on the Section as well as on the Student.
        // (We'll let the TranscriptEntry constructor take care of
        // "hooking" this T.E. to the correct Transcript.)

        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        // Then, we add the TranscriptEntry and its associated
        // Student to the AssignedGrades Dictionary.

        AssignedGrades.Add(s, te);

        return(true);
    }
Example #3
0
    //******************************************
    //创建修改成绩的方法,先删除指定的学生成绩在添加新的成绩
    public bool EraseGrade(Student s, string grade)
    {
        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        AssignedGrades.Remove(s);
        AssignedGrades.Add(s, te);
        return(true);
    }
Example #4
0
 //µÚ6Ìâ Ð޸ijɼ¨
 public void EraseGrade(Student s, string grade)
 {
     if (AssignedGrades.ContainsKey(s) == true)
     {
         AssignedGrades.Remove(s);
         TranscriptEntry tr = new TranscriptEntry(s, grade, this);
         AssignedGrades.Add(s, tr);
     }
 }
Example #5
0
    //题6:创建一个EraseGrade
    public bool EraseGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == false)
        {
            return(false);
        }
        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        AssignedGrades[s] = te;
        return(true);
    }
Example #6
0
 //****************************************************
 //
 public void AddTranscriptEntry(TranscriptEntry te)
 {
     foreach (var e in TranscriptEntries)
     {
         if (e.Student.Equals(te.Student) && e.Section.Equals(te.Section))
         {
             e.Grade = te.Grade;
             return;
         }
     }
     TranscriptEntries.Add(te);
 }
Example #7
0
    //****************************************************
    //
    public void AddTranscriptEntry(TranscriptEntry te)
    {
        foreach (var e in TranscriptEntries)
          {
          if (e.Student.Equals(te.Student) && e.Section.Equals(te.Section))
          {
              e.Grade = te.Grade;
              return;
          }

          }
        TranscriptEntries.Add(te);
    }
Example #8
0
    //****************************************************
    //
    public void AddTranscriptEntry(TranscriptEntry te)
    {
        //�����⣬�޸ijɼ���Ӧ�ڴ˴������жϣ���ֹʵ����TranscriptEntry ֱ�������һ�γɼ�
          foreach (var e in TranscriptEntries)
          {
          if (e.Student.Equals(te.Student) && e.Section.Equals(te.Section))
          {
              e.Grade = te.Grade;
              return;
          }
          }

        TranscriptEntries.Add(te);
    }
Example #9
0
    //****************************************************
    //
    public void AddTranscriptEntry(TranscriptEntry te)
    {
        //第六题,修改成绩,应在此处增加判断,防止实例化TranscriptEntry 直接又添加一次成绩
        foreach (var e in TranscriptEntries)
        {
            if (e.Student.Equals(te.Student) && e.Section.Equals(te.Section))
            {
                e.Grade = te.Grade;
                return;
            }
        }

        TranscriptEntries.Add(te);
    }
Example #10
0
    //************************************************
    //
    public bool PostGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == true)
        {
            return(false);
        }

        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        // Then, we add the TranscriptEntry and its associated
        // Student to the AssignedGrades Dictionary.

        AssignedGrades.Add(s, te);

        return(true);
    }
Example #11
0
//第六题
    public bool EraseGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s))
        {
            AssignedGrades.Remove(s);


            //把旧的成绩删掉,添加新成绩。
            TranscriptEntry te = new TranscriptEntry(s, grade, this);
            AssignedGrades.Add(s, te);

            //s.AddSection(this);

            return(true);
        }
        else
        {
            return(false);
        }
    }
Example #12
0
  //*************************************************************	
  // This method returns the value null if the Student has not
  // been assigned a grade.
  //
  public string GetGrade(Student s) {

    string grade = null; 

    //  Only continue if the AssignedGrades Dictionary
    //  contains the Student as a key.

    if ( AssignedGrades.ContainsKey(s) == true ) {

       // Retrieve the Student's transcript entry object, if one
       // exists, and in turn retrieve its assigned grade.
       // If we found no TranscriptEntry for this Student, return
       // a null value to signal this.

       TranscriptEntry te = AssignedGrades[s];
       if (te != null) {
         grade = te.Grade; 
       }  
    }

    return grade;
  }
Example #13
0
    //��ϰ6���޸ijɼ�
    public void EraseGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == true)
          {
          s.Transcript.TranscriptEntries.Remove(AssignedGrades[s]);

          AssignedGrades.Remove(s);

          TranscriptEntry te = new TranscriptEntry(s, grade, this);

          AssignedGrades.Add(s, te);
          }
    }
Example #14
0
 //����EraseGrade�����޸ijɼ�
 public bool EraseGrade(Student s, string grade)
 {
     TranscriptEntry te = new TranscriptEntry(s, grade, this);
     AssignedGrades.Remove(s);
     AssignedGrades.Add(s, te);
     return true;
 }
Example #15
0
    //************************************************
    //
    public bool PostGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == true)
        {
            return false;
        }

        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        // Then, we add the TranscriptEntry and its associated
        // Student to the AssignedGrades Dictionary.

        AssignedGrades.Add(s, te);

        return true;
    }
Example #16
0
 //***************************************************
 //    
 public void AddTranscriptEntry(TranscriptEntry te)
 {
     TranscriptEntries.Add(te);
 }
Example #17
0
    //��ϰ14.6���޸ijɼ�
    public void EraseGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == true)
        {
            AssignedGrades.Remove(s);
            //�Ƴ�ָ��ѧ���ɼ�

            TranscriptEntry tr = new TranscriptEntry(s, grade, this);
            AssignedGrades.Add(s, tr);

        }
    }
Example #18
0
    //������
    public bool EraseGrade(Student s,string grade)
    {
        if (AssignedGrades.ContainsKey(s))
          {
          AssignedGrades.Remove(s);

           //�Ѿɵijɼ�ɾ�������³ɼ���
          TranscriptEntry te = new TranscriptEntry(s, grade, this);
          AssignedGrades.Add(s, te);

          //s.AddSection(this);

          return true;

          }
          else { return false;

          }
    }
Example #19
0
    //��6�������ܹ��޸ijɼ�
    public bool EraseGrade(Student s, string grade)
    {
        if (AssignedGrades.ContainsKey(s) == false)
          {
          return false;
          }

          TranscriptEntry te = new TranscriptEntry(s, grade, this);
          AssignedGrades[s] = te;
          return true;
    }
Example #20
0
    //**************************************
    //    
    public bool PostGrade(Student s, string grade)
    {
        // Make sure that we haven't previously assigned a
        // grade to this Student by looking in the Dictionary
        // for an entry using this Student as the key.  If
        // we discover that a grade has already been assigned,
        // we return a value of false to indicate that
        // we are at risk of overwriting an existing grade.
        // (A different method, EraseGrade(), can then be written
        // to allow a Professor to change his/her mind.)

        if (AssignedGrades.ContainsKey(s) == true)
        {
            if (AssignedGrades[s] != null)
            {
                return false;
            }
        }

        // First, we create a new TranscriptEntry object.  Note
        // that we are passing in a reference to THIS Section,
        // because we want the TranscriptEntry object,
        // as an association class ..., to maintain object
        // references on the Section as well as on the Student.
        // (We'll let the TranscriptEntry constructor take care of
        // "hooking" this T.E. to the correct Transcript.)

        TranscriptEntry te = new TranscriptEntry(s, grade, this);

        // Then, we add the TranscriptEntry and its associated
        // Student to the AssignedGrades Dictionary.

        AssignedGrades.Add(s, te);

        return true;
    }
 //***************************************************
 //
 public void AddTranscriptEntry(TranscriptEntry te)
 {
     TranscriptEntries.Add(te);
 }