public IReportItemDTO Parse(string[] fields, string[] headers) { //string[] fields = line.Split(' '); if (fields.Length < Length) { return(null); } var item = new ItemExDTO(); for (var i = 0; i < fields.Length; i++) { try { var val = UnQuote(fields[i]); switch (i) { case SKU: item.SKU = val; break; case ProductId: item.ASIN = val; break; case ProductIdType: if (val == "upc") { item.Barcode = item.ASIN; item.ASIN = ""; } break; case ParentSKU: item.ParentSKU = val; break; case Parentage: if (val == "child") { item.IsChild = true; } if (val == "parent") { item.IsParent = true; } break; case KeyProductFeatures1: item.Features += val + ";"; break; case KeyProductFeatures2: item.Features += val + ";"; break; case KeyProductFeatures3: item.Features += val + ";"; break; case KeyProductFeatures4: item.Features += val + ";"; break; case KeyProductFeatures5: item.Features += val + ";"; break; case SearchTerm1: item.SearchKeywords += val + ";"; break; case SearchTerm2: item.SearchKeywords += val + ";"; break; case SearchTerm3: item.SearchKeywords += val + ";"; break; case SearchTerm4: item.SearchKeywords += val + ";"; break; case SearchTerm5: item.SearchKeywords += val + ";"; break; } } catch (Exception ex) { _log.Error(string.Format("Unable to parse field: {0}", fields[i]), ex); } } return(item); }
public ItemPriceViewModel(ItemExDTO item) { ItemId = item.Id; Market = item.Market; MarketplaceId = item.MarketplaceId; ListingEntityId = item.ListingEntityId; ParentASIN = item.ParentASIN; SKU = item.SKU; SourceMarketId = item.SourceMarketId; PictureUrl = item.ImageUrl; LargePictureUrl = item.LargeImageUrl; IsFBA = item.IsFBA; EstimatedOrderHandlingFeePerOrder = item.EstimatedOrderHandlingFeePerOrder; EstimatedPickPackFeePerUnit = item.EstimatedPickPackFeePerUnit; EstimatedWeightHandlingFeePerUnit = item.EstimatedWeightHandlingFeePerUnit; StyleId = item.StyleId; StyleItemId = item.StyleItemId; StyleString = item.StyleString; StyleOnHold = item.StyleOnHold ?? false; ASIN = item.ASIN; Size = item.Size; ColorVariation = item.ColorVariation; StyleSize = item.StyleSize; StyleColor = item.StyleColor; Color = item.Color; DisplayQuantity = item.DisplayQuantity; RealQuantity = item.RealQuantity; AutoQuantityUpdateDate = item.AutoQuantityUpdateDate; OnHold = item.OnHold; RestockDate = item.RestockDate; ItemCurrentPrice = item.CurrentPrice; ItemCurrentPriceCurrency = PriceHelper.GetCurrencySymbol((MarketType)item.Market, item.MarketplaceId); //Sale SalePrice = item.SalePrice; SaleStartDate = item.SaleStartDate; SaleEndDate = item.SaleEndDate; MaxPiecesOnSale = item.MaxPiecesOnSale; PiecesSoldOnSale = item.PiecesSoldOnSale; SaleId = item.SaleId; Weight = item.Weight != null?item.Weight.ToString() : ""; Barcode = item.Barcode; WinnerPrice = item.WinnerPrice; WinnerPriceLastChangeDate = item.WinnerPriceLastChangeDate; WinnerPriceLastChangeValue = item.WinnerPriceLastChangeValue; WinnerSalePrice = item.WinnerSalePrice; WinnerSalePriceLastChangeDate = item.WinnerSalePriceLastChangeDate; WinnerSalePriceLastChangeValue = item.WinnerSalePriceLastChangeValue; BuyBoxStatus = item.BuyBoxStatus ?? BuyBoxStatusCode.None; TotalQuantity = item.TotalQuantity; RemainingQuantity = item.RemainingQuantity; IsAmazonParentASIN = item.IsAmazonParentASIN; OpenDate = item.OpenDate ?? item.CreateDate; AmazonRealQuantity = item.AmazonRealQuantity; AmazonCurrentPrice = item.AmazonCurrentPrice; }