Esempio n. 1
0
 /// <summary>
 /// 判断用户名密码是否正确
 /// </summary>
 /// <param name="uName">用户名</param>
 /// <param name="pwd">密码</param>
 /// <param name="user">登陆成功后给用户返回的一个User对象</param>
 /// <returns></returns>
 public bool GetUserByUName(string uName,string pwd,out User user)
 {
     bool isSuccess = false;
     user = uD.GetUserByUName(uName);
     if (user!=null)
     {
         if (pwd == user.UPwd)
         {
             isSuccess = true;
         }
     }
     return isSuccess;
 }
Esempio n. 2
0
 /// <summary>
 /// 将datatable转换成user对象集合
 /// </summary>
 /// <param name="dt"></param>
 /// <returns></returns>
 private List<User> DTToList(DataTable dt)
 {
     List<User> list = new List<User>();
     foreach (DataRow dr in dt.Rows)
     {
         User u = new User();
         u.UId = Convert.ToInt32(dr["uid"]);
         u.UName = dr["uname"].ToString();
         u.UPwd = dr["upwd"].ToString();
         list.Add(u);
     }
     return list;
 }
Esempio n. 3
0
 /// <summary>
 /// 判断登陆是否成功
 /// </summary>
 /// <param name="name">用户名</param>
 /// <param name="pwd">用户密码</param>
 /// <param name="msg">返回提示信息</param>
 /// <param name="user">返回用户信息</param>
 /// <returns></returns>
 public bool IsLogIn(string name, string pwd, out int msg, out User user)
 {
     bool r = false;
     user = new UserDAL().GetUserByUName(name);
     if (user != null)
     {
         if (user.UPwd == pwd)
         {
             msg = 1;
             r = true;
         }
         else
         {
             msg = 3;
         }
     }
     else
     {
         msg = 2;
     }
     return r;
 }
Esempio n. 4
0
 /// <summary>
 /// 判断登陆是否成功
 /// </summary>
 /// <param name="name">用户名</param>
 /// <param name="pwd">用户密码</param>
 /// <param name="msg">返回提示信息</param>
 /// <param name="user">返回用户信息</param>
 /// <returns></returns>
 public bool IsLogIn(string name, string pwd, out string msg, out User user)
 {
     bool r = false;
     user = new UserDAL().GetUserByUName(name);
     if (user != null)
     {
         if (user.UPwd == pwd)
         {
             msg = "登陆成功!";
             r = true;
         }
         else
         {
             msg = "密码输入有误!";
         }
     }
     else
     {
         msg = "用户名输入有误!";
     }
     return r;
 }