public override bool IsMatch(bsi_posts post) { string gender = post.bsi_posting.gender.ToUpper().Trim(); if (gender.Equals("WOMENS") || gender.Equals("WOMEN")) { bsi_quantities postItem = post.bsi_quantities.First(); string formattedWidth = this.FormatWidth(postItem.width); if (_sizeAttributeOptions.Any(p => p.label.Equals(postItem.size)) && _widthAttributeOptions.Any(p => p.label.Equals(formattedWidth))) { return(true); } } return(false); }
public override catalogProductCreateEntity CreateProductData(bsi_posts post, bsi_quantities postItem) { int brandID = this.GetBrandID(post.bsi_posting.brand); int ebayCategoryID = this.GetEbayCategoryID(post.bsi_posting.category); catalogProductCreateEntity productData = new catalogProductCreateEntity(); productData.visibility = "4"; productData.stock_data = null; productData.additional_attributes = null; productData.name = post.title; productData.description = post.bsi_posting.fullDescription; productData.short_description = post.title; productData.price = post.price; productData.status = "1"; productData.websites = new string[1] { "base" }; productData.has_options = "1"; productData.categories = new string[2] { ebayCategoryID.ToString(), brandID.ToString() }; productData.visibility = "1"; productData.stock_data = new catalogInventoryStockItemUpdateEntity(); productData.stock_data.is_in_stock = 1; productData.stock_data.is_in_stockSpecified = true; productData.price = post.price; productData.stock_data.qty = postItem.quantity.ToString(); productData.additional_attributes = new catalogProductAdditionalAttributesEntity(); productData.additional_attributes.single_data = new associativeEntity[2] { this.BuildSizeData(postItem.size), this.BuildWidthData(postItem.width) }; return(productData); }
public void UpdateMainEntries(IEnumerable <MainEntry> entries) { var titleMaps = _workbook.ReadTitleMapRules(); TextInfo textInfo = Thread.CurrentThread.CurrentCulture.TextInfo; PictureSetRepository picRepository = new PictureSetRepository(); using (berkeleyEntities dataContext = new berkeleyEntities()) { dataContext.MaterializeAttributes = true; foreach (MainEntry entry in entries) { try { Item item = dataContext.Items.Include("EbayListingItems").Include("AmznListingItems").SingleOrDefault(p => p.ItemLookupCode.Equals(entry.Sku)); if (item == null) { entry.Message = "sku not found"; continue; } entry.Brand = item.SubDescription1; entry.ClassName = item.ClassName; entry.Qty = item.QtyAvailable; entry.Cost = item.Cost; entry.Department = item.DepartmentName; entry.Category = item.CategoryName; entry.Gender = item.SubDescription3; entry.Color = item.SubDescription2; entry.Notes = item.Notes; entry.Price = item.Price; entry.Location = item.BinLocation; entry.Cost = item.Cost; entry.Qty = item.QtyAvailable; entry.Description = item.Description; entry.UPC = item.GTIN; var pics = picRepository.GetPictures(entry.Brand, new List <string>() { entry.Sku }); entry.PictureCount = pics.Count; var titleMap = titleMaps.SingleOrDefault(p => p.Department.Equals(item.DepartmentName) && p.Category.Equals(item.CategoryName)); if (titleMap == null) { titleMap = new TitleMapRule(); titleMap.Map = ""; } string description = item.Description; string dims = string.Empty; foreach (var attribute in item.Dimensions) { description = description.Replace(" " + attribute.Value.Value + " ", ""); dims += attribute.Value.Value + " "; } entry.TitleFormula = textInfo.ToTitleCase((entry.Brand + " " + titleMap.Map + " Size " + dims + description).ToLower()); var ebayHistory = string.Join(" ", item.EbayListingItems.Where(p => p.Listing.Status.Equals(EbayMarketplace.STATUS_ACTIVE)).Select(p => p.ToString())); var amznHistory = string.Join(" ", item.AmznListingItems.Where(p => p.IsActive).Select(p => p.ToString())); entry.Status = ebayHistory + " " + amznHistory; if (item.EbayListingItems.Where(w => w.Listing.IsVariation.HasValue && !w.Listing.IsVariation.Value).Count() > 0) { EbayListingItem listingItem = item.EbayListingItems.Single(p => p.ID == item.EbayListingItems.Where(w => w.Listing.IsVariation.HasValue && !w.Listing.IsVariation.Value).Max(s => s.ID)); entry.Title = listingItem.Listing.Title; entry.FullDescription = listingItem.Listing.FullDescription; } else if (dataContext.bsi_quantities.Any(p => p.itemLookupCode.Equals(entry.Sku))) { var postDetails = dataContext.bsi_quantities.Where(p => p.itemLookupCode.Equals(entry.Sku)); int lastPostDetailID = postDetails.Max(p => p.id); bsi_quantities postDetail = postDetails.Single(p => p.id == lastPostDetailID); entry.Title = postDetail.title; entry.FullDescription = postDetail.bsi_posts.bsi_posting.fullDescription; } } catch (Exception e) { entry.Message = e.Message; } } } }
public abstract catalogProductCreateEntity CreateProductData(bsi_posts post, bsi_quantities postItem);