Added TransferToAccount method

This commit is contained in:
2021-11-01 21:34:55 -04:00
parent 6885daafe9
commit 5b4c9b6648

View File

@ -97,15 +97,30 @@ namespace NightmareCoreWeb2
conn.Close(); conn.Close();
} }
public void SetAtLogin() { public bool TransferToAccount(int newAccount)
{
MySqlConnection conn = new MySqlConnection(Program.connStr);
conn.Open();
string sql = "update characters.characters set account=@newAccount where guid=@guid";
MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.Parameters.AddWithValue("guid", this.guid);
cmd.Parameters.AddWithValue("newAccount", newAccount);
int status = cmd.ExecuteNonQuery();
conn.Close();
return status == 1;
}
public bool SetAtLogin()
{
MySqlConnection conn = new MySqlConnection(Program.connStr); MySqlConnection conn = new MySqlConnection(Program.connStr);
conn.Open(); conn.Open();
string sql = "update characters.characters set at_login=@loginOpts where guid=@guid"; string sql = "update characters.characters set at_login=@loginOpts where guid=@guid";
MySqlCommand cmd = new MySqlCommand(sql, conn); MySqlCommand cmd = new MySqlCommand(sql, conn);
cmd.Parameters.AddWithValue("guid", this.guid); cmd.Parameters.AddWithValue("guid", this.guid);
cmd.Parameters.AddWithValue("loginOpts", (int)this.AtLogin); cmd.Parameters.AddWithValue("loginOpts", (int)this.AtLogin);
cmd.ExecuteNonQuery(); int status = cmd.ExecuteNonQuery();
conn.Close(); conn.Close();
return status == 1;
} }
} }
} }