コード例 #1
0
 public bool AddTeacher(Domain.Teacher newTeacher)
 {
     ITeacherDao teacherDao = new TeacherDao(sessionFactory);
     ISystemUserDao systemUserDao = new SystemUserDao(sessionFactory);
     //先存入Teacher,在存入SystemUser
     try
     {
         int teacherId= (Int32)teacherDao.Save(newTeacher);
         SystemUser newSystemUser = new SystemUser
         {
             systemUserID =teacherId.ToString(),
             systemUserPassword = newTeacher.teacherPassword,
             systemUserType = 2
         };
         systemUserDao.Save(newSystemUser);
         return true;
     }catch(Exception e){
         return false;
     }
 }
コード例 #2
0
 public IList<Teacher> GetAllTeacher()
 {
     ITeacherDao teacherDao = new TeacherDao(sessionFactory);
     try
     {
         IList<Teacher> teacherList = teacherDao.LoadAll();
         return teacherList;
     }
     catch (Exception e)
     {
         return null;
     }
 }
コード例 #3
0
 public Teacher GetTeacherByID(string userID)
 {
     int teacherId = Int32.Parse(userID);
     ITeacherDao teacherDao = new TeacherDao(sessionFactory);
     return teacherDao.Get(teacherId);
 }