public static void addTransaction(Context context, Transaction transaction)
        {
            BillingDB db = new BillingDB(context);

            db.insert(transaction);
            db.close();
        }
 public static List<Transaction> getTransactions(Context context, String itemId)
 {
     BillingDB db = new BillingDB(context);
     ICursor c = db.queryTransactions(itemId);
     List<Transaction> transactions = cursorToList(c);
     db.close();
     return transactions;
 }
        public static List <Transaction> getTransactions(Context context, String itemId)
        {
            BillingDB          db           = new BillingDB(context);
            ICursor            c            = db.queryTransactions(itemId);
            List <Transaction> transactions = cursorToList(c);

            db.close();
            return(transactions);
        }
 public static int countPurchases(Context context, String itemId)
 {
     BillingDB db = new BillingDB(context);
     ICursor c = db.queryTransactions(itemId, PurchaseState.PURCHASED);
     int count = 0;
     if (c != null)
     {
         count = c.Count;
         c.Close();
     }
     db.close();
     return count;
 }
        public static int countPurchases(Context context, String itemId)
        {
            BillingDB db    = new BillingDB(context);
            ICursor   c     = db.queryTransactions(itemId, PurchaseState.PURCHASED);
            int       count = 0;

            if (c != null)
            {
                count = c.Count;
                c.Close();
            }
            db.close();
            return(count);
        }
        private static List <Transaction> cursorToList(ICursor c)
        {
            List <Transaction> transactions = new List <Transaction>();

            if (c != null)
            {
                while (c.MoveToNext())
                {
                    Transaction purchase = BillingDB.createTransaction(c);
                    transactions.Add(purchase);
                }
                c.Close();
            }
            return(transactions);
        }
 public static void addTransaction(Context context, Transaction transaction)
 {
     BillingDB db = new BillingDB(context);
     db.insert(transaction);
     db.close();
 }