示例#1
0
        //获取好友
        private static IList <UserContract> LoadUserContractList(IDataReader reader)
        {
            IList <UserContract> rcUsersList = new List <UserContract>();

            try
            {
                while (reader.Read())
                {
                    UserContract rcUsers = new UserContract();

                    rcUsers.UserID = reader["UserID"].ToString();
                    rcUsers.Name   = reader["Name"].ToString();

                    rcUsers.Declaring = reader["Declaring"].ToString();

                    rcUsers.IsMale = Convert.ToBoolean(reader["IsMale"]);
                    rcUsers.OnLine = false;
                    rcUsersList.Add(rcUsers);
                }
            }
            finally
            {
                reader.Close();
            }

            return(rcUsersList);
        }
示例#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);
            }
        }
示例#3
0
 public UserLoginContract(string message, UserContract userContract)
 {
     this.Message      = message;
     this.UserContract = userContract;
 }