public static IList <ExcelProductUKViewModel> GenerateToExcelUK(IUnitOfWork db, IBarcodeService barcodeService, IMarketCategoryService categoryService, StyleViewModel model, DateTime when, out string filename) { var gbpExchangeRate = PriceHelper.GBPtoUSD; var models = new List <ExcelProductUKViewModel>(); var parent = new ExcelProductUKViewModel(); var childs = new List <ExcelProductUKViewModel>(); var sizes = model.StyleItems.Items; //Size Group, Size Range var hasKids2 = sizes.Any(s => ItemExportHelper.GetSizeGroupByName(s.SizeGroupName, true) == ExportSizeGroup.Kids2); ExportSizeGroup?sizeGroup = sizes.Any() ? (ExportSizeGroup?)ItemExportHelper.GetSizeGroupByName(sizes.Last().SizeGroupName, false) : null; var sizeGroupName = ItemExportHelper.GetSizeGroupName(sizeGroup); var sizeRange = ItemExportHelper.GetSizeRangeName(sizes.Select(s => s.Size).ToList(), hasKids2); var firstSize = sizes.Any() ? sizes[0].Size : String.Empty; //Features Values var features = model.Features.Select(f => new FeatureValueDTO() { FeatureId = f.FeatureId, Value = f.Value, }).ToList(); var allFeatureValues = db.FeatureValues.GetAllFeatureValueByItemType(1); var gender = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.GENDER); var itemStyle = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.ITEMSTYLE); var sleeve = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SLEEVE); var material = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MATERIAL); var color1 = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.COLOR1); var mainLicense = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.MAIN_LICENSE); var subLicense = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SUB_LICENSE1); //var shippingSize = ItemExportHelper.GetFeatureValue(features, allFeatureValues, StyleFeatureHelper.SHIPPING_SIZE); var materialComposition = ItemExportHelper.GetFeatureTextValue(features, StyleFeatureHelper.MATERIAL_COMPOSITION); var sizeType = ItemExportHelper.GetSizeType(firstSize); var categoryInfo = categoryService.GetCategory(MarketType.AmazonEU, MarketplaceKeeper.AmazonUkMarketplaceId, itemStyle, gender, sizeType); //var itemType = ItemExportHelper.GetItemType(itemStyle); var brandName = ItemExportHelper.GetBrandName(mainLicense, subLicense); var newItemType = categoryInfo.Key1;// ItemExportHelper.ItemTypeConverter(firstSize ?? "", itemType, itemStyle, gender); var newDepartment = StringHelper.GetFirstNotEmpty(categoryInfo.Key2, ItemExportHelper.DepartmentConverter(gender, newItemType, sizeType)); var searchTerms = model.SearchTerms; // ItemExportHelper.BuildSearchTerms(itemStyle, material, sleeve); var keyFeatures = model.GetBulletPoints(); // ItemExportHelper.BuildKeyFeatures(mainLicense, subLicense, material); var hasCotton = StringHelper.GetInOneOfStrings("Cotton", new List <string>() { searchTerms, model.Name, model.Description, material }); if (String.IsNullOrEmpty(materialComposition)) { if (hasCotton) { materialComposition = "Cotton"; } else { materialComposition = "Polyester"; } } //-------------------------- //Parent item //-------------------------- parent.SKU = model.StyleId; parent.ASIN = ""; parent.Title = model.Name + "," + (!String.IsNullOrEmpty(sizeGroupName) ? " " + ItemExportHelper.FormatSizeGroupName(sizeGroupName) : String.Empty) + " " + sizeRange; //If it causes name length to exceed maximum allowed, please drop words “Kids” or Toddler” var inlcudeSizeGroup = true; if (parent.Title.Length > ItemExportHelper.MaxItemNameLength) { parent.Title = model.Name + ", " + sizeRange; inlcudeSizeGroup = false; } parent.ProductId = ""; parent.BrandName = brandName; parent.ClothingType = "sleepwear"; // = newItemType; var images = new List <string>(); var swatchImage = ""; if (model.ImageSet != null) { images = model.ImageSet.Images .Where(im => im.Category != (int)StyleImageCategories.Swatch) .OrderByDescending(im => ImageHelper.GetSortIndex(im.Category)) .ThenByDescending(im => im.IsDefault) .ThenBy(im => im.Id) .Select(im => im.ImageUrl) .ToList(); swatchImage = model.ImageSet.Images .FirstOrDefault(im => im.Category == (int)StyleImageCategories.Swatch)?.ImageUrl; parent.MainImageURL = images.Count > 0 ? images[0] : ""; parent.OtherImageUrl1 = images.Count > 1 ? images[1] : ""; parent.OtherImageUrl2 = images.Count > 2 ? images[2] : ""; parent.OtherImageUrl3 = images.Count > 3 ? images[3] : ""; //parent.SwatchImageUrl = swatchImage; } parent.Color = ""; parent.Department = newDepartment; parent.Size = ""; parent.MaterialComposition = materialComposition; parent.Description = model.Description; parent.Update = "Update"; parent.StandardPrice = ""; //parent.SuggestedPrice = model.MSRP.ToString("G"); parent.Currency = "GBP"; parent.Quantity = ""; parent.RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, firstSize, newItemType); parent.SearchTerms1 = searchTerms; parent.KeyProductFeatures1 = keyFeatures.Count > 0 ? keyFeatures[0] : ""; parent.KeyProductFeatures2 = keyFeatures.Count > 1 ? keyFeatures[1] : ""; parent.KeyProductFeatures3 = keyFeatures.Count > 2 ? keyFeatures[2] : ""; parent.KeyProductFeatures4 = keyFeatures.Count > 3 ? keyFeatures[3] : ""; parent.KeyProductFeatures5 = keyFeatures.Count > 4 ? keyFeatures[4] : ""; parent.Parentage = "Parent"; parent.ParentSKU = ""; parent.RelationshipType = ""; parent.VariationTheme = "Size"; //-------------------------- //Child items //-------------------------- foreach (var size in sizes) { var child = new ExcelProductUKViewModel(); child.SKU = model.StyleId + "-" + ItemExportHelper.ConvertSizeForStyleId(size.Size, hasKids2); if (size.AutoGeneratedBarcode) { var newBarcode = BarcodeHelper.GenerateBarcode(barcodeService, child.SKU, when); if (!String.IsNullOrEmpty(newBarcode)) { if (size.Barcodes == null) { size.Barcodes = new List <BarcodeDTO>(); } size.Barcodes.Insert(0, new BarcodeDTO() { Barcode = newBarcode }); } } child.UPC = (size.Barcodes != null && size.Barcodes.Any()) ? size.Barcodes.FirstOrDefault().Barcode : String.Empty; child.Title = model.Name + "," + (inlcudeSizeGroup ? " " + ItemExportHelper.FormatSizeGroupName(size.SizeGroupName) : "") + " Size " + ItemExportHelper.ConvertSizeForItemName(size.Size, hasKids2); child.ProductId = "UPC"; child.BrandName = brandName; child.ClothingType = "sleepwear";// newItemType; child.MainImageURL = images.Count > 0 ? images[0] : ""; child.OtherImageUrl1 = images.Count > 1 ? images[1] : ""; child.OtherImageUrl2 = images.Count > 2 ? images[2] : ""; child.OtherImageUrl3 = images.Count > 3 ? images[3] : ""; //child.SwatchImageUrl = swatchImage; child.Color = ItemExportHelper.PrepareColor(String.IsNullOrEmpty(size.Color) ? color1 : size.Color); child.Department = newDepartment; child.Size = ExcelProductUKViewModel.SizeConverter(size.Size, material); child.MaterialComposition = materialComposition; child.Description = model.Description; child.Update = "Update"; child.StandardPrice = PriceHelper.Convert(model.Price, gbpExchangeRate, true).ToString("G"); //child.SuggestedPrice = model.MSRP.ToString("G"); child.Currency = "GBP"; child.Quantity = size.Quantity.ToString(); child.RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, child.Size, newItemType); child.KeyProductFeatures1 = parent.KeyProductFeatures1; child.KeyProductFeatures2 = parent.KeyProductFeatures2; child.KeyProductFeatures3 = parent.KeyProductFeatures3; child.KeyProductFeatures4 = parent.KeyProductFeatures4; child.KeyProductFeatures5 = parent.KeyProductFeatures5; child.SearchTerms1 = parent.SearchTerms1; //child.SearchTerms2 = parent.SearchTerms2; //child.SearchTerms3 = parent.SearchTerms3; //child.SearchTerms4 = parent.SearchTerms4; //child.SearchTerms5 = parent.SearchTerms5; child.Parentage = "Child"; child.ParentSKU = parent.SKU; child.RelationshipType = "Variation"; child.VariationTheme = "Size"; childs.Add(child); } models.Add(parent); models.AddRange(childs); filename = model.StyleId + "_" + subLicense; filename = filename.Replace(" ", "") + "_UK.xls"; return(models); //ExcelHelper.ExportIntoFile(HttpContext.Current.Server.MapPath(UKTemplatePath), models); }
public static IList <ExcelProductCAViewModel> GetItemsFor(ILogService log, ITime time, IMarketCategoryService categoryService, IHtmlScraperService htmlScraper, IMarketApi marketApi, IUnitOfWork db, CompanyDTO company, string parentAsin, MarketType market, string marketplaceId, UseStyleImageModes useStyleImageMode, out string filename) { var caExchangeRate = PriceHelper.CADtoUSD; var today = time.GetAppNowTime(); var models = new List <ExcelProductCAViewModel>(); var items = ItemExportHelper.GetParentItemAndChilds(log, time, htmlScraper, marketApi, db, company, parentAsin, null, ExportToExcelMode.Normal, market, marketplaceId); var parent = items.Item1; // db.ParentItems.GetAsDTO(asin); var children = items.Item2; // db.Items.GetAllActualExAsDto().Where(i => i.ParentASIN == asin).ToList(); var firstChild = children.FirstOrDefault(); FeatureValueDTO subLicense = null; string itemStyle = null; if (firstChild != null && firstChild.StyleId.HasValue) { //style = db.Styles.Get(parent.StyleId.Value); subLicense = db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.SUB_LICENSE1); itemStyle = ItemExportHelper.GetFeatureValue(db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.ITEMSTYLE)); } if (parent != null) { var variationType = ItemExportHelper.GetVariationType(children != null ? children.Select(ch => ch.Color).ToList() : null); string childBrandName = null; decimal? childListPrice = null; string childDepartment = null; string childSize = null; string childStyleString = null; IList <string> childFeatures = new List <string>(); if (firstChild != null) { childBrandName = children.Select(c => c.BrandName).FirstOrDefault(); childFeatures = !String.IsNullOrEmpty(firstChild.Features) ? firstChild.Features.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList() : new List <string>(); childListPrice = firstChild.ListPrice; childDepartment = firstChild.Department; childSize = firstChild.Size; childStyleString = firstChild.StyleString; } //For simplicity, w can just use for parent SKU (unless it exist) style-%parentASIN%. string parentSku = parent.SKU; if (String.IsNullOrEmpty(parentSku)) { parentSku = childStyleString + "-" + parent.ASIN; } var gender = (childDepartment ?? parent.Department ?? ""); var sizeType = ItemExportHelper.GetSizeType(childSize); var categoryInfo = categoryService.GetCategory(market, marketplaceId, itemStyle, gender, sizeType); //var itemType = ItemExportHelper.GetItemType(itemStyle); var newItemType = categoryInfo.Key1;// ItemExportHelper.ItemTypeConverter(childSize ?? "", itemType, itemStyle, gender); var newDepartment = StringHelper.GetFirstNotEmpty(categoryInfo.Key2, ItemExportHelper.DepartmentConverter(gender, newItemType, sizeType)); var parentImage = ItemExportHelper.ImageConverter(StringHelper.GetFirstNotEmpty( parent.LargeImage != null ? parent.LargeImage.Image : null, parent.ImageSource)); models.Add(new ExcelProductCAViewModel { SKU = parentSku,// parent.StyleString, Title = parent.AmazonName, ASIN = parent.ASIN, ProductId = "ASIN", ClothingType = "sleepwear", Manufacturer = parent.BrandName ?? childBrandName, BrandName = parent.BrandName ?? childBrandName, Description = parent.Description, Type = newItemType, Update = "Update", StandardPrice = "", SuggestedPrice = childListPrice.HasValue ? Math.Round(PriceHelper.Convert(childListPrice.Value / 100, caExchangeRate, true)).ToString("G") : "", Currency = childListPrice.HasValue ? "CAD" : "", Quantity = "", KeyProductFeatures1 = childFeatures.Count > 0 ? childFeatures[0] : String.Empty, KeyProductFeatures2 = childFeatures.Count > 1 ? childFeatures[1] : String.Empty, KeyProductFeatures3 = childFeatures.Count > 2 ? childFeatures[2] : String.Empty, KeyProductFeatures4 = childFeatures.Count > 3 ? childFeatures[3] : String.Empty, KeyProductFeatures5 = childFeatures.Count > 4 ? childFeatures[4] : String.Empty, RecommendedBrowseNodes1 = ExcelProductCAViewModel.GetRecommendedBrowseNodes1(newDepartment, childSize, newItemType), MainImageURL = parentImage, Parentage = "Parent", VariationTheme = variationType, Department = newDepartment, Color = "", }); foreach (var child in children) { var styleImages = child.StyleId.HasValue ? db.StyleImages .GetAllAsDto() .Where(im => im.StyleId == child.StyleId.Value && im.Type != (int)StyleImageType.Swatch) .ToList() .OrderByDescending(im => ImageHelper.GetSortIndex(im.Category)) .ThenByDescending(im => im.IsDefault) .ThenBy(im => im.Id) .ToList() : null; IList <string> features = !String.IsNullOrEmpty(child.Features) ? child.Features.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList() : new List <string>(); var childImage = ItemExportHelper.ImageConverter(StringHelper.GetFirstNotEmpty( child.LargeImageUrl, child.ImageUrl)); if (useStyleImageMode == UseStyleImageModes.StyleImage) { if (styleImages != null && styleImages.Any()) { childImage = styleImages.First().Image; } } var itemPrice = child.SalePrice.HasValue && child.SaleStartDate < today ? child.SalePrice.Value : child.CurrentPrice; models.Add(new ExcelProductCAViewModel { StyleId = child.StyleId, StyleItemId = child.StyleItemId, SKU = child.SKU, Title = child.Name, ASIN = child.ASIN, ProductId = "ASIN", ClothingType = "sleepwear", Manufacturer = child.BrandName, BrandName = child.BrandName, Description = parent.Description, Type = newItemType, Update = "Update", //StandardPrice = child.Price.ToString("G"), StandardPrice = CorrectCAPrice(PriceHelper.Convert(itemPrice, caExchangeRate, true)).ToString("G"), //SalePrice = child.SalePrice.HasValue && child.SaleStartDate < today ? CorrectCAPrice(PriceHelper.Convert(child.SalePrice.Value, caExchangeRate, true)).ToString("G") : null, SuggestedPrice = child.ListPrice.HasValue ? Math.Round(PriceHelper.Convert(child.ListPrice.Value / 100, caExchangeRate, true)).ToString("G") : "", Currency = child.ListPrice.HasValue ? "CAD" : "", Quantity = child.RealQuantity.ToString("G"),// "1", // i.Quantity.ToString("G"), KeyProductFeatures1 = features.Count > 0 ? features[0] : String.Empty, KeyProductFeatures2 = features.Count > 1 ? features[1] : String.Empty, KeyProductFeatures3 = features.Count > 2 ? features[2] : String.Empty, KeyProductFeatures4 = features.Count > 3 ? features[3] : String.Empty, KeyProductFeatures5 = features.Count > 4 ? features[4] : String.Empty, RecommendedBrowseNodes1 = ExcelProductCAViewModel.GetRecommendedBrowseNodes1(newDepartment, child.Size, newItemType), MainImageURL = childImage, Parentage = "Child", ParentSKU = parentSku, RelationshipType = "Variation", VariationTheme = variationType, Department = newDepartment, Color = child.Color, Size = child.Size, SpecialSize = child.SpecialSize, }); } //Copy to parent child Type if (children.Count > 0) { models[0].Type = models[1].Type; } if (children.Count > 0 && useStyleImageMode == UseStyleImageModes.StyleImage) { models[0].MainImageURL = models[1].MainImageURL; } } filename = models[0].SKU + "_" + (subLicense != null ? subLicense.Value : "none") + "_CA.xls"; return(models); }
public static IList <ExcelProductUKViewModel> GetItemsFor(ILogService log, ITime time, IMarketCategoryService categoryService, IHtmlScraperService htmlScraper, IMarketApi marketApi, IUnitOfWork db, CompanyDTO company, string asin, MarketType market, string marketplaceId, UseStyleImageModes useStyleImageMode, out string filename) { var gbpExchangeRate = PriceHelper.GBPtoUSD; var today = time.GetAppNowTime(); var models = new List <ExcelProductUKViewModel>(); var items = ItemExportHelper.GetParentItemAndChilds(log, time, htmlScraper, marketApi, db, company, asin, null, ExportToExcelMode.Normal, market, marketplaceId); var parent = items.Item1; // db.ParentItems.GetAsDTO(asin); var children = items.Item2; // db.Items.GetAllActualExAsDto().Where(i => i.ParentASIN == asin).ToList(); var firstChild = children.FirstOrDefault(); FeatureValueDTO subLicense = null; string material = null; string materialComposition = null; string itemStyle = null; if (firstChild != null && firstChild.StyleId.HasValue) { subLicense = db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.SUB_LICENSE1); itemStyle = ItemExportHelper.GetFeatureValue(db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.ITEMSTYLE)); material = ItemExportHelper.GetFeatureValue(db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.MATERIAL)); materialComposition = ItemExportHelper.GetFeatureValue(db.FeatureValues.GetValueByStyleAndFeatureId(firstChild.StyleId.Value, StyleFeatureHelper.MATERIAL_COMPOSITION)); } if (parent != null) { var variationType = ItemExportHelper.GetVariationType(children != null ? children.Select(ch => ch.Color).ToList() : null); string childBrandName = null; decimal?childListPrice = null; string childDepartment = null; string childSize = null; string childStyleString = null; IList <string> childFeatures = new List <string>(); //IList<string> searchTermList = new List<string>(); //if (!String.IsNullOrEmpty(parent.SearchKeywords)) // searchTermList = parent.SearchKeywords.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList(); var searchTerms = (parent.SearchKeywords ?? "").Replace(";", ", "); searchTerms = ItemExportHelper.PrepareSearchTerms(searchTerms); if (firstChild != null) { childBrandName = children.Select(c => c.BrandName).FirstOrDefault(); childFeatures = !String.IsNullOrEmpty(firstChild.Features) ? firstChild.Features.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList() : new List <string>(); childListPrice = firstChild.ListPrice; childDepartment = firstChild.Department; childSize = firstChild.Size; childStyleString = firstChild.StyleString; } //For simplicity, w can just use for parent SKU (unless it exist) style-%parentASIN%. string parentSku = parent.SKU; if (String.IsNullOrEmpty(parentSku)) { parentSku = childStyleString + "-" + parent.ASIN; } var gender = childDepartment ?? parent.Department ?? ""; var sizeType = ItemExportHelper.GetSizeType(childSize); var categoryInfo = categoryService.GetCategory(market, marketplaceId, itemStyle, gender, sizeType); //var itemType = ItemExportHelper.GetItemType(itemStyle); var newItemType = categoryInfo.Key1;// ItemExportHelper.ItemTypeConverter(childSize ?? "", itemType, itemStyle, gender); var newDepartment = StringHelper.GetFirstNotEmpty(categoryInfo.Key2, ItemExportHelper.DepartmentConverter(gender, newItemType, sizeType)); string clothingType = categoryInfo.Key3; var parentImage = ItemExportHelper.ImageConverter(StringHelper.GetFirstNotEmpty( parent.LargeImage != null ? parent.LargeImage.Image : null, parent.ImageSource)); var replaces = new Dictionary <string, string>() { { "Nightgown", "Nighty" }, { "Nightys", "Nighties" }, { "nightgown", "nighty" }, { "nighty", "nighties" }, { "pajama", "pyjama" }, { "Pajama", "Pyjama" }, }; var hasCotton = StringHelper.GetInOneOfStrings("Cotton", new List <string>() { searchTerms, parent.AmazonName, parent.Description, firstChild != null ? firstChild.Features : null }); if (String.IsNullOrEmpty(materialComposition)) { if (hasCotton) { materialComposition = "Cotton"; } else { materialComposition = "Polyester"; } } models.Add(new ExcelProductUKViewModel { SKU = parentSku, Title = StringHelper.Replaces(parent.AmazonName, replaces), ASIN = parent.ASIN, UPC = "", ProductId = "",// "ASIN", BrandName = parent.BrandName ?? childBrandName, Description = parent.Description, ClothingType = clothingType, Update = "Update", StandardPrice = "", //SuggestedPrice = childListPrice.HasValue ? PriceHelper.Convert(childListPrice.Value / 100, gbpExchangeRate, false).ToString("G") : "", Currency = "", // childListPrice.HasValue ? "GBP" : "", Quantity = "", RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, childSize, newItemType), KeyProductFeatures1 = childFeatures.Count > 0 ? childFeatures[0] : String.Empty, KeyProductFeatures2 = childFeatures.Count > 1 ? childFeatures[1] : String.Empty, KeyProductFeatures3 = childFeatures.Count > 2 ? childFeatures[2] : String.Empty, KeyProductFeatures4 = childFeatures.Count > 3 ? childFeatures[3] : String.Empty, KeyProductFeatures5 = childFeatures.Count > 4 ? childFeatures[4] : String.Empty, SearchTerms1 = searchTerms, //SearchTerms2 = searchTermList.Count > 1 ? searchTermList[1] : String.Empty, //SearchTerms3 = searchTermList.Count > 2 ? searchTermList[2] : String.Empty, //SearchTerms4 = searchTermList.Count > 3 ? searchTermList[3] : String.Empty, //SearchTerms5 = searchTermList.Count > 4 ? searchTermList[4] : String.Empty, MainImageURL = parentImage, Parentage = "Parent", VariationTheme = variationType, MaterialComposition = materialComposition, Department = newDepartment, Color = "", }); foreach (var child in children) { var styleImages = child.StyleId.HasValue ? db.StyleImages .GetAllAsDto() .Where(im => im.StyleId == child.StyleId.Value && im.IsDefault) .ToList() : null; IList <string> features = !String.IsNullOrEmpty(child.Features) ? child.Features.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).ToList() : new List <string>(); var childImage = ItemExportHelper.ImageConverter(StringHelper.GetFirstNotEmpty( child.LargeImageUrl, child.ImageUrl)); if (useStyleImageMode == UseStyleImageModes.StyleImage) { if (styleImages != null && styleImages.Any()) { childImage = styleImages.First().Image; } } var itemPrice = child.SalePrice.HasValue && child.SaleStartDate < today ? child.SalePrice.Value : child.CurrentPrice; models.Add(new ExcelProductUKViewModel { StyleId = child.StyleId, StyleItemId = child.StyleItemId, SKU = child.SKU, Title = StringHelper.Replaces(child.Name, replaces), ASIN = child.ASIN, UPC = child.Barcode, ProductId = "UPC",// "ASIN", BrandName = child.BrandName, Description = parent.Description, ClothingType = clothingType, Update = "Update", StandardPrice = CorrectUKPrice(PriceHelper.Convert(itemPrice, gbpExchangeRate, true)).ToString("G"), //SuggestedPrice = child.ListPrice.HasValue ? PriceHelper.Convert(child.ListPrice.Value / 100, gbpExchangeRate, false).ToString("G") : "", Currency = "GBP", Quantity = child.RealQuantity.ToString("G"),// "1", // i.Quantity.ToString("G"), KeyProductFeatures1 = features.Count > 0 ? features[0] : String.Empty, KeyProductFeatures2 = features.Count > 1 ? features[1] : String.Empty, KeyProductFeatures3 = features.Count > 2 ? features[2] : String.Empty, KeyProductFeatures4 = features.Count > 3 ? features[3] : String.Empty, KeyProductFeatures5 = features.Count > 4 ? features[4] : String.Empty, SearchTerms1 = searchTerms, //SearchTerms2 = searchTermList.Count > 1 ? searchTermList[1] : String.Empty, //SearchTerms3 = searchTermList.Count > 2 ? searchTermList[2] : String.Empty, //SearchTerms4 = searchTermList.Count > 3 ? searchTermList[3] : String.Empty, //SearchTerms5 = searchTermList.Count > 4 ? searchTermList[4] : String.Empty, RecommendedBrowseNodes1 = ExcelProductUKViewModel.GetRecommendedBrowseNodes1(newDepartment, childSize, newItemType), MainImageURL = childImage, Parentage = "Child", ParentSKU = parentSku, RelationshipType = "Variation", VariationTheme = variationType, Department = newDepartment, Color = child.Color, MaterialComposition = materialComposition, Size = ItemExportHelper.PrepareSize(ExcelProductUKViewModel.SizeConverter(child.Size, material), gender), }); } if (children.Count > 0 && useStyleImageMode == UseStyleImageModes.StyleImage) { models[0].MainImageURL = models[1].MainImageURL; } } filename = models[0].SKU + "_" + (subLicense != null ? subLicense.Value : "none") + "_UK.xls"; return(models); }