public void Delete(GeneralItem generalItems)
 {
     try {
         StatementValue where = new StatementValue ();
         where.Item1 = "id = @StatementValue0";
         where.Item2 = new List<string> ();
         where.Item2.Add (generalItems.Id.ToString ());
         this.Delete (where);
     } catch (MySqlException ex) {
         switch (ex.Number) {
         case 0:
             throw new DatabaseException ("Cannot connect to server.  Contact administrator", ex);
         case 1045:
             throw new DatabaseException ("Invalid username/password, please try again", ex);
         default:
             throw new DatabaseException (ex.Message, ex);
         }
     }
 }
 public void Add(Player player, GeneralItem item, int quantity)
 {
     try {
         List<ColumnValue> columns = new List<ColumnValue> ();
         columns.Add (new ColumnValue () { Item1 = "playerId", Item2 = player.Id.ToString() });
         columns.Add (new ColumnValue () { Item1 = "generalItemId", Item2 = item.Id.ToString() });
         columns.Add (new ColumnValue () { Item1 = "quantity", Item2 = quantity.ToString() });
         this.Insert (columns);
     } catch (MySqlException ex) {
         switch (ex.Number) {
         case 0:
             throw new DatabaseException ("Cannot connect to server.  Contact administrator", ex);
         case 1045:
             throw new DatabaseException ("Invalid username/password, please try again", ex);
         default:
             throw new DatabaseException (ex.Message, ex);
         }
     }
 }
 public void Add(GeneralItem generalItem)
 {
     try {
         ColumnValue id = new ColumnValue () { Item1 = "id", Item2 = generalItem.Id.ToString() };
         ColumnValue name = new ColumnValue () { Item1 = "name", Item2 = generalItem.Name };
         ColumnValue iconId = new ColumnValue () { Item1 = "iconId", Item2 = generalItem.IconId.ToString() };
         List<ColumnValue> columns = new List<ColumnValue> ();
         columns.Add (id);
         columns.Add (name);
         columns.Add (iconId);
         this.Insert (columns);
     } catch (MySqlException ex) {
         switch (ex.Number) {
         case 0:
             throw new DatabaseException ("Cannot connect to server.  Contact administrator", ex);
         case 1045:
             throw new DatabaseException ("Invalid username/password, please try again", ex);
         default:
             throw new DatabaseException (ex.Message, ex);
         }
     }
 }
        public void Save(Player player, GeneralItem item, int quantity)
        {
            try {
                List<ColumnValue> columns = new List<ColumnValue> ();
                columns.Add (new ColumnValue () { Item1 = "quantity", Item2 = quantity.ToString() });

                StatementValue where = new StatementValue ();
                where.Item1 = "playerId = @StatementValue0 AND generalItemId = @StatementValue1";
                where.Item2 = new List<string> ();
                where.Item2.Add (player.Id.ToString ());
                where.Item2.Add (item.Id.ToString ());

                this.Update (columns, where);
            } catch (MySqlException ex) {
                switch (ex.Number) {
                case 0:
                    throw new DatabaseException ("Cannot connect to server.  Contact administrator", ex);
                case 1045:
                    throw new DatabaseException ("Invalid username/password, please try again", ex);
                default:
                    throw new DatabaseException (ex.Message, ex);
                }
            }
        }