示例#1
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            ITracingService             tracingService = executionContext.GetExtension <ITracingService>();
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            EntityReference enProperty   = PropertyLookup.Get <EntityReference>(executionContext);
            EntityReference enReportType = ProductLookup.Get <EntityReference>(executionContext);

            #region query Product Inventory
            var fetchXmlProductInventory = string.Empty;
            fetchXmlProductInventory += "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' top='1'>";
            fetchXmlProductInventory += "  <entity name='blu_productinventory'>";
            fetchXmlProductInventory += "     <attribute name='blu_productinventoryid'/>";
            fetchXmlProductInventory += "     <order attribute='createdon' descending='true'/>";
            fetchXmlProductInventory += "     <filter type='and'>";
            fetchXmlProductInventory += "        <condition attribute='blu_property' operator='eq' value='" + enProperty.Id.ToString() + "'/>";
            fetchXmlProductInventory += "        <condition attribute='blu_reporttype' operator='eq' value='" + enReportType.Id.ToString() + "'/>";
            fetchXmlProductInventory += "        <condition attribute='statecode' operator='eq' value='0'/>";
            fetchXmlProductInventory += "     </filter>";
            fetchXmlProductInventory += "  </entity>";
            fetchXmlProductInventory += "</fetch>";
            #endregion

            EntityCollection ecProductInventory = service.RetrieveMultiple(new FetchExpression(fetchXmlProductInventory));
            if (ecProductInventory.Entities.Count > 0)
            {
                foreach (var enProductInventory in ecProductInventory.Entities)
                {
                    ProductInventoryLookup.Set(executionContext, new EntityReference("blu_productinventory", enProductInventory.Id));
                }
            }
        }
示例#2
0
    private void InitializeProductLookup()
    {
        if (_lkp == null)
        {
            throw new UnityException("ProductLookup not found");
        }

        _lkpActual = _lkp;
    }
        private static ProductLookup BuildProductCode(Capture match)
        {
            var productCode = new ProductLookup
            {
                Code       = match.Value,
                CheckDigit = null
            };

            return(productCode);
        }
        public void Match_NonExistingCompositeKey_ThrowException()
        {
            var productLookup = new ProductLookup();

            productLookup.Load();
            var product =

                Assert.Throws <KeyNotFoundException>(delegate { productLookup.Match(new ProductKey {
                    @Class = "Training", Subclass = "SPARQL"
                }); });
        }
        public void Match_ExistingCompositeKey_ReturnValue()
        {
            var productLookup = new ProductLookup();

            productLookup.Load();
            var product = productLookup.Match(new ProductKey {
                @Class = "Training", Subclass = "SQL"
            });

            Assert.That(product.Label, Is.EqualTo("SQL training"));
            Assert.That(product.Hours, Is.EqualTo(40));
        }
示例#6
0
        // Factory binds to Inventory and initializes its container. Will begin crafting if InitialRecipe not null
        public void Initialize(Inventory inventory, ProductLookup productLookup)
        {
            _inventory     = inventory;
            _productLookup = productLookup;
            if (_container == null)
            {
                _container      = gameObject.GetOrAddComponent <CraftingContainer>();
                _container.Info = ProductLookup.Instance.GetContainer(_containerType);
                _container.OnCraftingComplete += StoreProductAndRestartCrafting;
            }

            LoadRecipes();
            if (!string.IsNullOrEmpty(InitialRecipe))
            {
                var recipe = _recipes.FirstOrDefault(i => i.ResultProductName == InitialRecipe);
                if (recipe == null)
                {
                    throw new UnityException(string.Format("ProductFactory initialized with recipe it doesnt have: {0}", InitialRecipe));
                }
                StartCrafting(recipe);
            }
        }
示例#7
0
        public void PriceLookupSpecification_Parse_IfspGlobalPriceLookupData_ReturnsExpectedPluProductCode()
        {
            var priceLookupEnumerator = IfspGlobalPriceLookupData.GetEmumerator();
            var subject = new PriceLookupSpecification();

            while (priceLookupEnumerator.MoveNext())
            {
                // Arrange
                var priceLookup = priceLookupEnumerator.Current;
                var pluCode     = priceLookup.PluCode;
                var expected    = new ProductLookup
                {
                    Code       = pluCode,
                    CheckDigit = null
                };

                // Act
                var actual = subject.Parse(pluCode);

                // Assert
                AssertHelpers.AreComparablyEqual(expected, actual, $"Known valid IFSP Global PLU '{pluCode}' not parsed as expected.");
            }
        }
 public override Task <ProductInfo> GetProductById(ProductLookup request, ServerCallContext context)
 {
     return(base.GetProductById(request, context));
 }