Ejemplo n.º 1
0
 //获取用户数据
 public static RcUsers GetByUserID(string userId)
 {
     using (IDataReader reader = DBRcUsers.GetOneByUserID(userId))
     {
         return(PopulateFromReader(reader));
     }
 }
Ejemplo n.º 2
0
        public static UserLoginContract Login(string userId, string password)
        {
            UserContract newContract = new UserContract();

            UserLoginContract loginContract = new UserLoginContract();


            using (IDataReader reader = DBRcUsers.GetOneByUserID(userId))
            {
                string  theResult = "登录不成功";
                RcUsers theUser   = PopulateFromReader(reader);
                if (theUser == null)
                {
                    theResult = "用户不存在";
                }
                else if (theUser.Password == password)
                {
                    theResult = "success";

                    newContract.UserID    = theUser.UserID;
                    newContract.Name      = theUser.Name;
                    newContract.Declaring = theUser.Declaring;
                    newContract.IsMale    = theUser.IsMale;
                    newContract.OnLine    = true;
                }

                else
                {
                    theResult = "密码不正确";
                    //密码不正确
                }

                loginContract.Message      = theResult;
                loginContract.UserContract = newContract;

                return(loginContract);
            }
        }