Exemple #1
0
        public static int AddProductOffer(ProductOffer productOffer)
        {
            int          newProductOfferId = 0;
            const string query             = @"insert into dbo.ProductOffers (OfferId, ProductId, PricePerWeight) 
values (@OfferId, @ProductId, @PricePerWeight);
DECLARE @newProductOfferID int;
   SELECT @newProductOfferID = SCOPE_IDENTITY();
   SELECT @newProductOfferID";

            var connect    = new SqlConnection(connStr);
            var sqlCommand = new SqlCommand(query, connect);
            var parameters = sqlCommand.Parameters;

            AddAddOrUpdateSqlParameters(parameters, productOffer);

            try
            {
                connect.Open();
                newProductOfferId = (int)sqlCommand.ExecuteScalar();
            }
            catch (Exception ex)
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                throw new Exception("in ProductOffersDAL." + methodName + "(): " + ex);
            }
            finally
            {
                connect.Close();
            }

            return(newProductOfferId);
        }
Exemple #2
0
        public static int UpdateProductOffer(ProductOffer productOffer)
        {
            const string query = "update dbo.ProductOffers set OfferId=@OfferId, ProductId=@ProductId, PricePerWeight=@PricePerWeight where Id=@Id";

            var connect    = new SqlConnection(connStr);
            var sqlCommand = new SqlCommand(query, connect);

            sqlCommand.Parameters.AddWithValue("Id", productOffer.Id);
            AddAddOrUpdateSqlParameters(sqlCommand.Parameters, productOffer);

            try
            {
                connect.Open();
                sqlCommand.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                string methodName = MethodBase.GetCurrentMethod().Name;
                throw new Exception("in ProductOffersDAL." + methodName + "(): " + ex);
            }
            finally
            {
                connect.Close();
            }

            return(productOffer.Id);
        }
Exemple #3
0
        public async Task TestGetProduct_ElastiCache_SingleSkuFromOffer()
        {
            // ARRANGE
            string sku = "HBRQZSXXSY2DXJ77";

            PriceListClient client = new PriceListClient();

            GetProductRequest request = new GetProductRequest("AmazonElastiCache")
            {
                Format = Format.JSON
            };

            GetProductResponse response = await client.GetProductAsync(request);

            ProductOffer ecOffer = response.ProductOffer;

            // ACT

            IEnumerable <IGrouping <string, PricingTerm> > groupedTerms = ecOffer.Terms
                                                                          .SelectMany(x => x.Value) // Get all of the product item dictionaries from on demand and reserved
                                                                                                    //.Where(x => ApplicableProductSkus.Contains(x.Key)) // Only get the pricing terms for products we care about
                                                                          .SelectMany(x => x.Value) // Get all of the pricing term key value pairs
                                                                          .Select(x => x.Value)     // Get just the pricing terms
                                                                          .GroupBy(x => x.Sku);     // Put all of the same skus together

            IGrouping <string, PricingTerm> skuTerms = groupedTerms.First(x => x.Key.Equals(sku));

            // ASSERT
            Assert.True(skuTerms.Where(x => x.TermAttributes.PurchaseOption == PurchaseOption.ON_DEMAND).Count() == 1);
        }
        public ActionResult Create()
        {
            //static polymorphism overloading
            System.Diagnostics.Debug.WriteLine("without parameters");
            ProductOffer productOffer = new ProductOffer();

            return(View(productOffer));
        }
Exemple #5
0
        public IActionResult InsertOffer(OfferInsertDto offerInsert)
        {
            try
            {
                ParamValidator validator = new ParamValidator();
                validator.ValidateNull(offerInsert.FromDate, General.Messages_.NullInputMessages_.GeneralNullMessage("از تاریخ"))
                .ValidateNull(offerInsert.ToDate, General.Messages_.NullInputMessages_.GeneralNullMessage("تا تاریخ"))
                .ValidateNull(offerInsert.Name, General.Messages_.NullInputMessages_.GeneralNullMessage("عنوان"))
                .ValidateNull(offerInsert.Value, General.Messages_.NullInputMessages_.GeneralNullMessage("مقدار تخفیف"))
                .ValidateNull(offerInsert.MaximumPrice, General.Messages_.NullInputMessages_.GeneralNullMessage("حداکثر قیمت"))
                .ValidateNull(offerInsert.OfferTypeId, General.Messages_.NullInputMessages_.GeneralNullMessage("نوع تخفیف"))
                .ValidateNull(offerInsert.OfferCode, General.Messages_.NullInputMessages_.GeneralNullMessage("کد تخفیف"))
                .Throw(General.Results_.FieldNullErrorCode());

                var offer = new Offer
                {
                    Cdate        = DateTime.Now.Ticks,
                    CuserId      = ClaimPrincipalFactory.GetUserId(User),
                    Description  = offerInsert.Description,
                    FromDate     = offerInsert.FromDate?.Ticks ?? 0,
                    HaveTimer    = offerInsert.HaveTimer,
                    MaximumPrice = offerInsert.MaximumPrice,
                    Name         = offerInsert.Name,
                    OfferCode    = offerInsert.OfferCode,
                    OfferTypeId  = offerInsert.OfferTypeId,
                    ToDate       = offerInsert.ToDate?.Ticks ?? 0,
                    Value        = offerInsert.Value
                };
                offerInsert.ProductIdList.ForEach(c =>
                {
                    var productOffer = new ProductOffer
                    {
                        Cdate      = DateTime.Now.Ticks,
                        CuserId    = ClaimPrincipalFactory.GetUserId(User),
                        ProductId  = c,
                        Value      = offerInsert.Value,
                        FromDate   = offerInsert.FromDate?.Ticks ?? 0,
                        ToDate     = offerInsert.ToDate?.Ticks ?? 0,
                        LanguageId = offerInsert.LanguageId
                    };
                    offer.ProductOffer.Add(productOffer);
                });
                _repository.Offer.Create(offer);
                _repository.Save();
                _logger.LogData(MethodBase.GetCurrentMethod(), offer.Id, null, offerInsert);
                return(Ok(offer.Id));
            }
            catch (Exception e)
            {
                _logger.LogError(e, MethodBase.GetCurrentMethod(), offerInsert);
                return(BadRequest(e.Message));
            }
        }
Exemple #6
0
        private static ProductOffer ReadProductOfferInfo(SqlDataReader reader)
        {
            var result = new ProductOffer
            {
                Id             = (int)reader["Id"],
                OfferId        = (int)reader["OfferId"],
                ProductId      = (int)reader["ProductId"],
                PricePerWeight = float.Parse(reader["PricePerWeight"].ToString())
            };

            return(result);
        }
        public ActionResult Delete(string Id)
        {
            ProductOffer productOfferToDelete = context.Find(Id);

            if (productOfferToDelete == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(productOfferToDelete));
            }
        }
        public ActionResult Edit(string Id)
        {
            ProductOffer productOffer = context.Find(Id);

            if (productOffer == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(productOffer));
            }
        }
        public ActionResult ConfirmDelete(string Id)
        {
            ProductOffer offerToDelete = context.Find(Id);

            if (offerToDelete == null)
            {
                return(HttpNotFound());
            }
            else
            {
                context.Delete(Id);
                context.Commit();
                return(RedirectToAction("Index"));
            }
        }
        public void Setup()
        {
            var percentageProductOnOffer = ProductFactory.CreateProduct(ProductType.Bread, 1);
            var conditionForOffer        = ProductFactory.CreateProduct(ProductType.Butter, 2);
            var percentageOffer          = new PercentageOffer(percentageProductOnOffer, conditionForOffer, 50);

            var productOnOffer = ProductFactory.CreateProduct(ProductType.Milk, 4);
            var productOffer   = new ProductOffer(productOnOffer, productOnOffer.Price);

            var offers = new List <IOffer>
            {
                percentageOffer,
                productOffer
            };

            _basket = new Basket(offers);
        }
Exemple #11
0
        public void TestGetProduct_AmazonRedshift_FromJsonFile()
        {
            // ARRANGE
            using (FileStream stream = File.OpenRead("AmazonRedshift.json"))
            {
                byte[] bytes = new byte[stream.Length];

                stream.Read(bytes, 0, bytes.Length);

                string json = Encoding.UTF8.GetString(bytes);

                // ACT
                ProductOffer offer = ProductOffer.FromJson(json);

                // ASSERT
                Assert.NotNull(offer);
            }
        }
Exemple #12
0
        public async Task TestGetProduct_ECS_FromJsonContentStream()
        {
            // ARRANGE
            PriceListClient client = new PriceListClient();

            GetProductRequest request = new GetProductRequest("AmazonECS")
            {
                Format = Format.JSON
            };

            // ACT
            GetProductResponse response = await client.GetProductAsync(request);

            ProductOffer offer = ProductOffer.FromJsonStream(response.Content);

            // ASSERT
            Assert.NotNull(offer);
        }
Exemple #13
0
        public async Task TestGetProduct_EC2()
        {
            // ARRANGE
            PriceListClient client = new PriceListClient();

            GetProductRequest request = new GetProductRequest("AmazonEC2")
            {
                Format = Format.JSON
            };

            // ACT
            GetProductResponse response = await client.GetProductAsync(request);

            ProductOffer ec2Offer = response.ProductOffer;

            // ASSERT
            Assert.NotNull(ec2Offer);
        }
Exemple #14
0
        public async Task TestGetProduct_AmazonDynamoDB_FromJsonContentStream()
        {
            // ARRANGE
            PriceListClient client = new PriceListClient();

            GetProductRequest request = new GetProductRequest("AmazonDynamoDB")
            {
                Format = Format.JSON
            };

            GetProductResponse response = await client.GetProductAsync(request);

            // ACT
            ProductOffer ddbOffer = ProductOffer.FromJsonStream(response.Content);

            // ASSERT
            Assert.NotNull(ddbOffer);
            Assert.True(!String.IsNullOrEmpty(ddbOffer.Version));
        }
        public ActionResult Create(ProductOffer productOffer)
        {
            if (string.IsNullOrEmpty(productOffer.Offer))
            {
                ModelState.AddModelError("Offer", "Offer field is required");
            }
            //static polymorphism overloading
            System.Diagnostics.Debug.WriteLine("with parameters");
            if (!ModelState.IsValid)
            {
                return(View(productOffer));
            }
            else
            {
                context.Insert(productOffer);
                context.Commit();

                return(RedirectToAction("Index"));
            }
        }
Exemple #16
0
        private OfferListViewModel OffersToOfferListViewModel(OfferListPart offerListPart, Offers offers)
        {
            var offerListViewModel = new OfferListViewModel {
                Title = offerListPart.Title
            };

            if (offers == null || offers.Offer == null)
            {
                return(offerListViewModel);
            }

            var offer = offers.Offer.FirstOrDefault(o => o.ProductOffers != null && o.ProductOffers.ProductOffer != null && o.ProductOffers.ProductOffer.Length > 0) ??
                        offers.Offer[0];

            offerListViewModel.Title      = offerListPart.Title;
            offerListViewModel.Id         = offer.Id;
            offerListViewModel.Name       = offer.Name;
            offerListViewModel.Type       = offer.Type;
            offerListViewModel.Image      = offer.Image;
            offerListViewModel.SalesPitch = offer.SalesPitch;
            if (offer.ProductOffers == null || offer.ProductOffers.ProductOffer == null)
            {
                return(offerListViewModel);
            }

            if (offer.ProductOffers.ProductOffer.Length > offerListPart.MaxNProducts)
            {
                var limitedProductOffers = new ProductOffer[offerListPart.MaxNProducts];
                for (var i = 0; i < offerListPart.MaxNProducts; i++)
                {
                    limitedProductOffers[i] = offer.ProductOffers.ProductOffer[i];
                }
                offerListViewModel.ProductOfferViewModels = limitedProductOffers.Select(po => ProductOfferToProductOfferViewModel(offer.Id, po)).ToArray();
            }
            else
            {
                offerListViewModel.ProductOfferViewModels = offer.ProductOffers.ProductOffer.Select(po => ProductOfferToProductOfferViewModel(offer.Id, po)).ToArray();
            }
            return(offerListViewModel);
        }
Exemple #17
0
        public async Task TestGetProduct_ECS_FromJsonString()
        {
            // ARRANGE
            PriceListClient client = new PriceListClient();

            GetProductRequest request = new GetProductRequest("AmazonECS")
            {
                Format = Format.JSON
            };

            // ACT
            GetProductResponse response = await client.GetProductAsync(request);

            bool success = response.TryGetResponseContentAsString(out string productInfo);

            // ASSERT
            Assert.True(success);

            ProductOffer offer = ProductOffer.FromJson(productInfo);

            Assert.NotNull(offer);
        }
Exemple #18
0
        public void TestGetProduct_EC2ReservedHost_FromJsonFile()
        {
            // ARRANGE
            string sku = "R788QK3FA3RPDDXZ";

            string json = File.ReadAllText("ReservedHostEC2.json");

            ProductOffer ec2Offer = ProductOffer.FromJson(json);

            // ACT

            IEnumerable <IGrouping <string, PricingTerm> > groupedTerms = ec2Offer.Terms
                                                                          .SelectMany(x => x.Value) // Get all of the product item dictionaries from on demand and reserved
                                                                                                    //.Where(x => ApplicableProductSkus.Contains(x.Key)) // Only get the pricing terms for products we care about
                                                                          .SelectMany(x => x.Value) // Get all of the pricing term key value pairs
                                                                          .Select(x => x.Value)     // Get just the pricing terms
                                                                          .GroupBy(x => x.Sku);     // Put all of the same skus together

            IGrouping <string, PricingTerm> skuTerms = groupedTerms.First(x => x.Key.Equals(sku));

            // ASSERT
            Assert.True(skuTerms.Where(x => x.TermAttributes.PurchaseOption == PurchaseOption.ON_DEMAND).Count() == 0);
        }
        public int Create(CreateProductOfferInputModel input, string currentUserId)
        {
            if (_offersRepository.ExistsByName(input.Name))
            {
                throw new ArgumentException("Offer with this name exists");
            }

            IEnumerable <Product> selectedProducts = _productsRepository.GetByIds(input.Products);

            Offer offer = new Offer
            {
                Name       = input.Name,
                TotalPrice = decimal.Round(input.TotalPrice),
                Discount   = input.Discount,
                ExpiryDate = DateTime.ParseExact(input.ExpiryDate, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture),
                Image      = input.ImageUrl,
                AddedById  = currentUserId,
                IsActive   = input.IsActive
            };

            _offersRepository.Add(offer);
            _offersRepository.SaveChanges();

            foreach (var selectedProduct in selectedProducts)
            {
                ProductOffer po = new ProductOffer
                {
                    OfferId   = offer.Id,
                    ProductId = selectedProduct.Id
                };

                _productOffersRepository.Add(po);
                _productOffersRepository.SaveChanges();
            }

            return(offer.Id);
        }
 public void Update(ProductOffer item)
 {
     _context.ProductOffers.Update(item);
 }
Exemple #21
0
        private ProductOfferViewModel ProductOfferToProductOfferViewModel(long offerId, ProductOffer productOffer)
        {
            var productOfferViewModel = new ProductOfferViewModel();

            productOfferViewModel.InjectFrom(productOffer);
            if (productOffer.Product != null)
            {
                productOfferViewModel.ProductLink   = _linkGenerator.GenerateProductLink(productOffer.Product.Id);
                productOfferViewModel.AddToCartLink = MakeAddToCartLink(productOffer.Product.Id, offerId);
            }
            return(productOfferViewModel);
        }
        public void SetUp()
        {
            var productOnOffer = ProductFactory.CreateProduct(ProductType.Milk, 4);

            _productOffer = new ProductOffer(productOnOffer, productOnOffer.Price);
        }
Exemple #23
0
 public static ProductOffer CreateNewProductOffer( Product product, Offer offer )
 {
     var result = new ProductOffer {
     Id = Guid.NewGuid(),
     Offer = offer,
     Product = product
       };
       return result;
 }
Exemple #24
0
 private static void AddAddOrUpdateSqlParameters(SqlParameterCollection parameters, ProductOffer productOffer)
 {
     parameters.AddWithValue("OfferId", productOffer.OfferId);
     parameters.AddWithValue("ProductId", productOffer.ProductId);
     parameters.AddWithValue("PricePerWeight", productOffer.PricePerWeight);
 }
 public void Add(ProductOffer item)
 {
     this._context.ProductOffers.Add(item);
 }
 /// <summary>
 /// Helper method to add a product to a cart
 /// </summary>
 /// <param name="cartGuid">Guid of the cart if existing. Null if creating a new cart</param>
 /// <param name="product">Product to add to the cart</param>
 /// <param name="offer">Product specific offer to add to the cart</param>
 /// <param name="quantity">Quantity of the product to add</param>
 /// <returns>Cart reference</returns>
 public Task <PushToCartResponse> PushToCartAsync(Guid?cartGuid, Product product, ProductOffer offer, int quantity)
 {
     return(PushToCartAsync(cartGuid, product, offer, null, quantity));
 }
        /// <summary>
        /// Helper method to add a product to a cart
        /// </summary>
        /// <param name="cartGuid">Guid of the cart if existing. Null if creating a new cart</param>
        /// <param name="product">Product to add to the cart</param>
        /// <param name="offer">Product specific offer to add to the cart</param>
        /// <param name="size">Specific size of the product to use (if applicable)</param>
        /// <param name="quantity">Quantity of the product to add</param>
        /// <returns>Cart reference</returns>
        public Task <PushToCartResponse> PushToCartAsync(Guid?cartGuid, Product product, ProductOffer offer, ProductSize size, int quantity)
        {
            if (product == null)
            {
                throw new ArgumentNullException(nameof(product), "The product must not be null");
            }

            if (quantity < 1 || quantity > 12)
            {
                throw new ArgumentOutOfRangeException(nameof(quantity), "The quantity must be an integer between 1 and 12");
            }

            PushToCartRequest pushToCartRequest = new PushToCartRequest()
            {
                ProductId = product.Id,
                Quantity  = quantity
            };

            if (cartGuid != Guid.Empty)
            {
                pushToCartRequest.CartGuid = cartGuid;
            }

            if (offer != null)
            {
                pushToCartRequest.OfferId = offer.Id;

                if (offer.Seller != null)
                {
                    pushToCartRequest.SellerId = offer.Seller.Id;
                }
            }

            if (size != null)
            {
                pushToCartRequest.SizeId = size.Id;
            }

            return(PushToCartAsync(pushToCartRequest));
        }
 /// <summary>
 /// Helper method to add a product to a cart
 /// </summary>
 /// <param name="cartGuid">Guid of the cart if existing. Null if creating a new cart</param>
 /// <param name="product">Product to add to the cart</param>
 /// <param name="offer">Product specific offer to add to the cart</param>
 /// <param name="size">Specific size of the product to use (if applicable)</param>
 /// <returns>Cart reference</returns>
 public Task <PushToCartResponse> PushToCartAsync(Guid?cartGuid, Product product, ProductOffer offer, ProductSize size)
 {
     return(PushToCartAsync(cartGuid, product, offer, size, 1));
 }
Exemple #29
0
        public IActionResult UpdateOffer(OfferInsertDto offerInsert)
        {
            try
            {
                var validator = new ParamValidator();
                validator.ValidateNull(offerInsert.FromDate, General.Messages_.NullInputMessages_.GeneralNullMessage("از تاریخ"))
                .ValidateNull(offerInsert.Id, General.Messages_.NullInputMessages_.GeneralNullMessage("آیدی"))
                .ValidateNull(offerInsert.ToDate, General.Messages_.NullInputMessages_.GeneralNullMessage("تا تاریخ"))
                .ValidateNull(offerInsert.Name, General.Messages_.NullInputMessages_.GeneralNullMessage("عنوان"))
                .ValidateNull(offerInsert.Value, General.Messages_.NullInputMessages_.GeneralNullMessage("مقدار تخفیف"))
                .ValidateNull(offerInsert.MaximumPrice, General.Messages_.NullInputMessages_.GeneralNullMessage("حداکثر قیمت"))
                .ValidateNull(offerInsert.OfferTypeId, General.Messages_.NullInputMessages_.GeneralNullMessage("نوع تخفیف"))
                .ValidateNull(offerInsert.OfferCode, General.Messages_.NullInputMessages_.GeneralNullMessage("کد تخفیف"))
                .Throw(General.Results_.FieldNullErrorCode());

                var offer = _repository.Offer.FindByCondition(c => c.Id == offerInsert.Id).FirstOrDefault();
                if (offer == null)
                {
                    throw new BusinessException(XError.GetDataErrors.NotFound());
                }

                offer.Mdate        = DateTime.Now.Ticks;
                offer.MuserId      = ClaimPrincipalFactory.GetUserId(User);
                offer.Description  = offerInsert.Description;
                offer.FromDate     = offerInsert.FromDate?.Ticks ?? 0;
                offer.HaveTimer    = offerInsert.HaveTimer;
                offer.MaximumPrice = offerInsert.MaximumPrice;
                offer.Name         = offerInsert.Name;
                offer.OfferCode    = offerInsert.OfferCode;
                offer.OfferTypeId  = offerInsert.OfferTypeId;
                offer.ToDate       = offerInsert.ToDate?.Ticks ?? 0;
                offer.Value        = offerInsert.Value;

                var deletedPRoductOffer = _repository.ProductOffer.FindByCondition(c => c.OfferId == offerInsert.Id)
                                          .ToList();
                deletedPRoductOffer.ForEach(c =>
                {
                    _repository.ProductOffer.Delete(c);
                });



                offerInsert.ProductIdList.ForEach(c =>
                {
                    var productOffer = new ProductOffer
                    {
                        Cdate      = DateTime.Now.Ticks,
                        CuserId    = ClaimPrincipalFactory.GetUserId(User),
                        ProductId  = c,
                        Value      = offerInsert.Value,
                        FromDate   = offerInsert.FromDate?.Ticks ?? 0,
                        ToDate     = offerInsert.ToDate?.Ticks ?? 0,
                        LanguageId = offerInsert.LanguageId
                    };
                    offer.ProductOffer.Add(productOffer);
                });
                _repository.Offer.Update(offer);
                _repository.Save();
                _logger.LogData(MethodBase.GetCurrentMethod(), General.Results_.SuccessMessage(), null, offerInsert);
                return(Ok(General.Results_.SuccessMessage()));
            }
            catch (Exception e)
            {
                _logger.LogError(e, MethodBase.GetCurrentMethod(), offerInsert);
                return(BadRequest(e.Message));
            }
        }
Exemple #30
0
        /// <summary>
        /// Converts the price list data from json into our formatted csv
        /// </summary>
        /// <param name="json"></param>
        /// <param name="writer"></param>
        private async Task GetFromJson(Stream json, CsvWriter writer)
        {
            json.Position = 0;
            ProductOffer offer = ProductOffer.FromJsonStream(json);

            /*
             *  Old implementation, don't need such a complex grouping, just iterate
             *  every sku in the reserved terms and only process the ones that have a matching
             *  product and on demand term
             *
             *   Hashset<string> ApplicableProductSkus = new Hashset<string>(Offer.Terms[Term.RESERVED].Keys)
             *
             *   foreach (IGrouping<string, PricingTerm> CommonSkus in Offer.Terms
             *          .SelectMany(x => x.Value) // Get all of the product item dictionaries from on demand and reserved
             *          .Where(x => ApplicableProductSkus.Contains(x.Key)) // Only get the pricing terms for products we care about
             *          .SelectMany(x => x.Value) // Get all of the pricing term key value pairs
             *          .Select(x => x.Value) // Get just the pricing terms
             *          .GroupBy(x => x.Sku)) // Put all of the same skus together
             *   {
             *       try
             *       {
             *           IEnumerable<ReservedInstancePricingTerm> Terms = ReservedInstancePricingTerm.Build2(CommonSkus, Offer.Products[CommonSkus.Key]);
             *           writer.WriteRecords<ReservedInstancePricingTerm>(Terms);
             *       }
             *       catch (Exception e)
             *       {
             *           this._Context.LogError(e);
             *       }
             *   }
             */

            foreach (string Sku in offer.Terms[Term.RESERVED].Keys)
            {
                if (!offer.Products.ContainsKey(Sku))
                {
                    _context.LogWarning($"There is no product that matches the Sku {Sku}.");
                    continue;
                }

                if (!offer.Terms[Term.ON_DEMAND].ContainsKey(Sku))
                {
                    _context.LogWarning($"There is no on-demand pricing term for sku {Sku}.");
                    continue;
                }

                try
                {
                    IEnumerable <ReservedInstancePricingTerm> terms = ReservedInstancePricingTerm.Build(
                        offer.Products[Sku],                                     // The product
                        offer.Terms[Term.ON_DEMAND][Sku].FirstOrDefault().Value, // OnDemand PricingTerm
                        offer.Terms[Term.RESERVED][Sku].Select(x => x.Value)     // IEnumerable<PricingTerm> Reserved Terms
                        );

                    writer.WriteRecords <ReservedInstancePricingTerm>(terms);
                }
                catch (Exception e)
                {
                    _context.LogError(e);
                    await SNSNotify(e, _context);

                    throw e;
                }
            }
        }
 public void Delete(ProductOffer item)
 {
     item.IsDeleted = true;
     Update(item);
 }