当前位置: 首页>>代码示例>>C#>>正文


C# VirtoCommerce.Domain.Catalog.Model.Select方法代码示例

本文整理汇总了C#中VirtoCommerce.Domain.Catalog.Model.Select方法的典型用法代码示例。如果您正苦于以下问题:C# VirtoCommerce.Domain.Catalog.Model.Select方法的具体用法?C# VirtoCommerce.Domain.Catalog.Model.Select怎么用?C# VirtoCommerce.Domain.Catalog.Model.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VirtoCommerce.Domain.Catalog.Model的用法示例。


在下文中一共展示了VirtoCommerce.Domain.Catalog.Model.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

        public void Create(coreModel.Category[] categories)
        {
            if (categories == null)
                throw new ArgumentNullException("categories");

            var pkMap = new PrimaryKeyResolvingMap();
            var dbCategories = categories.Select(x => x.ToDataModel(pkMap));

            using (var repository = _catalogRepositoryFactory())
            {
                foreach (var dbCategory in dbCategories)
                {
                    repository.Add(dbCategory);
                }
                CommitChanges(repository);
                pkMap.ResolvePrimaryKeys();
            }
            //Need add seo separately
            _commerceService.UpsertSeoForObjects(categories);         
        }
开发者ID:sameerkattel,项目名称:vc-community,代码行数:20,代码来源:CategoryServiceImpl.cs

示例2: Update

		public void Update(coreModel.CatalogProduct[] items)
		{
			var now = DateTime.UtcNow;
			using (var repository = _catalogRepositoryFactory())
			using (var changeTracker = base.GetChangeTracker(repository))
			{
				var dbItems = repository.GetItemByIds(items.Select(x => x.Id).ToArray(), coreModel.ItemResponseGroup.ItemLarge);
				foreach (var dbItem in dbItems)
				{
					var item = items.FirstOrDefault(x => x.Id == dbItem.Id);
					if (item != null)
					{
						//Need skip inherited properties without overridden value
						if (dbItem.ParentId != null && item.PropertyValues != null)
						{
							var dbParentItem = repository.GetItemByIds(new[] { dbItem.ParentId }, coreModel.ItemResponseGroup.ItemProperties).First();
							item.MainProduct = dbParentItem.ToCoreModel(new coreModel.Catalog { Id = dbItem.CatalogId }, new coreModel.Category { Id = dbItem.CategoryId }, null);
						}

						changeTracker.Attach(dbItem);

						item.Patch(dbItem);
					}

					//Patch seoInfo
					if (item.SeoInfos != null)
					{
						foreach (var seoInfo in item.SeoInfos)
						{
							seoInfo.ObjectId = item.Id;
							seoInfo.ObjectType = typeof(coreModel.CatalogProduct).Name;
						}
						var seoInfos = new ObservableCollection<SeoInfo>(_commerceService.GetObjectsSeo(new[] { item.Id }));
						seoInfos.ObserveCollection(x => _commerceService.UpsertSeo(x), x => _commerceService.DeleteSeo(new[] { x.Id }));
						item.SeoInfos.Patch(seoInfos, (source, target) => _commerceService.UpsertSeo(source));
					}
				}
				CommitChanges(repository);
			}

		}
开发者ID:rajendra1809,项目名称:VirtoCommerce,代码行数:41,代码来源:ItemServiceImpl.cs

示例3: Update

		public void Update(coreModel.Property[] properties)
		{
			using (var repository = _catalogRepositoryFactory())
			using (var changeTracker = base.GetChangeTracker(repository))
			{
				var dbProperties = repository.GetPropertiesByIds(properties.Select(x => x.Id).ToArray());

				foreach (var dbProperty in dbProperties)
				{
					var property = properties.FirstOrDefault(x => x.Id == dbProperty.Id);
					if (property != null)
					{
						changeTracker.Attach(dbProperty);

						var dbPropertyChanged = property.ToDataModel();
						dbPropertyChanged.Patch(dbProperty);
					}
				}
				CommitChanges(repository);
			}
		}
开发者ID:rajendra1809,项目名称:VirtoCommerce,代码行数:21,代码来源:PropertyServiceImpl.cs

示例4: Update

        public void Update(coreModel.CatalogProduct[] items)
        {
            var pkMap = new PrimaryKeyResolvingMap();
            var now = DateTime.UtcNow;
            using (var repository = _catalogRepositoryFactory())
            using (var changeTracker = base.GetChangeTracker(repository))
            {
                var dbItems = repository.GetItemByIds(items.Select(x => x.Id).ToArray(), coreModel.ItemResponseGroup.ItemLarge);
                foreach (var dbItem in dbItems)
                {
                    var item = items.FirstOrDefault(x => x.Id == dbItem.Id);
                    if (item != null)
                    {
                        changeTracker.Attach(dbItem);

                        item.Patch(dbItem, pkMap);
                    }
                }
                CommitChanges(repository);
                pkMap.ResolvePrimaryKeys();
            }

            //Update seo for products
            _commerceService.UpsertSeoForObjects(items);

        }
开发者ID:adwardliu,项目名称:vc-community,代码行数:26,代码来源:ItemServiceImpl.cs


注:本文中的VirtoCommerce.Domain.Catalog.Model.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。