Example #1
0
        public static void Add(TaxCollector item)
        {
            try
            {
                MySqlCommand Command = new MySqlCommand()
                {
                    Connection  = DatabaseManager.Provider.getConnection(),
                    CommandText = "REPLACE INTO `taxcollector` VALUES(@guid,@map,@cell,@or,@guild,@n1,@n2,@item,@kamas,@xp);",
                };
                Command.Prepare();
                Command.Parameters.AddWithValue("@guid", item.ActorId);
                Command.Parameters.AddWithValue("@map", item.Mapid);
                Command.Parameters.AddWithValue("@cell", item.CellId);
                Command.Parameters.AddWithValue("@or", item.Orientation);
                Command.Parameters.AddWithValue("@n1", item.N1);
                Command.Parameters.AddWithValue("@guild", item.GuildID);
                Command.Parameters.AddWithValue("@n2", item.N2);
                Command.Parameters.AddWithValue("@item", item.getItemsId());
                Command.Parameters.AddWithValue("@kamas", item.Kamas);
                Command.Parameters.AddWithValue("@xp", item.XP);

                Command.ExecuteNonQuery();
                Cache.Add(item.ActorId, item);
            }
            catch (Exception e)
            {
                Logger.Error("Can't execute query : " + e.ToString());
            }
        }
Example #2
0
        public static void Update(TaxCollector item)
        {
            try
            {
                MySqlCommand Command = new MySqlCommand()
                {
                    Connection  = DatabaseManager.Provider.getConnection(),
                    CommandText = "UPDATE `taxcollector` set objets = @objets, kamas = @kamas, xp = @xp WHERE guid= @guid;",
                };
                Command.Prepare();
                Command.Parameters.AddWithValue("@objets", item.getItemsId());
                Command.Parameters.AddWithValue("@kamas", item.Kamas);
                Command.Parameters.AddWithValue("@xp", item.XP);
                Command.Parameters.AddWithValue("@guid", item.ActorId);

                Command.ExecuteNonQuery();
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }
        }