Пример #1
0
        private async Task GetInventory()
        {
            try
            {
                _taskProducts = await _billingHandler.QueryInventoryAsync(new List <string>
                {
                    "10_task",
                    "30_task",
                    "70_task",
                    "100_task",
                    "all_task",
                }, ItemType.Product);

                var stringBuilder = new StringBuilder();
                stringBuilder.Append("Task Products: ");
                foreach (var task in _taskProducts)
                {
                    stringBuilder.Append(task.ProductId + " ");
                }

                _bonusProducts = await _billingHandler.QueryInventoryAsync(new List <string>()
                {
                    "10_bonus",
                    "30_bonus",
                    "all_bonus"
                }, ItemType.Product);

                stringBuilder.AppendLine("Bonus Products: ");
                foreach (var bonus in _bonusProducts)
                {
                    stringBuilder.Append(bonus.ProductId + " ");
                }

                ErrorOccur(stringBuilder.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("GetInventory: " + ex.Message);
            }
        }
Пример #2
0
        private async Task GetInventory()
        {
            try
            {
                var ershTaskIds     = GetErshIds(new[] { 10, 30, 70, 100 }, StringConst.Task).ToList();
                var ershBonusIds    = GetErshIds(new[] { 10, 30 }, StringConst.Bonus).ToList();
                var allErshProducts = await _billingHandler.QueryInventoryAsync(ershTaskIds.Union(ershBonusIds).ToList(), ItemType.Product);

                _allErshProducts = allErshProducts == null ? null : allErshProducts.Select(product => new ErshProduct(product)).ToList();

                var taskIds     = GetIds(new[] { 10, 30, 70, 100 }, StringConst.Task).ToList();
                var bonusIds    = GetIds(new[] { 10, 30 }, StringConst.Bonus).ToList();
                var allIds      = taskIds.Union(bonusIds).ToList();
                var allProducts = await _billingHandler.QueryInventoryAsync(allIds, ItemType.Product);

                _allProducts = allProducts == null?null:allProducts.ToList();
            }
            catch (Exception ex)
            {
                GaService.TrackAppException(this.Class, "GetInventory", ex, true);
            }
        }