Exemple #1
0
        private static void BuildPriceBands(Events.IngredientUpdated.Types.SuppliedPackSize.Builder builder, List <IngredientPriceBand> priceBands)
        {
            foreach (var priceBand in priceBands)
            {
                var priceBandBuilder = Events.IngredientUpdated.Types.SuppliedPackSize.Types.PriceBand.CreateBuilder();

                priceBandBuilder.SetPrice(Decimal.BuildFromDecimal(priceBand.Price))
                .SetName(priceBand.Name)
                .SetId(priceBand.Id.ToString());
                builder.AddPriceBands(priceBandBuilder);
            }
        }
Exemple #2
0
        private static void BuildSuppliedPackSizes(Events.IngredientUpdated.Builder builder, List <IngredientSuppliedPackSize> suppliedPackList, List <CategoryType> categoryTypes, List <IngredientPriceBand> priceBands)
        {
            if (suppliedPackList.Count > 0)
            {
                foreach (var suppliedPack in suppliedPackList)
                {
                    var suppliedPackSizeBuilder = Events.IngredientUpdated.Types.SuppliedPackSize.CreateBuilder();

                    suppliedPackSizeBuilder.SetIsDefault(suppliedPack.IsDefault)
                    .SetIsPreferred(suppliedPack.IsPreferred)
                    .SetDistributorName(suppliedPack.DistributorName)
                    .SetDistributorCode(suppliedPack.DistributorCode)
                    .SetDistributorUom(suppliedPack.DistributorUom)
                    .SetSupplyQuantityNumber(suppliedPack.SupplyQuantityNumber)
                    .SetSupplyQuantityQuantity(suppliedPack.SupplyQuantityQuantity)
                    .SetSupplyQuantityUom(suppliedPack.SupplyQuantityUom)
                    .SetSupplyQuantityPackDescription(suppliedPack.SupplyQuantityPackDescription)
                    .SetCostPrice(suppliedPack.CostPrice)
                    .SetCostPricePerItem(suppliedPack.CostPricePerItem)
                    .SetCurrencyIso4217Code(suppliedPack.CurrencyIso4217Code)
                    .SetIsOrderable(suppliedPack.IsOrderable)
                    .SetMaxOrderQuantity(suppliedPack.MaxOrderQuantity)
                    .SetMinOrderQuantity(suppliedPack.MinOrderQuantity)
                    .SetCreatedUserFirstName(suppliedPack.CreatedUserFirstName)
                    .SetCreatedUserLastName(suppliedPack.CreatedUserLastName)
                    .SetCaptureDate(suppliedPack.CaptureDate)
                    .SetModifiedUserFirstName(suppliedPack.ModifiedUserFirstName)
                    .SetModifiedUserLastName(suppliedPack.ModifiedUserLastName)
                    .SetModifiedDate(suppliedPack.ModifiedDate)
                    .SetRetailBarCodeDetails(suppliedPack.RetailBarCodeDetails)
                    .SetRankOrder(suppliedPack.RankOrder)
                    .SetInvoicePrice(Decimal.BuildFromDecimal(suppliedPack.InvoicePrice))
                    .SetInvoiceUnitOfMeasure(suppliedPack.InvoiceUnitOfMeasure)
                    .SetIsVariableWeighted(suppliedPack.IsVariableWeighted)
                    ;

                    var            productCategoryTypes = categoryTypes.Where(ct => ct.ProductId == suppliedPack.ProductId).ToList();
                    Func <dynamic> createCategoryType   = () => Events.IngredientUpdated.Types.CategoryType.CreateBuilder();
                    Func <dynamic> createCategory       = () => Events.IngredientUpdated.Types.CategoryType.Types.Category.CreateBuilder();
                    BuilderHelpers.BuildCategoryTypes(suppliedPackSizeBuilder, createCategoryType, createCategory, productCategoryTypes);

                    BuildPriceBands(suppliedPackSizeBuilder, priceBands.Where(p => p.ProductId == suppliedPack.ProductId).ToList());

                    builder.AddSuppliedPackSizes(suppliedPackSizeBuilder);
                }
            }
        }