コード例 #1
0
 /// <summary>
 /// 登录时,根据用户名查询相应的对象信息
 /// </summary>
 /// <param name="sid">用户名</param>
 /// <returns></returns>
 public bool getStudentInfoBySid(string sid, string pwd, out string msg, out Student stu)
 {
     stu = dal.getStudentInfoBySid(sid);
     if (stu != null)
     {
         if (stu.PassWord == MD5Encode.GetMd5(pwd))
         {
             msg = "登录成功";
             return(true);
         }
         else
         {
             msg = "密码错误";
             return(false);
         }
     }
     else
     {
         msg = "该用户不存在";
         return(false);
     }
 }
コード例 #2
0
        /// <summary>
        /// 根据用户的账号密码,判断是否登录成功
        /// </summary>
        /// <param name="id">账号</param>
        /// <param name="pwd">密码</param>
        /// <param name="msg">提示信息</param>
        /// <returns>成功与否</returns>
        public bool GetTeacherInfo(string id, string pwd, out string msg)
        {
            Teacher teacher = dal.GetTeacherInfo(id);

            if (teacher != null)
            {
                if (teacher.PassWord == MD5Encode.GetMd5(pwd))
                {
                    msg = "登录成功";
                    return(true);
                }
                else
                {
                    msg = "密码错误";
                    return(false);
                }
            }
            else
            {
                msg = "该用户不存在";
                return(false);
            }
        }