public CategoryItemRelationViewModel(IViewModelsFactory <ISearchCategoryViewModel> vmFactory, CategoryItemRelation item) { _vmFactory = vmFactory; InnerItem = item; CategorySearchCommand = new DelegateCommand(RaiseItemPickInteractionRequest); CommonConfirmRequest = new InteractionRequest <Confirmation>(); }
protected virtual void IndexCategory(ref ResultDocument doc, CategoryItemRelation categoryRelation) { //TODO: normally categoryRelation.Category should no be null but somehow it is null sometimes after more than 300 item loads var cat = categoryRelation.Category ?? CatalogRepository.Categories.Expand(c => c.LinkedCategories) .First(c => c.CategoryId == categoryRelation.CategoryId); IndexCategory(ref doc, categoryRelation.CatalogId, cat); }
private static Product CreateProduct(string catalogId, string categoryId, string name, string propertySetId) { Product product = new Product(); //product.CatalogId = catalogId; product.Name = name; product.Code = product.ItemId; product.StartDate = DateTime.Now.AddYears(-1); product.EndDate = DateTime.Now.AddYears(1); product.IsActive = true; product.CatalogId = catalogId; product.MinQuantity = 1; product.MaxQuantity = 10; product.Weight = 2.3m; product.TrackInventory = false; //product.SetPropertyValue<string>("Brand", brand); string description = @"The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more. You can even download MP3 ringtones, graphics, and games straight to the phone, or surf the Internet with Cingular's MEdia Net service. It's the perfect complement to Cingular service for those even remotely interested in mobile Web capabilities in an affordable handset."; product.ItemPropertyValues.Add(new ItemPropertyValue() { ItemId = product.ItemId, LongTextValue = description, Name = "Description" }); string design = "Compact and stylish, the 2610 features a candybar design sporting a bright 128 x 128 pixel display capable of displaying over 65,000 colors. Most of the phone's features and on-screen menus are controlled by a center toggle on the control pad. A standard hands-free headphone jack is provided, as are volume control keys, and there's even a \"Go-To\" button that can be assigned by the user for quick access to favorite applications. Lastly, the included speakerphone allows you to talk handsfree, and because the phone sports an internal antenna, there's nothing to snag or break off."; product.ItemPropertyValues.Add(new ItemPropertyValue() { ItemId = product.ItemId, LongTextValue = design, Name = "Design" }); product.ItemPropertyValues.Add(new ItemPropertyValue() { ItemId = product.ItemId, LongTextValue = "2610", Name = "Model" }); //var propertySet = catalog.PropertySets[0]; //product.PropertySet = propertySet; product.PropertySetId = propertySetId; ////Add associations //AssociationGroup group = new AssociationGroup(); //group.Description = "Related products"; //group.Name = "RelatedProducts"; //group.ItemId = product.ItemId; //Association association = new Association(); //association.AssociationType = AssociationTypes.Optional; //association.ItemId = product.ItemId; ////association.CatalogItem = product; //association.AssociationGroupId = group.AssociationGroupId; //group.Associations.Add(association); //product.AssociationGroups.Add(group); //AssociationGroup group2 = new AssociationGroup(); //group2.Description = "Accessory products"; //group2.Name = "ProductAccessories"; //group2.ItemId = product.ItemId; //Association association2 = new Association(); //association2.AssociationType = AssociationTypes.Optional; //association2.ItemId = product.ItemId; ////association2.CatalogItem = product; //association2.AssociationGroupId = group2.AssociationGroupId; //group2.Associations.Add(association2); //product.AssociationGroups.Add(group2); ItemAsset asset = new ItemAsset(); asset.AssetId = String.Format("catalog/{0}", "image"); asset.AssetType = "file"; asset.GroupName = "primaryimage"; asset.ItemId = product.ItemId; asset.SortOrder = 1; product.ItemAssets.Add(asset); var relation = new CategoryItemRelation() { CatalogId = catalogId, CategoryId = categoryId, ItemId = product.ItemId }; product.CategoryItemRelations.Add(relation); return(product); }