public override string Compile() { StringBuilder Packet = new StringBuilder("EL"); var ListBidHouseItems = this.Account.getBidHouseItemDeposed(this.BidHouseID); Boolean isFirst = true; foreach (var BHI in ListBidHouseItems) { if (BHI == null) { continue; } if (!isFirst) { Packet.Append("|"); } BHI.SerializeAsDisplayEquipment(Packet); isFirst = false; } return(Packet.ToString()); }
public static void Update(List <BidHouseItem> list) { try { DatabaseManager.Provider.ExecuteQuery("TRUNCATE TABLE `bidhouse_items`"); } catch (Exception e) { Logger.Error("Can't execute query : " + e.ToString()); } try { MySqlCommand Command; foreach (var BHI in list) { if (BHI.Owner == -1) { continue; } Command = new MySqlCommand() { Connection = DatabaseManager.Provider.getConnection(), CommandText = "INSERT INTO `bidhouse_items` VALUES(@map,@owner,@price,@count,@item);", }; Command.Prepare(); Command.Parameters.AddWithValue("@map", BHI.MapID); Command.Parameters.AddWithValue("@owner", BHI.Owner); Command.Parameters.AddWithValue("@price", BHI.Price); Command.Parameters.AddWithValue("@count", BHI.getQuantity(false)); Command.Parameters.AddWithValue("@item", BHI.Item.ID); Command.ExecuteNonQuery(); } ItemTemplateTable.UpdateAVGPrice(); } catch (Exception e) { Logger.Error("Can't execute query : " + e.ToString()); } }