public override string Compile() { String packet = "Rp" + mountPark.get_owner() + ";" + mountPark.get_price() + ";" + mountPark.get_size() + ";" + mountPark.getObjectNumb() + ";"; Guild G = mountPark.get_guild(); //Si une guilde est definie if (G != null) { packet += G.Name + ";" + G.Emblem; } else { packet += ";"; } return(packet); }
public static void Update(MountPark model) { try { MySqlCommand Command = new MySqlCommand() { Connection = DatabaseManager.Provider.getConnection(), CommandText = "REPLACE INTO `mountpark_data` VALUES(@map,@cell,@size,@owner,@guild,@price,@data);", }; Command.Prepare(); Command.Parameters.AddWithValue("@map", model.get_map().Id); Command.Parameters.AddWithValue("@cell", model.get_cellid()); Command.Parameters.AddWithValue("@size", model.get_size()); Command.Parameters.AddWithValue("@owner", model.get_owner()); Command.Parameters.AddWithValue("@guild", (model.get_guild() == null ? -1 : model.get_guild().ID)); Command.Parameters.AddWithValue("@price", model.get_price()); Command.Parameters.AddWithValue("@data", (model.parseData())); Command.ExecuteNonQuery(); } catch (Exception e) { Logger.Error("Can't execute query : " + e.ToString()); } }