Exemplo n.º 1
0
 public AuctionItem()
 {
     ItemID     = 0;
     Stack      = 0;
     Seller     = 0;
     SellerName = "AuctionMoogle";
     Date       = TimeObject.Convert();
     Price      = 0;
     Sale       = 0;
     SaleDate   = TimeObject.Convert();
 }
Exemplo n.º 2
0
        public void BuyItem(AuctionItem item)
        {
            var conn = Connect();

            conn.Open();

            // Set item to sold
            MySqlCommand buy = conn.CreateCommand();

            buy.CommandText = $"UPDATE {item.Table} SET buyer_name=\"AuctionMoogle\", sale={item.Price}, sell_date={TimeObject.Convert()} WHERE id={item.Id};";
            buy.ExecuteNonQueryAsync();
            buy.Dispose();

            conn.Close();

            // Alert console
            Console.WriteLine($"Buying {item.ItemID} from {item.SellerName} for {item.Price}");

            // Send money
            var itemToBuy = new DeliveryBoxItem();

            itemToBuy.CharID   = item.Seller;
            itemToBuy.Quantity = item.Price;

            var con = Connect();

            con.Open();

            MySqlCommand pay = con.CreateCommand();

            pay.CommandText = $"INSERT INTO {itemToBuy.Table} (charid, box, itemid, itemsubid, quantity, sender) " +
                              $"values('{itemToBuy.CharID}','{itemToBuy.Box}','{itemToBuy.ItemID}','{itemToBuy.ItemSubID}','{itemToBuy.Quantity}','{itemToBuy.Sender}');";
            Console.WriteLine($"Giving {itemToBuy.Quantity} Gil to {itemToBuy.CharID}");
            pay.ExecuteNonQueryAsync();
            pay.Dispose();

            con.Close();
        }