private static TCInstructRecordEditor SetTeacher(CourseRecord course, TeacherRecord teacher, string sequence)
        {
            TCInstructRecord tcrecord;

            if (sequence == "1")
            {
                tcrecord = course.GetFirstInstruct();
            }
            else if (sequence == "2")
            {
                tcrecord = course.GetSecondInstruct();
            }
            else
            {
                tcrecord = course.GetThirdInstruct();
            }

            if (tcrecord != null && teacher != null)
            {
                return(new TCInstructRecordEditor(tcrecord, teacher)); //改變教師
            }
            else if (tcrecord != null && teacher == null)
            {
                return(new TCInstructRecordEditor(tcrecord)); //刪除記錄。
            }
            else if (tcrecord == null && teacher == null)
            {
                return(new TCInstructRecordEditor());    //什麼都不作。
            }
            else
            {
                return(new TCInstructRecordEditor(course, teacher, sequence)); //新增記錄。
            }
        }
Beispiel #2
0
 /// <summary>
 /// 取得課程的第三位授課教師。
 /// </summary>
 public static TeacherRecord GetThirdTeacher(this CourseRecord course)
 {
     if (course != null)
     {
         TCInstructRecord tc = course.GetThirdInstruct();
         if (tc != null)
         {
             return(tc.Teacher);
         }
     }
     return(null);
 }