public PropertyViewModel(IViewModelsFactory <IPropertyValueViewModel> propertyValueVmFactory, IViewModelsFactory <IPropertyAttributeViewModel> attributeVmFactory, ICatalogEntityFactory entityFactory, Property item, catalogModel.Catalog parentCatalog, IRepositoryFactory <ICatalogRepository> repositoryFactory)
        {
            InnerItem = item;
            _propertyValueVmFactory = propertyValueVmFactory;
            _attributeVmFactory     = attributeVmFactory;
            _entityFactory          = entityFactory;
            ParentCatalog           = parentCatalog;
            _repositoryFactory      = repositoryFactory;

            ValueAddCommand    = new DelegateCommand(RaiseValueAddInteractionRequest);
            ValueEditCommand   = new DelegateCommand <PropertyValueBase>(RaiseValueEditInteractionRequest, x => x != null);
            ValueDeleteCommand = new DelegateCommand <PropertyValueBase>(RaiseValueDeleteInteractionRequest, x => x != null);

            AttributeAddCommand    = new DelegateCommand(RaiseAttributeAddInteractionRequest);
            AttributeEditCommand   = new DelegateCommand <PropertyAttribute>(RaiseAttributeEditInteractionRequest, x => x != null);
            AttributeDeleteCommand = new DelegateCommand <PropertyAttribute>(RaiseAttributeDeleteInteractionRequest, x => x != null);


            CommonConfirmRequest = new InteractionRequest <Confirmation>();

            var allValueTypes = (PropertyValueType[])Enum.GetValues(typeof(PropertyValueType));

            PropertyTypes = new List <PropertyValueType>(allValueTypes);
            PropertyTypes.Sort((x, y) => x.ToString().CompareTo(y.ToString()));
        }
        public TreeCatalogViewModel(
            IViewModelsFactory <ICatalogViewModel> vmFactory,
            catalogModel.Catalog item,
            IRepositoryFactory <ICatalogRepository> repositoryFactory,
            IAuthenticationContext authContext,
            INavigationManager navigationManager,
            IViewModelsFactory <ICatalogDeleteViewModel> catalogDeleteVmFactory,
            IViewModelsFactory <ITreeCategoryViewModel> treeCategoryVmFactory,
            IDataManagementService exportService)
            : base(repositoryFactory, authContext)
        {
            InnerItem = item;
            EmbeddedHierarchyEntry = this;

            _catalogDeleteVmFactory = catalogDeleteVmFactory;
            _treeCategoryVmFactory  = treeCategoryVmFactory;
            _exportService          = exportService;

            OpenItemCommand = new DelegateCommand(() =>
            {
                if (NavigationData == null)
                {
                    var editVM = vmFactory.GetViewModelInstance(new KeyValuePair <string, object>("item", InnerItem)
                                                                , new KeyValuePair <string, object>("parentTreeVM", this));
                    NavigationData = ((IClosable)editVM).NavigationData;
                }
                navigationManager.Navigate(NavigationData);
            });

            ExportItemCommand = new DelegateCommand(() => RaiseExportItemCommand());
        }
示例#3
0
		private static CatalogBase CreateCatalog(string catalogName)
		{
			var ctlg = new Catalog();
			ctlg.CatalogId = catalogName;
			ctlg.Name = catalogName;
			//ctlg.StartDate = DateTime.Now.AddYears(-1);
			//ctlg.EndDate = DateTime.Now.AddYears(1);
			ctlg.WeightMeasure = WeightUnitOfMeasure.Pounds.GetHashCode();
			//ctlg.IsActive = true;
			//ctlg.SortOrder = 1;
			ctlg.DefaultLanguage = "en-us";
			ctlg.CatalogLanguages.Add(new CatalogLanguage { CatalogId = ctlg.CatalogId, Language = "en-us" });
			ctlg.CatalogLanguages.Add(new CatalogLanguage { CatalogId = ctlg.CatalogId, Language = "de-de" });

			var property1 = new Property() { Name = "Description", CatalogId = catalogName };
			var property2 = new Property() { Name = "Design", CatalogId = catalogName };
			var property3 = new Property() { Name = "Model", CatalogId = catalogName };

			var propertySet = new PropertySet() { CatalogId = ctlg.CatalogId, Name = "some property set", TargetType = "All" };

			propertySet.PropertySetProperties.Add(new PropertySetProperty() { PropertyId = property1.PropertyId, Property = property1, PropertySetId = propertySet.PropertySetId, PropertySet = propertySet });
			propertySet.PropertySetProperties.Add(new PropertySetProperty() { PropertyId = property2.PropertyId, Property = property2, PropertySetId = propertySet.PropertySetId, PropertySet = propertySet });
			propertySet.PropertySetProperties.Add(new PropertySetProperty() { PropertyId = property3.PropertyId, Property = property3, PropertySetId = propertySet.PropertySetId, PropertySet = propertySet });

			ctlg.PropertySets.Add(propertySet);

			return ctlg;
		}
        public PropertyViewModel(IViewModelsFactory<IPropertyValueViewModel> propertyValueVmFactory, IViewModelsFactory<IPropertyAttributeViewModel> attributeVmFactory, ICatalogEntityFactory entityFactory, Property item, catalogModel.Catalog parentCatalog, IRepositoryFactory<ICatalogRepository> repositoryFactory, ObservableCollection<Property> properties)
        {
            InnerItem = item;
            _propertyValueVmFactory = propertyValueVmFactory;
            _attributeVmFactory = attributeVmFactory;
            _entityFactory = entityFactory;
            _properties = properties;
            ParentCatalog = parentCatalog;
            // _repositoryFactory = repositoryFactory;

            ValueAddCommand = new DelegateCommand(RaiseValueAddInteractionRequest);
            ValueEditCommand = new DelegateCommand<PropertyValueBase>(RaiseValueEditInteractionRequest, x => x != null);
            ValueDeleteCommand = new DelegateCommand<PropertyValueBase>(RaiseValueDeleteInteractionRequest, x => x != null);

            AttributeAddCommand = new DelegateCommand(RaiseAttributeAddInteractionRequest);
            AttributeEditCommand = new DelegateCommand<PropertyAttribute>(RaiseAttributeEditInteractionRequest, x => x != null);
            AttributeDeleteCommand = new DelegateCommand<PropertyAttribute>(RaiseAttributeDeleteInteractionRequest, x => x != null);


            CommonConfirmRequest = new InteractionRequest<Confirmation>();

            var allValueTypes = (PropertyValueType[])Enum.GetValues(typeof(PropertyValueType));
            PropertyTypes = new List<PropertyValueType>(allValueTypes);
            PropertyTypes.Sort((x, y) => x.ToString().CompareTo(y.ToString()));
        }
        private static CatalogBase CreateCatalog(string catalogName)
        {
            var ctlg = new VirtoCommerce.Foundation.Catalogs.Model.Catalog();

            ctlg.CatalogId = catalogName;
            ctlg.Name      = catalogName;
            //ctlg.StartDate = DateTime.Now.AddYears(-1);
            //ctlg.EndDate = DateTime.Now.AddYears(1);
            ctlg.WeightMeasure = WeightUnitOfMeasure.Pounds.GetHashCode();
            //ctlg.IsActive = true;
            //ctlg.SortOrder = 1;
            ctlg.DefaultLanguage = "en-us";
            ctlg.CatalogLanguages.Add(new CatalogLanguage {
                CatalogId = ctlg.CatalogId, Language = "en-us"
            });
            ctlg.CatalogLanguages.Add(new CatalogLanguage {
                CatalogId = ctlg.CatalogId, Language = "de-de"
            });

            var property1 = new Property()
            {
                Name = "Description"
            };
            var property2 = new Property()
            {
                Name = "Design"
            };
            var property3 = new Property()
            {
                Name = "Model"
            };

            var propertySet = new PropertySet()
            {
                CatalogId = ctlg.CatalogId, Name = "some property set", TargetType = "type"
            };

            propertySet.PropertySetProperties.Add(new PropertySetProperty()
            {
                PropertyId    = property1.PropertyId,
                Property      = property1,
                PropertySetId = propertySet.PropertySetId,
                PropertySet   = propertySet
            });
            propertySet.PropertySetProperties.Add(new PropertySetProperty()
            {
                PropertyId    = property2.PropertyId,
                Property      = property2,
                PropertySetId = propertySet.PropertySetId,
                PropertySet   = propertySet
            });
            propertySet.PropertySetProperties.Add(new PropertySetProperty()
            {
                PropertyId    = property3.PropertyId,
                Property      = property3,
                PropertySetId = propertySet.PropertySetId,
                PropertySet   = propertySet
            });

            ctlg.PropertySets.Add(propertySet);

            return(ctlg);
        }
 public CatalogOverviewStepViewModel(IRepositoryFactory <ICatalogRepository> repositoryFactory, IRepositoryFactory <IAppConfigRepository> appConfigRepositoryFactory, ICatalogEntityFactory entityFactory, catalogModel.Catalog item)
     : base(repositoryFactory, appConfigRepositoryFactory, entityFactory, item)
 {
 }
        public CreateCatalogViewModel(IViewModelsFactory <ICatalogOverviewStepViewModel> vmFactory, catalogModel.Catalog item)
        {
            var itemParameter = new KeyValuePair <string, object>("item", item);

            RegisterStep(vmFactory.GetViewModelInstance(itemParameter));
        }