private void RaiseValueAddInteractionRequest() { var item = (PropertyValue)_entityFactory.CreateEntityForType("PropertyValue"); // ValueType is inherited item.ValueType = InnerItem.PropertyValueType; if (RaisePropertyValueEditInteractionRequest(item, "Create property value".Localize())) { InnerItem.PropertyValues.Add(item); } }
private void RaiseItemAddInteractionRequest() { var item = (Association)_entityFactory.CreateEntityForType("Association"); item.Priority = 1; if (RaiseItemEditInteractionRequest(item, "Add association".Localize())) { item.AssociationGroupId = InnerItem.AssociationGroupId; InnerItem.Associations.Add(item); } }
private void RegisterEditorialReviewStep(Item parentItem, ICatalogEntityFactory entityFactory, IViewModelsFactory<IEditorialReviewViewModel> vmFactory) { var item = (EditorialReview)entityFactory.CreateEntityForType(typeof(EditorialReview)); item.CatalogItem = parentItem; item.Priority = 1; item.Source = "Product Description"; var retVal = vmFactory.GetViewModelInstance( new KeyValuePair<string, object>("item", item), new KeyValuePair<string, object>("isWizardMode", true)); RegisterStep(retVal); }
private void SelectItem(Property selectedItem) { var item = (PropertySetProperty)_entityFactory.CreateEntityForType("PropertySetProperty"); item.PropertyId = selectedItem.PropertyId; item.Property = selectedItem; item.PropertySetId = InnerItem.PropertySetId; var maxPriority = ItemsCollection.InnerItems.Count == 0 ? 0 : ItemsCollection.InnerItems.Max(x => x.Priority); item.Priority = maxPriority + 1; ItemsCollection.Add(item); }
internal static void RaisePropertyValueEditInteractionRequest <T>(IViewModelsFactory <IPropertyValueBaseViewModel> _vmFactory, InteractionRequest <Confirmation> confirmRequest, ICatalogEntityFactory entityFactory, Action <PropertyAndPropertyValueBase, PropertyAndPropertyValueBase> finalAction, PropertyAndPropertyValueBase originalItem, string locale) where T : PropertyValueBase { var item = originalItem.DeepClone(entityFactory as CatalogEntityFactory); T itemValue; if (!originalItem.IsMultiValue) { item.Values = new ObservableCollection <PropertyValueBase>(); if (originalItem.Value == null) { itemValue = (T)entityFactory.CreateEntityForType(typeof(T)); if (originalItem.Property != null) { itemValue.ValueType = originalItem.Property.PropertyValueType; } item.Value = itemValue; } } else if (originalItem.Values == null) { //itemValue = (T)entityFactory.CreateEntityForType(typeof(T)); // item.CategoryId = InnerItem.CategoryId; //if (originalItem.Property != null) // itemValue.ValueType = originalItem.Property.PropertyValueType; item.Values = new ObservableCollection <PropertyValueBase>(); } //else //{ // itemValue = (T)originalItem.Value.DeepClone(entityFactory as CatalogEntityFactory); //} var itemVM = _vmFactory.GetViewModelInstance( new KeyValuePair <string, object>("item", item), new KeyValuePair <string, object>("locale", locale)); var confirmation = new ConditionalConfirmation(itemVM.Validate) { Title = "Edit property value".Localize(), Content = itemVM }; confirmRequest.Raise(confirmation, (x) => { if (x.Confirmed) { finalAction(originalItem, item); } }); }
private void RegisterEditorialReviewStep(Item parentItem, ICatalogEntityFactory entityFactory, IViewModelsFactory <IEditorialReviewViewModel> vmFactory) { var item = (EditorialReview)entityFactory.CreateEntityForType(typeof(EditorialReview)); item.CatalogItem = parentItem; item.Locale = parentItem.Catalog.DefaultLanguage; item.Priority = 1; item.Source = "Product Description".Localize(); var retVal = vmFactory.GetViewModelInstance( new KeyValuePair <string, object>("item", item), new KeyValuePair <string, object>("isWizardMode", true)); RegisterStep(retVal); }
private T CreateEntity <T>() { return((T)_entityFactory.CreateEntityForType(_entityFactory.GetEntityTypeStringName(typeof(T)))); }