BF2Statistics.Database.GamespyDatabase.UpdateUser C# (CSharp) Method

UpdateUser() public method

Updates an Account's information by ID
public UpdateUser ( int Id, int NewPid, string NewNick, string NewPassword, string NewEmail ) : void
Id int The Current Account ID
NewPid int New Account ID
NewNick string New Account Name
NewPassword string New Account Password, UN HASHED. Leave empty to not set a new password
NewEmail string New Account Email Address
return void
        public void UpdateUser(int Id, int NewPid, string NewNick, string NewPassword, string NewEmail)
        {
            UpdateQueryBuilder Query = new UpdateQueryBuilder("accounts", this);
            Query.SetField("id", NewPid);
            Query.SetField("name", NewNick);
            Query.SetField("email", NewEmail.ToLowerInvariant());
            Query.AddWhere("id", Comparison.Equals, Id);

            // Set new password if not empty
            if (!String.IsNullOrWhiteSpace(NewPassword))
                Query.SetField("password", NewPassword.GetMD5Hash(false));

            Query.Execute();
        }

Same methods

GamespyDatabase::UpdateUser ( string Nick, string Country ) : void

Usage Example

 /// <summary>
 /// Updates the Users Country code when sent by the client
 /// </summary>
 /// <param name="recv">Array of information sent by the server</param>
 private void UpdateUser(Dictionary<string, string> Recv)
 {
     // Set clients country code
     try
     {
         using (GamespyDatabase Conn = new GamespyDatabase())
             Conn.UpdateUser(PlayerNick, Recv["countrycode"]);
     }
     catch
     {
         //Dispose();
     }
 }
All Usage Examples Of BF2Statistics.Database.GamespyDatabase::UpdateUser