public void Register_User()
 {
     UserInfo user = new UserInfo()
     {
         UserId = HttpContext.Current.Request["UserId"],
         UserName = HttpContext.Current.Request["UserName"],
         PassWord = HttpContext.Current.Request["PassWord"],
         Sex = HttpContext.Current.Request["Sex"],
         Age = Convert.ToInt32(HttpContext.Current.Request["Age"]),
         Email = HttpContext.Current.Request["Email"],
         OnlineTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
         Status = StatusEnum.在线.ToString()
     };
     if (!userBLL.AddUser(user))
     {
         responseResult.ResponseDetails = "注册用户失败!";
         responseResult.ResponseStatus = 0;
     }
     else
     {
         responseResult.ResponseData = user;
         responseResult.ResponseDetails = "注册用户成功!";
         responseResult.ResponseStatus = 1;
     }
     responseResult.ResponseWrite();
 }
Example #2
0
 /// <summary>
 /// 根据用户id查询用户信息
 /// </summary>
 /// <param name="account">用户信息</param>
 /// <returns></returns>
 public UserInfo GetUserOne(UserInfo user)
 {
     DataSet ds = userDAL.GetUserOne(user);
     List<UserInfo> users = DataSetToList(ds);
     if (users == null) return null;
     return users[0];
 }
Example #3
0
 /// <summary>
 /// 根据账号及密码验证
 /// </summary>        
 /// <returns></returns>
 public UserInfo VerifyUser(UserInfo user)
 {
     DataSet ds = userDAL.VerifyUser(user);
     List<UserInfo> users = DataSetToList(ds);
     if (users == null) return null;
     user = DataSetToList(ds)[0];
     return user;
 }
Example #4
0
 /// <summary>
 /// 根据用户id查询用户信息
 /// </summary>
 /// <param name="account">用户信息</param>
 /// <returns></returns>
 public DataSet GetUserOne(UserInfo user)
 {
     StringBuilder sbSql = new StringBuilder();
     sbSql.Append("select * from UserInfo where UserId=@UserId");
     SQLiteParameter[] parameters = 
     { 
         new SQLiteParameter("@UserId", DbType.String){Value=user.UserId}
     };
     return SqliteHelper.ExecuteDataset(sbSql.ToString(), parameters);
 }
Example #5
0
 /// <summary>
 /// 通用用户验证方法
 //// 参数:
 ///     (用户验证参数)
 /// </summary>
 /// <returns>返回用户信息</returns>
 public static UserInfo VerifyUser()
 {
     UserInfo user = new UserInfo()
     {
         UserId = HttpContext.Current.Request["UserId"],
         PassWord = HttpContext.Current.Request["PassWord"]
     };
     user = userBLL.VerifyUser(user);
     if (user != null) return user;
     ResponseResult responseResult = new ResponseResult()
     {
         ResponseDetails = "用户验证失败!",
         ResponseStatus = 0
     };
     responseResult.ResponseWrite();
     return null;
 }
Example #6
0
 /// <summary>
 /// 新增用户记录
 /// </summary>
 /// <param name="user">用户信息</param>
 /// <returns></returns>
 public int AddUser(UserInfo user)
 {
     StringBuilder sbSql = new StringBuilder();
     sbSql.Append("insert into UserInfo values");
     sbSql.Append("(@UserId,@UserName,@PassWord,@Sex,@Age,@Email,@Status,@OnlineTime,@OfflineTime)");
     SQLiteParameter[] parameters = 
     { 
         new SQLiteParameter("@UserId", DbType.String){Value=user.UserId},
         new SQLiteParameter("@UserName", DbType.String){Value=user.UserName},
         new SQLiteParameter("@PassWord", DbType.String){Value=user.PassWord},
         new SQLiteParameter("@Sex", DbType.Int32){Value=(int)Enum.Parse(typeof(SexEnum),user.Sex)},
         new SQLiteParameter("@Age", DbType.Int32){Value=user.Age},
         new SQLiteParameter("@Email", DbType.String){Value=user.Email},
         new SQLiteParameter("@Status", DbType.Int32){Value=(int)Enum.Parse(typeof(StatusEnum),user.Status)},
         new SQLiteParameter("@OnlineTime", DbType.DateTime){Value=Convert.ToDateTime(user.OnlineTime)},
         new SQLiteParameter("@OfflineTime", DbType.DateTime){Value=Convert.ToDateTime(user.OfflineTime)}
     };
     return SqliteHelper.ExecuteNonQuery(sbSql.ToString(), parameters);
 }
Example #7
0
 /// <summary>
 /// 修改用户记录
 /// </summary>
 /// <param name="user">用户信息</param>
 /// <returns></returns>
 public bool UpdateUser(UserInfo user)
 {
     int AffectRows = userDAL.UpdateUser(user);
     return AffectRows > 0;
 }
Example #8
0
 /// <summary>
 /// 新增用户记录
 /// </summary>
 /// <param name="user">用户信息</param>
 /// <returns></returns>
 public bool AddUser(UserInfo user)
 {
     int AffectRows = userDAL.AddUser(user);
     return AffectRows > 0;
 }
 private void AddFriend()
 {
     UserInfo friend = new UserInfo()
     {
         UserId = m_Context.Request["FriendId"]
     };
     _IAsyncResult.Result = sdk.Add_Friend(friend);
     _IAsyncResult.Send();
 }
Example #10
0
 /// <summary>
 /// 修改用户记录
 /// </summary>
 /// <param name="user">用户信息</param>
 /// <returns></returns>
 public int UpdateUser(UserInfo user)
 {
     StringBuilder sbSql = new StringBuilder();
     sbSql.Append("update UserInfo set ");
     sbSql.Append("UserName=@UserName,PassWord=@PassWord,Sex=@Sex,Age=@Age,Email=@Email,Status=@Status,OnlineTime=@OnlineTime,OfflineTime=@OfflineTime ");
     sbSql.Append("where UserId=@UserId");
     SQLiteParameter[] parameters = 
     { 
         new SQLiteParameter("@UserName", DbType.String){Value=user.UserName},
         new SQLiteParameter("@PassWord", DbType.String){Value=user.PassWord},
         new SQLiteParameter("@Sex", DbType.Int32){Value=(int)Enum.Parse(typeof(SexEnum),user.Sex)},
         new SQLiteParameter("@Age", DbType.Int32){Value=user.Age},
         new SQLiteParameter("@Email", DbType.String){Value=user.Email},
         new SQLiteParameter("@Status", DbType.Int32){Value=(int)Enum.Parse(typeof(StatusEnum),user.Status)},
         new SQLiteParameter("@OnlineTime", DbType.DateTime){Value=Convert.ToDateTime(user.OnlineTime)},
         new SQLiteParameter("@OfflineTime", DbType.DateTime){Value=Convert.ToDateTime(user.OfflineTime)},
         new SQLiteParameter("@UserId", DbType.String){Value=user.UserId}
     };
     return SqliteHelper.ExecuteNonQuery(sbSql.ToString(), parameters);
 }
Example #11
0
 /// <summary>
 /// 添加好友
 /// </summary>
 /// <param name="friend">好友信息</param>
 /// <returns></returns>
 public string Add_Friend(UserInfo friend)
 {
     PHPArray array = new PHPArray();
     array.Add("FriendId", friend.UserId);
     string url = this.GetUrl(string.Format(GlobalURL.Get_Friends, GlobalURL.Version));
     return this.Http_Get(url);
 }