private bool myLogin(string strStudentNo, string strStudentPwd, out string strMessage) { rollCallSysterm.Models.IStudentManager studentManager = new Models.ClassStudentManager(); rollCallSysterm.Entity.ClassStudent student = studentManager.Login(strStudentNo, strStudentPwd, out strMessage); if (student == null) { return(false); } else { Session.Add("curUser", student);//添加到Session对象中 return(true); } }
/// <summary> /// 检查学生是否已存在 /// </summary> /// <param name="sno">学号</param> /// <param name="strMessage">返回信息</param> /// <returns>返回TRUE表示用户已存在</returns> private bool checkStudent(string sno, out string strMessage) { Entity.ClassStudent aStudent; Models.IStudentManager iStudentManger = new Models.ClassStudentManager(); //从数据库中根据学生学号获得学生,检查该学生是否为null,来验证该学生是否存在。 aStudent = iStudentManger.GetStudentBySno(sno, out strMessage); if (aStudent == null) { strMessage = "不存在该学生"; return(false); } else { strMessage = "已存在该学生"; return(true); } }
/// <summary> /// 保存一个学生信息到数据库中 /// </summary> /// <param name="student">一个需要注册的学生对象</param> /// <param name="strMessage">返回执行信息</param> /// <returns>保存成功返回真</returns> private bool Register(Entity.ClassStudent student, out string strMessage) { strMessage = ""; Models.IStudentManager StudentManger = new Models.ClassStudentManager(); return(StudentManger.Register(student, out strMessage)); //注册 }