예제 #1
0
        public bool SetSalesChannel(SalesChannel salesChannel)
        {
            IRepository <SalesChannel> salesChannelRepository = _mongoDB.Build <SalesChannel>("SalesChannel");

            salesChannelRepository.DeleteManyAsync(a => a.SalesChannelId == salesChannel.SalesChannelId);
            return(salesChannelRepository.InsertOneAsync(salesChannel).IsCompletedSuccessfully);
        }
예제 #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("ID,CreatedDateUtc,IsActive,Name,Description")] SalesChannel salesChannel)
        {
            if (id != salesChannel.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salesChannel);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalesChannelExists(salesChannel.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(salesChannel));
        }
        public async Task <IActionResult> PutSalesChannel([FromRoute] int id, [FromBody] SalesChannel salesChannel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != salesChannel.Id)
            {
                return(BadRequest());
            }

            salesChannel.UpdatedAt = DateTimeOffset.Now;

            _context.Entry(salesChannel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SalesChannelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(Ok(_context.SalesChannels.Find(id)));
        }
예제 #4
0
 public async Task <ActionResult> Create([Bind(Include = "SalesChannelID,Code, Description")] SalesChannel salesChannel)
 {
     if (ModelState.IsValid)
     {
         await salesChannelRepository.CreateAsync(salesChannel);
     }
     return(RedirectToAction("Index"));
 }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            SalesChannel salesChannel = db.SalesChannels.Find(id);

            db.SalesChannels.Remove(salesChannel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
 public ActionResult Edit([Bind(Include = "SalesChennelID,SalesChannelName")] SalesChannel salesChannel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(salesChannel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(salesChannel));
 }
예제 #7
0
        public SalesChannelSingleViewModel(SalesChannel saleChannel)
        {
            if (saleChannel == null)
            {
                return;
            }

            this.SalesChannelID = saleChannel.SalesChannelID;
            this.FullName       = saleChannel.Code + " - " + saleChannel.Description;
        }
예제 #8
0
        public async Task <ActionResult> Delete(int id)
        {
            SalesChannel salesChannel = await salesChannelRepository.FindSalesChannelByIDAsync(id);

            if (salesChannel == null)
            {
                return(HttpNotFound());
            }
            return(View(salesChannel));
        }
예제 #9
0
        public ActionResult Create([Bind(Include = "SalesChennelID,SalesChannelName")] SalesChannel salesChannel)
        {
            if (ModelState.IsValid)
            {
                db.SalesChannels.Add(salesChannel);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(salesChannel));
        }
예제 #10
0
        public async Task <IActionResult> Create([Bind("ID,CreatedDateUtc,IsActive,Name,Description")] SalesChannel salesChannel)
        {
            if (ModelState.IsValid)
            {
                salesChannel.ID = Guid.NewGuid();
                _context.Add(salesChannel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(salesChannel));
        }
예제 #11
0
        public async Task <Offer> For(ClientId clientId, SalesChannel salesChannel,
                                      ImmutableArray <ProductAmount> productAmounts, Currency currency)
        {
            var offerRequest = OfferRequest.For(clientId, salesChannel, productAmounts);

            var(basePrices, offerModificator, exchangeRate) = await(
                _priceLists.GetBasePricesFor(clientId, productAmounts),
                _offerModifiers.ChooseFor(offerRequest),
                _exchangeRates.GetFor(currency));
            return(Offer.WithBasePrices(productAmounts, basePrices)
                   .Apply(offerModificator)
                   .Apply(exchangeRate));
        }
예제 #12
0
        // GET: SalesChannels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SalesChannel salesChannel = db.SalesChannels.Find(id);

            if (salesChannel == null)
            {
                return(HttpNotFound());
            }
            return(View(salesChannel));
        }
예제 #13
0
        public CounterpartyJournalFilterViewModel()
        {
            UpdateWith(
                x => x.CounterpartyType,
                x => x.RestrictIncludeArchive,
                x => x.Tag
                );

            SalesChannel salesChannelAlias = null;
            SalesChannelSelectableNode salesChannelSelectableNodeAlias = null;

            var list = UoW.Session.QueryOver(() => salesChannelAlias)
                       .SelectList(scList => scList
                                   .SelectGroup(() => salesChannelAlias.Id).WithAlias(() => salesChannelSelectableNodeAlias.Id)
                                   .Select(() => salesChannelAlias.Name).WithAlias(() => salesChannelSelectableNodeAlias.Name)
                                   ).TransformUsing(Transformers.AliasToBean <SalesChannelSelectableNode>()).List <SalesChannelSelectableNode>();

            SalesChannels = new GenericObservableList <SalesChannelSelectableNode>(list);
        }
        public async Task <IActionResult> PostSalesChannel([FromBody] SalesChannel salesChannel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            salesChannel.Status = Status.Active;

            var now = DateTimeOffset.Now;

            salesChannel.CreatedAt = now;
            salesChannel.UpdatedAt = now;

            _context.SalesChannels.Add(salesChannel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSalesChannel", new { id = salesChannel.Id }, salesChannel));
        }
예제 #15
0
            public async Task <Response> Handle(Command command, CancellationToken cancel)
            {
                var existing = await _salesChannelRepository
                               .Get(SalesChannelSpecs.WithSalesChannelId(command.SalesChannelId), cancel);

                if (existing is not null)
                {
                    existing.ChangeLocations(command.Locations);
                    _salesChannelRepository.Update(existing);
                }
                else
                {
                    var salesChannel = new SalesChannel(command.SalesChannelId, command.Locations);
                    _salesChannelRepository.Add(salesChannel);
                }

                await _uow.Commit(cancel);

                return(new Response());
            }
예제 #16
0
        public List <Availability> GetAvailability(string salesChannelId, List <string> skus)
        {
            IRepository <SalesChannel> salesChannelRepository = _mongoDB.Build <SalesChannel>("SalesChannel");
            IRepository <Stock>        stockRepository        = _mongoDB.Build <Stock>("Stock");
            IRepository <Lock>         lockRepository         = _mongoDB.Build <Lock>("Lock");
            List <Availability>        availabilityList       = new List <Availability>();

            SalesChannel salesChannel = salesChannelRepository.FindOneAsync(s => s.SalesChannelId == salesChannelId).Result;

            if (salesChannel is null)
            {
                return(availabilityList);
            }

            List <Stock> stockList = stockRepository.FindAsync(s => s.Quantity > 0 && salesChannel.Location.Contains(s.Location) && skus.Contains(s.Sku)).Result;

            foreach (string sku in skus)
            {
                List <LocationQuantity> locationQuantityList = new List <LocationQuantity>();
                foreach (var stock in stockList.Where(a => a.Sku == sku))
                {
                    Lock Lock  = lockRepository.FindOneAsync(f => stock.Sku == f.SKU && stock.Location == f.Location).Result;
                    int  locks = Lock is Lock ? Lock.Amount : 0;
                    locationQuantityList.Add(new LocationQuantity()
                    {
                        Location = stock.Location, Quantity = stock.Quantity - locks
                    });
                }
                if (locationQuantityList.Count > 0)
                {
                    Availability availability = new Availability();
                    availability.SKU = sku;
                    availability.LocationQuantities = locationQuantityList;
                    availabilityList.Add(availability);
                }
            }

            return(availabilityList);
        }
예제 #17
0
        public OutSalesChannel GetSalesChannel()
        {
            string          connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutSalesChannel response         = new OutSalesChannel();
            var             ora = new OracleServer(connectionString);

            SalesChannel        salesChannel;
            List <SalesChannel> list = new List <SalesChannel>();
            string command           = string.Empty;

            try
            {
                command = " SELECT codigo_tipo, nombre_tipo FROM BBS_LIQCOM_V_CNL_VENTA";
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    salesChannel      = new SalesChannel();
                    salesChannel.Code = DBNull.Value.Equals(rdr["codigo_tipo"]) ? 0 : double.Parse(rdr["codigo_tipo"].ToString());
                    salesChannel.Name = DBNull.Value.Equals(rdr["nombre_tipo"]) ? string.Empty : rdr["nombre_tipo"].ToString();
                    list.Add(salesChannel);
                }
                rdr.Close();
                response.lstSalesChannel  = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetSalesChannel", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }
예제 #18
0
    private void ResetChannelCombo(SalesChannel channel)
    {
        switch (channel)
        {
            case SalesChannel.Erom:
                ClearComboData(cboTPS);
                cboTROM.SelectedIndex = -1;

                ClearComboData(cboPSS2);
                cboEROM2.SelectedIndex = -1;
                break;
            case SalesChannel.Erom2:
                ClearComboData(cboTPS);
                cboTROM.SelectedIndex = -1;

                ClearComboData(cboPSS1);
                cboEROM.SelectedIndex = -1;
                break;
            default:
                ClearComboData(cboPSS1);
                cboEROM.SelectedIndex = -1;

                ClearComboData(cboPSS2);
                cboEROM2.SelectedIndex = -1;
                break;
        }

    }
    private void ResetChannelCombo(SalesChannel channel)
    {
        switch (channel)
        {
            case SalesChannel.Erom:
                UtilitiesHelpers.Instance.ClearComboData(cboTPS);
                UtilitiesHelpers.Instance.ClearComboData(cboTPR);
                cboTROM.SelectedIndex = 0;

                UtilitiesHelpers.Instance.ClearComboData(cboPSS2);
                UtilitiesHelpers.Instance.ClearComboData(cboPSR2);
                cboEROM2.SelectedIndex = 0;
                break;
            case SalesChannel.Erom2:
                UtilitiesHelpers.Instance.ClearComboData(cboTPS);
                UtilitiesHelpers.Instance.ClearComboData(cboTPR);
                cboTROM.SelectedIndex = 0;

                UtilitiesHelpers.Instance.ClearComboData(cboPSS1);
                UtilitiesHelpers.Instance.ClearComboData(cboPSR1);
                cboEROM.SelectedIndex = 0;
                break;
            default:
                UtilitiesHelpers.Instance.ClearComboData(cboPSS1);
                UtilitiesHelpers.Instance.ClearComboData(cboPSR1);
                cboEROM.SelectedIndex = 0;

                UtilitiesHelpers.Instance.ClearComboData(cboPSS2);
                UtilitiesHelpers.Instance.ClearComboData(cboPSR2);
                cboEROM2.SelectedIndex = 0;
                break;
        }
    }
예제 #20
0
        internal override bool isValid()
        {
            if (DatePaidFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DatePaidTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateRequiredFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateRequiredTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateInvoicedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateInvoicedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DatePlacedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DatePlacedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateUpdatedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (DateCompletedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (DateCompletedTo != DateTime.MinValue)
            {
                return(true);
            }

            if (WarehouseQuantityUpdatedFrom != DateTime.MinValue)
            {
                return(true);
            }

            if (WarehouseQuantityUpdatedTo != DateTime.MinValue)
            {
                return(true);
            }

            int requiredFilterCount = OrderID.NullSafeLength() +
                                      Username.NullSafeLength() +
                                      SKU.NullSafeLength() +
                                      Supplier.NullSafeLength() +
                                      WarehouseID.NullSafeLength() +
                                      ShippingMethod.NullSafeLength() +
                                      SalesChannel.NullSafeLength();


            if (requiredFilterCount != 0)
            {
                return(true);
            }

            throw new NetoRequestException("At least one filter is required in the GetOrder request");
        }
예제 #21
0
 public Task <Offer> For(ClientId clientId, SalesChannel salesChannel,
                         IEnumerable <ProductAmount> productAmounts, Currency currency) =>
 For(clientId, salesChannel, productAmounts.ToImmutableArray(), currency);
예제 #22
0
 public async Task <Quote> For(ClientId clientId, SalesChannel salesChannel, ProductAmount productAmount,
                               Currency currency) =>
 (await For(clientId, salesChannel, new ImmutableArray <ProductAmount> {
     productAmount
 }, currency))
 .Quotes.Single();
예제 #23
0
        public static bool BaseIsApplicable(IsApplicable isApplicable)
        {
            var priceComponent  = isApplicable.PriceComponent;
            var customer        = isApplicable.Customer;
            var product         = isApplicable.Product;
            var salesOrder      = isApplicable.SalesOrder;
            var quantityOrdered = isApplicable.QuantityOrdered;
            var valueOrdered    = isApplicable.ValueOrdered;
            var salesInvoice    = isApplicable.SalesInvoice;

            var withGeographicBoundary    = false;
            var geographicBoundaryValid   = false;
            var withProductCategory       = false;
            var productCategoryValid      = false;
            var withPartyClassification   = false;
            var partyClassificationValid  = false;
            var withOrderKind             = false;
            var orderKindValid            = false;
            var withOrderQuantityBreak    = false;
            var orderQuantityBreakValid   = false;
            var withRevenueValueBreak     = false;
            var revenueValueBreakValid    = false;
            var withRevenueQuantityBreak  = false;
            var revenueQuantityBreakValid = false;
            var withPackageQuantityBreak  = false;
            var packageQuantityBreakValid = false;
            var withOrderValue            = false;
            var orderValueValid           = false;
            var withSalesChannel          = false;
            var salesChannelValid         = false;

            if (priceComponent.ExistGeographicBoundary)
            {
                withGeographicBoundary = true;

                PostalAddress postalAddress = null;
                if (salesOrder != null && salesOrder.ExistDerivedShipToAddress)
                {
                    postalAddress = salesOrder.DerivedShipToAddress;
                }

                if (salesInvoice != null && salesInvoice.ExistDerivedShipToAddress)
                {
                    postalAddress = salesInvoice.DerivedShipToAddress;
                }

                if (postalAddress == null && customer != null)
                {
                    postalAddress = customer.ShippingAddress;
                }

                if (postalAddress != null)
                {
                    foreach (GeographicBoundary geographicBoundary in postalAddress.PostalAddressBoundaries)
                    {
                        if (geographicBoundary.Equals(priceComponent.GeographicBoundary))
                        {
                            geographicBoundaryValid = true;
                        }
                    }
                }
            }

            if (priceComponent.ExistPartyClassification && customer != null)
            {
                withPartyClassification = true;

                foreach (PartyClassification partyClassification in customer.PartyClassifications)
                {
                    if (partyClassification.Equals(priceComponent.PartyClassification))
                    {
                        partyClassificationValid = true;
                    }
                }
            }

            if (priceComponent.ExistProductCategory)
            {
                withProductCategory = true;

                foreach (ProductCategory productCategory in product.ProductCategoriesWhereProduct)
                {
                    if (productCategory.Equals(priceComponent.ProductCategory))
                    {
                        productCategoryValid = true;
                    }
                }

                if (productCategoryValid == false)
                {
                    foreach (ProductCategory productCategory in product.ProductCategoriesWhereProduct)
                    {
                        foreach (ProductCategory ancestor in productCategory.ProductCategoriesWhereDescendant)
                        {
                            if (ancestor.Equals(priceComponent.ProductCategory))
                            {
                                productCategoryValid = true;
                            }
                        }
                    }
                }
            }

            if (priceComponent.ExistOrderKind)
            {
                withOrderKind = true;

                if (salesOrder != null && salesOrder.ExistOrderKind && salesOrder.OrderKind.Equals(priceComponent.OrderKind))
                {
                    orderKindValid = true;
                }
            }

            if (priceComponent.ExistSalesChannel)
            {
                withSalesChannel = true;

                SalesChannel channel = null;
                if (salesOrder != null)
                {
                    channel = salesOrder.SalesChannel;
                }

                if (salesInvoice != null)
                {
                    channel = salesInvoice.SalesChannel;
                }

                if (channel.Equals(priceComponent.SalesChannel))
                {
                    salesChannelValid = true;
                }
            }

            if (priceComponent.ExistOrderQuantityBreak)
            {
                withOrderQuantityBreak = true;

                if ((!priceComponent.OrderQuantityBreak.ExistFromAmount || priceComponent.OrderQuantityBreak.FromAmount <= quantityOrdered) &&
                    (!priceComponent.OrderQuantityBreak.ExistThroughAmount || priceComponent.OrderQuantityBreak.ThroughAmount >= quantityOrdered))
                {
                    orderQuantityBreakValid = true;
                }
            }

            if (priceComponent.ExistOrderValue)
            {
                withOrderValue = true;

                if ((!priceComponent.OrderValue.ExistFromAmount || priceComponent.OrderValue.FromAmount <= valueOrdered) &&
                    (!priceComponent.OrderValue.ExistThroughAmount || priceComponent.OrderValue.ThroughAmount >= valueOrdered))
                {
                    orderValueValid = true;
                }
            }

            if ((withGeographicBoundary && !geographicBoundaryValid) ||
                (withPartyClassification && !partyClassificationValid) ||
                (withProductCategory && !productCategoryValid) ||
                (withOrderKind && !orderKindValid) ||
                (withOrderQuantityBreak && !orderQuantityBreakValid) ||
                (withRevenueValueBreak && !revenueValueBreakValid) ||
                (withRevenueQuantityBreak && !revenueQuantityBreakValid) ||
                (withPackageQuantityBreak && !packageQuantityBreakValid) ||
                (withOrderValue && !orderValueValid) ||
                (withSalesChannel & !salesChannelValid))
            {
                return(false);
            }

            return(true);
        }
예제 #24
0
 private OfferRequest(ClientId clientId, SalesChannel salesChannel, ImmutableArray <ProductAmount> productAmounts)
 {
     ClientId       = clientId;
     SalesChannel   = salesChannel;
     ProductAmounts = productAmounts;
 }
예제 #25
0
 public static OfferRequest For(ClientId clientId, SalesChannel salesChannel,
                                ImmutableArray <ProductAmount> productAmounts) =>
 new OfferRequest(clientId, salesChannel, productAmounts);
예제 #26
0
        private void InsertTestData(ApplicationDbContext context)
        {
            if (!context.Countries.Any())
            {
                List <CountryDto> countries = TestDataGenerator.TestDataGenerator.GenerateCountries();
                foreach (var country in countries)
                {
                    Country newCountry = new Country()
                    {
                        CountryName = country.CountryName
                    };
                    context.Countries.Add(newCountry);
                }
            }

            if (!context.Regions.Any())
            {
                List <RegionDto> regions = TestDataGenerator.TestDataGenerator.GenerateRegions();
                foreach (var item in regions)
                {
                    Region newItem = new Region()
                    {
                        RegionName = item.RegionName
                    };
                    context.Regions.Add(newItem);
                }
            }

            if (!context.OrderPriorities.Any())
            {
                List <OrderPriorityDto> orderPriorities = TestDataGenerator.TestDataGenerator.GenerateOrderPriorities();
                foreach (var item in orderPriorities)
                {
                    OrderPriority newItem = new OrderPriority()
                    {
                        OrderPriorityName = item.OrderPriorityName
                    };
                    context.OrderPriorities.Add(newItem);
                }
            }

            if (!context.SalesChannels.Any())
            {
                List <SalesChannelDto> salesChannels = TestDataGenerator.TestDataGenerator.GenerateSalesChannels();
                foreach (var item in salesChannels)
                {
                    SalesChannel newItem = new SalesChannel()
                    {
                        SalesChannelName = item.SalesChannelName
                    };
                    context.SalesChannels.Add(newItem);
                }
            }

            if (!context.ItemTypes.Any())
            {
                List <ItemTypeDto> itemTypes = TestDataGenerator.TestDataGenerator.GenerateItemTypes();
                foreach (var item in itemTypes)
                {
                    ItemType newItem = new ItemType()
                    {
                        ItemTypeName = item.ItemTypeName
                    };
                    context.ItemTypes.Add(newItem);
                }
            }
        }
예제 #27
0
        public static bool AppsIsEligible(IsEligibleParams isEligibleParams)
        {
            var priceComponent  = isEligibleParams.PriceComponent;
            var customer        = isEligibleParams.Customer;
            var product         = isEligibleParams.Product;
            var salesOrder      = isEligibleParams.SalesOrder;
            var quantityOrdered = isEligibleParams.QuantityOrdered;
            var valueOrdered    = isEligibleParams.ValueOrdered;
            var salesInvoice    = isEligibleParams.SalesInvoice;

            var withGeographicBoundary    = false;
            var geographicBoundaryValid   = false;
            var withProductCategory       = false;
            var productCategoryValid      = false;
            var withPartyClassification   = false;
            var partyClassificationValid  = false;
            var withOrderKind             = false;
            var orderKindValid            = false;
            var withOrderQuantityBreak    = false;
            var orderQuantityBreakValid   = false;
            var withRevenueValueBreak     = false;
            var revenueValueBreakValid    = false;
            var withRevenueQuantityBreak  = false;
            var revenueQuantityBreakValid = false;
            var withPackageQuantityBreak  = false;
            var packageQuantityBreakValid = false;
            var withOrderValue            = false;
            var orderValueValid           = false;
            var withSalesChannel          = false;
            var salesChannelValid         = false;

            if (priceComponent.ExistGeographicBoundary)
            {
                withGeographicBoundary = true;

                PostalAddress postalAddress = null;
                if (salesOrder != null && salesOrder.ExistShipToAddress)
                {
                    postalAddress = salesOrder.ShipToAddress;
                }

                if (salesInvoice != null && salesInvoice.ExistShipToAddress)
                {
                    postalAddress = salesInvoice.ShipToAddress;
                }

                if (postalAddress == null && customer != null)
                {
                    postalAddress = customer.ShippingAddress;
                }

                if (postalAddress != null)
                {
                    foreach (GeographicBoundary geographicBoundary in postalAddress.GeographicBoundaries)
                    {
                        if (geographicBoundary.Equals(priceComponent.GeographicBoundary))
                        {
                            geographicBoundaryValid = true;
                        }
                    }
                }
            }

            if (priceComponent.ExistPartyClassification && customer != null)
            {
                withPartyClassification = true;

                foreach (PartyClassification partyClassification in customer.PartyClassifications)
                {
                    if (partyClassification.Equals(priceComponent.PartyClassification))
                    {
                        partyClassificationValid = true;
                    }
                }
            }

            if (priceComponent.ExistProductCategory)
            {
                withProductCategory = true;

                foreach (ProductCategory productCategory in product.ProductCategoriesWhereProduct)
                {
                    if (productCategory.Equals(priceComponent.ProductCategory))
                    {
                        productCategoryValid = true;
                    }
                }

                if (productCategoryValid == false)
                {
                    foreach (ProductCategory productCategory in product.ProductCategoriesWhereProduct)
                    {
                        foreach (ProductCategory ancestor in productCategory.SuperJacent)
                        {
                            if (ancestor.Equals(priceComponent.ProductCategory))
                            {
                                productCategoryValid = true;
                            }
                        }
                    }
                }
            }

            if (priceComponent.ExistOrderKind)
            {
                withOrderKind = true;

                if (salesOrder != null && salesOrder.ExistOrderKind && salesOrder.OrderKind.Equals(priceComponent.OrderKind))
                {
                    orderKindValid = true;
                }
            }

            if (priceComponent.ExistOrderQuantityBreak)
            {
                withOrderQuantityBreak = true;

                if ((!priceComponent.OrderQuantityBreak.ExistFromAmount || priceComponent.OrderQuantityBreak.FromAmount <= quantityOrdered) &&
                    (!priceComponent.OrderQuantityBreak.ExistThroughAmount || priceComponent.OrderQuantityBreak.ThroughAmount >= quantityOrdered))
                {
                    orderQuantityBreakValid = true;
                }
            }

            if (priceComponent.ExistOrderValue)
            {
                withOrderValue = true;

                if ((!priceComponent.OrderValue.ExistFromAmount || priceComponent.OrderValue.FromAmount <= valueOrdered) &&
                    (!priceComponent.OrderValue.ExistThroughAmount || priceComponent.OrderValue.ThroughAmount >= valueOrdered))
                {
                    orderValueValid = true;
                }
            }

            if (priceComponent.ExistSalesChannel)
            {
                withSalesChannel = true;

                SalesChannel channel = null;
                if (salesOrder != null)
                {
                    channel = salesOrder.SalesChannel;
                }

                if (salesInvoice != null)
                {
                    channel = salesInvoice.SalesChannel;
                }

                if (channel.Equals(priceComponent.SalesChannel))
                {
                    salesChannelValid = true;
                }
            }

            // TODO: Revenue Value Break
            //if (priceComponent.ExistRevenueValueBreak)
            //{
            //    withRevenueValueBreak = true;

            //    var revenueValueBreak = priceComponent.RevenueValueBreak;

            //    var revenue = 0M;
            //    if (priceComponent.ExistProductCategory && partyProductCategoryRevenueHistoryByProductCategory != null)
            //    {
            //        if (partyProductCategoryRevenueHistoryByProductCategory.ContainsKey(priceComponent.ProductCategory))
            //        {
            //            revenue = partyProductCategoryRevenueHistoryByProductCategory[priceComponent.ProductCategory].Revenue;
            //        }
            //    }
            //    else
            //    {
            //        if (partyRevenueHistory != null)
            //        {
            //            revenue = partyRevenueHistory.Revenue;
            //        }
            //    }

            //    if ((!revenueValueBreak.ExistFromAmount || revenueValueBreak.FromAmount <= revenue) &&
            //        (!revenueValueBreak.ExistThroughAmount || revenueValueBreak.ThroughAmount >= revenue))
            //    {
            //        revenueValueBreakValid = true;
            //    }
            //}

            // TODO: Revenue Quantity Break
            //if (priceComponent.ExistRevenueQuantityBreak)
            //{
            //    withRevenueQuantityBreak = true;

            //    var revenueQuantityBreak = priceComponent.RevenueQuantityBreak;

            //    var quantity = 0M;
            //    if (priceComponent.ExistProductCategory && partyProductCategoryRevenueHistoryByProductCategory != null)
            //    {
            //        if (partyProductCategoryRevenueHistoryByProductCategory.ContainsKey(priceComponent.ProductCategory))
            //        {
            //            quantity = partyProductCategoryRevenueHistoryByProductCategory[priceComponent.ProductCategory].Quantity;
            //        }
            //    }

            //    if ((!revenueQuantityBreak.ExistFrom || revenueQuantityBreak.From <= quantity) &&
            //        (!revenueQuantityBreak.ExistThrough || revenueQuantityBreak.Through >= quantity))
            //    {
            //        revenueQuantityBreakValid = true;
            //    }
            //}

            // TODO: Package Quantity Break
            //if (priceComponent.ExistPackageQuantityBreak)
            //{
            //    withPackageQuantityBreak = true;

            //    var packageQuantityBreak = priceComponent.PackageQuantityBreak;

            //    var quantity = 0;
            //    if (partyPackageRevenueHistoryList != null)
            //    {
            //        foreach (var partyPackageRevenueHistory in partyPackageRevenueHistoryList)
            //        {
            //            if (partyPackageRevenueHistory.Revenue > 0)
            //            {
            //                quantity++;
            //            }
            //        }
            //    }

            //    if ((!packageQuantityBreak.ExistFrom || packageQuantityBreak.From <= quantity) &&
            //        (!packageQuantityBreak.ExistThrough || packageQuantityBreak.Through >= quantity))
            //    {
            //        packageQuantityBreakValid = true;
            //    }
            //}

            if ((withGeographicBoundary && !geographicBoundaryValid) ||
                (withPartyClassification && !partyClassificationValid) ||
                (withProductCategory && !productCategoryValid) ||
                (withOrderKind && !orderKindValid) ||
                (withOrderQuantityBreak && !orderQuantityBreakValid) ||
                (withRevenueValueBreak && !revenueValueBreakValid) ||
                (withRevenueQuantityBreak && !revenueQuantityBreakValid) ||
                (withPackageQuantityBreak && !packageQuantityBreakValid) ||
                (withOrderValue && !orderValueValid) ||
                (withSalesChannel & !salesChannelValid))
            {
                return(false);
            }

            return(true);
        }