public GetProductsToUpdateInventoryBlock(IFindEntityPipeline findEntityPipeline, IGetEnvironmentCachePipeline cachePipeline, IFindEntitiesInListPipeline findEntitiesPipeline) : base((string)null) { this._cachePipeline = cachePipeline; this._findEntitiesInListPipeline = findEntitiesPipeline; this._findEntityPipeline = findEntityPipeline; }
public GetProductsToUpdateInventoryBlock(IFindEntityPipeline findEntityPipeline, CommerceCommander commerceCommander, IFindEntitiesInListPipeline findEntitiesPipeline) : base((string)null) { this._commerceCommander = commerceCommander; this._findEntitiesInListPipeline = findEntitiesPipeline; this._findEntityPipeline = findEntityPipeline; }
public override void Initialize(IServiceProvider serviceProvider, MinionPolicy policy, CommerceContext globalContext) { base.Initialize(serviceProvider, policy, globalContext); ExportOrderPipeline = serviceProvider.GetService <IExportOrderMinionPipeline>(); _findEntitiesInListPipeline = serviceProvider.GetService <IFindEntitiesInListPipeline>(); }
/// <summary> /// Initializes a new instance of the <see cref="UpgradeCustomersCommand" /> class. /// </summary> /// <param name="findEntitiesInListPipeline">The find entities in list pipeline.</param> /// <param name="upgradeCustomerPipeline">The upgrade customer pipeline.</param> /// <param name="serviceProvider">The service provider.</param> public UpgradeCustomersCommand( IFindEntitiesInListPipeline findEntitiesInListPipeline, IUpgradeCustomerPipeline upgradeCustomerPipeline, IServiceProvider serviceProvider) : base(serviceProvider) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; this._upgradeCustomerPipeline = upgradeCustomerPipeline; }
public AssociateStoreInventoryToSellablteItemBlock(IFindEntityPipeline findEntityPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline, ICreateRelationshipPipeline createRelationshipPipeline, IPersistEntityPipeline persistEntityPipeline, GetInventoryInformationCommand getInventoryInformationCommand) : base((string)null) { this._findEntityPipeline = findEntityPipeline; this._findEntitiesInListPipeline = findEntitiesInListPipeline; this._createRelationshipPipeline = createRelationshipPipeline; this._persistEntityPipeline = persistEntityPipeline; this._getInventoryInformationCommand = getInventoryInformationCommand; }
/// <summary> /// Initializes a new instance of the <see cref="GetSourceEnvironmentBlock" /> class. /// </summary> /// <param name="findEntitiesInListPipeline">The find entities in list pipeline.</param> /// <param name="migrateEntityMetadataPipeline">The migrate entity metadata pipeline.</param> /// <param name="getListCountCommand">The get list count command.</param> public MigrateListBlock( IFindEntitiesInListPipeline findEntitiesInListPipeline, IMigrateEntityMetadataPipeline migrateEntityMetadataPipeline, GetListCountCommand getListCountCommand) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; this._migrateEntityMetadataPipeline = migrateEntityMetadataPipeline; this._getListCountCommand = getListCountCommand; }
public GetComposerTemplatesBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) : base((string)null) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; }
public GetReviewsListViewBlock(CommerceCommander commander, IFindEntitiesInListPipeline findEntitiesInListPipeline) : base(commander) { this.findEntitiesInListPipeline = findEntitiesInListPipeline; }
public AddToCartBundlesBlock(IFindEntityPipeline findEntityPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline) : base((string)null) { this._findEntityPipeline = findEntityPipeline; _findEntitiesInListPipeline = findEntitiesInListPipeline; }
public GetProductCompareBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) { _findEntitiesInListPipeline = findEntitiesInListPipeline; }
public override async Task <bool> Run(SellableItemInventorySetsArgument argument, CommercePipelineExecutionContext context) { AssociateStoreInventoryToSellablteItemBlock associateStoreInventoryToSellablteItemBlock = this; Condition.Requires(argument).IsNotNull(string.Format("{0}: The argument can not be null", argument)); string sellableItemId = argument.SellableItemId; CommerceEntity entity = await associateStoreInventoryToSellablteItemBlock._findEntityPipeline.Run(new FindEntityArgument(typeof(SellableItem), sellableItemId, false), context).ConfigureAwait(false); CommercePipelineExecutionContext executionContext; if (!(entity is SellableItem)) { executionContext = context; CommerceContext commerceContext = context.CommerceContext; string validationError = context.GetPolicy <KnownResultCodes>().ValidationError; string commerceTermKey = "EntityNotFound"; object[] args = new object[1] { argument.SellableItemId }; string defaultMessage = string.Format("Entity {0} was not found.", argument.SellableItemId); executionContext.Abort(await commerceContext.AddMessage(validationError, commerceTermKey, args, defaultMessage).ConfigureAwait(false), context); executionContext = null; return(false); } SellableItem sellableItem = entity as SellableItem; if ((string.IsNullOrEmpty(argument.VariationId)) & sellableItem.HasComponent <ItemVariationsComponent>()) { executionContext = context; executionContext.Abort(await context.CommerceContext.AddMessage(context.GetPolicy <KnownResultCodes>().ValidationError, "AssociateInventoryWithVariant", new object[0], "Can not associate inventory to the base sellable item. Use one of the variants instead.").ConfigureAwait(false), context); executionContext = null; return(false); } ItemVariationComponent sellableItemVariation = null; if (argument.VariationId != null) { sellableItemVariation = sellableItem.GetVariation(argument.VariationId); if (!string.IsNullOrEmpty(argument.VariationId) && sellableItemVariation == null) { executionContext = context; CommerceContext commerceContext = context.CommerceContext; string validationError = context.GetPolicy <KnownResultCodes>().ValidationError; string commerceTermKey = "ItemNotFound"; object[] args = new object[1] { argument.VariationId }; string defaultMessage = string.Format("Item '{0}' was not found.", argument.VariationId); executionContext.Abort(await commerceContext.AddMessage(validationError, commerceTermKey, args, defaultMessage).ConfigureAwait(false), context); executionContext = null; return(false); } } List <InventoryAssociation> inventoryAssociations = new List <InventoryAssociation>(); foreach (var inventorySetId in argument.InventorySetIds) { bool isUpdate = false; Random rnd = new Random(); InventoryInformation inventoryInformation = await associateStoreInventoryToSellablteItemBlock._getInventoryInformationCommand .Process(context.CommerceContext, inventorySetId, argument.SellableItemId, argument.VariationId, false) .ConfigureAwait(false); IFindEntitiesInListPipeline entitiesInListPipeline = associateStoreInventoryToSellablteItemBlock._findEntitiesInListPipeline; FindEntitiesInListArgument entitiesInListArgument1 = new FindEntitiesInListArgument(typeof(SellableItem), string.Format("{0}-{1}", "InventorySetToInventoryInformation", inventorySetId.SimplifyEntityName()), 0, int.MaxValue); entitiesInListArgument1.LoadEntities = false; CommercePipelineExecutionContext context1 = context; FindEntitiesInListArgument entitiesInListArgument2 = await entitiesInListPipeline.Run(entitiesInListArgument1, context1).ConfigureAwait(false); if (inventoryInformation != null && entitiesInListArgument2 != null) { List <ListEntityReference> entityReferences = entitiesInListArgument2.EntityReferences.ToList(); string id = inventoryInformation.Id; if (entityReferences != null && entityReferences.Any(er => er.EntityId == id)) { inventoryInformation.Quantity = rnd.Next(50); isUpdate = true; } } if (!isUpdate) { string inventorySetName = string.Format("{0}-{1}", inventorySetId.SimplifyEntityName(), sellableItem.ProductId); if (!string.IsNullOrEmpty(argument.VariationId)) { inventorySetName += string.Format("-{0}", argument.VariationId); } InventoryInformation inventoryInformation1 = new InventoryInformation(); inventoryInformation1.Id = string.Format("{0}{1}", CommerceEntity.IdPrefix <InventoryInformation>(), inventorySetName); inventoryInformation1.FriendlyId = inventorySetName; EntityReference entityReference1 = new EntityReference(inventorySetId, ""); inventoryInformation1.InventorySet = entityReference1; EntityReference entityReference2 = new EntityReference(argument.SellableItemId, ""); inventoryInformation1.SellableItem = entityReference2; string variationId = argument.VariationId; inventoryInformation1.VariationId = variationId; inventoryInformation1.Quantity = rnd.Next(50); inventoryInformation = inventoryInformation1; } inventoryInformation.GetComponent <TransientListMembershipsComponent>().Memberships.Add(CommerceEntity.ListName <InventoryInformation>()); PersistEntityArgument persistEntityArgument1 = await associateStoreInventoryToSellablteItemBlock._persistEntityPipeline.Run(new PersistEntityArgument((CommerceEntity)inventoryInformation), context).ConfigureAwait(false); RelationshipArgument relationshipArgument = await associateStoreInventoryToSellablteItemBlock._createRelationshipPipeline.Run(new RelationshipArgument(inventorySetId, inventoryInformation.Id, "InventorySetToInventoryInformation"), context).ConfigureAwait(false); InventoryAssociation inventoryAssociation = new InventoryAssociation() { InventoryInformation = new EntityReference(inventoryInformation.Id, ""), InventorySet = new EntityReference(inventorySetId, "") }; inventoryAssociations.Add(inventoryAssociation); } (sellableItemVariation != null ? sellableItemVariation.GetComponent <InventoryComponent>() : sellableItem.GetComponent <InventoryComponent>()).InventoryAssociations.AddRange(inventoryAssociations); PersistEntityArgument persistEntityArgument2 = await associateStoreInventoryToSellablteItemBlock._persistEntityPipeline.Run(new PersistEntityArgument(sellableItem), context).ConfigureAwait(false); return(true); }
public GetProductReviewsViewBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) : base(null) { this.findEntitiesInListPipeline = findEntitiesInListPipeline; }
public UpdateCustomerInxDBBlock(IPersistEntityPipeline persistEntityPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline) { _persistEntityPipeline = persistEntityPipeline; _findEntitiesInListPipeline = findEntitiesInListPipeline; }
public RequestPaymentBlock(IGetOrderPipeline getOrderPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline) { this.getOrderPipeline = getOrderPipeline; this.findEntitiesInListPipeline = findEntitiesInListPipeline; }
public FixGetCustomersViewBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; }
public UpdateIngenicoPaymentBlock(IGetOrderPipeline getOrderPipeline, IPersistEntityPipeline persistEntityPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline) { this.getOrderPipeline = getOrderPipeline; this.persistEntityPipeline = persistEntityPipeline; this.findEntitiesInListPipeline = findEntitiesInListPipeline; }
public CalculateCustomerPointsBlock(IPersistEntityPipeline persistEntityPipeline, IFindEntitiesInListPipeline findEntitiesInListPipeline) { _persistEntityPipeline = persistEntityPipeline; _findEntitiesInListPipeline = findEntitiesInListPipeline; }
public SyncProductToChannelAdvisorBlock(ISyncSellableItemPipeline SyncProductToChannelAdvisorPipline, IFindEntitiesInListPipeline findEntitiesInListPipeline) { _findEntitiesInListPipeline = findEntitiesInListPipeline; }
public RecentCustomersListKeepShortBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline, IRemoveListEntitiesPipeline removeListEntitiesPipeline) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; this._removeListEntitiesPipeline = removeListEntitiesPipeline; }
public GetNearestStoreDetailsByLocationBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) : base((string)null) { this._findEntitiesInListPipeline = findEntitiesInListPipeline; }
public GetPublicCouponsLimitedUsageViewBlock(IFindEntitiesInListPipeline findEntitiesInListPipeline) : base(null) { _findEntitiesInListPipeline = findEntitiesInListPipeline; }