Exemple #1
0
 public static void AssertFull(this CustomerShipmentCreateComponent @this, CustomerShipment shipment)
 {
     Assert.True(shipment.ExistShipToParty);
     Assert.True(shipment.ExistShipToAddress);
     Assert.True(shipment.ExistHandlingInstruction);
     Assert.True(shipment.ExistComment);
 }
        public ShipmentItemEditTest(TestFixture fixture)
            : base(fixture)
        {
            this.internalOrganisation = new Organisations(this.Session).FindBy(M.Organisation.Name, "Allors BVBA");

            var customerShipments = new CustomerShipments(this.Session).Extent();

            customerShipments.Filter.AddEquals(M.CustomerShipment.ShipFromParty.RoleType, internalOrganisation);
            this.customerShipment = customerShipments.First;

            this.Login();
            this.shipmentListPage = this.Sidenav.NavigateToShipments();
        }
Exemple #3
0
        public static bool AppsIsEligible(ShippingAndHandlingComponent shippingAndHandlingComponent, CustomerShipment customerShipment)
        {
            var withSpecifiedFor        = false;
            var specifiedForValid       = false;
            var withGeographicBoundary  = false;
            var geographicBoundaryValid = false;
            var withShipmentValueBreak  = false;
            var shipmentValueBreakValid = false;
            var withShipmentMethod      = false;
            var shipmentMethodValid     = false;
            var withCarrier             = false;
            var carrierValid            = false;

            // TODO: ???
            //if (shippingAndHandlingComponent.ExistSpecifiedFor)
            //{
            //    withSpecifiedFor = true;

            //    if (customerShipment.ShipFromParty.Equals(shippingAndHandlingComponent.SpecifiedFor))
            //    {
            //        specifiedForValid = true;
            //    }
            //}

            if (shippingAndHandlingComponent.ExistGeographicBoundary)
            {
                withGeographicBoundary = true;

                if (customerShipment.ExistShipToAddress)
                {
                    foreach (GeographicBoundary geographicBoundary in customerShipment.ShipToAddress.GeographicBoundaries)
                    {
                        if (geographicBoundary.Equals(shippingAndHandlingComponent.GeographicBoundary))
                        {
                            geographicBoundaryValid = true;
                        }
                    }
                }
            }

            if (shippingAndHandlingComponent.ExistShipmentMethod)
            {
                withShipmentMethod = true;

                if (customerShipment.ExistShipmentMethod && customerShipment.ShipmentMethod.Equals(shippingAndHandlingComponent.ShipmentMethod))
                {
                    shipmentMethodValid = true;
                }
            }

            if (shippingAndHandlingComponent.ExistCarrier)
            {
                withCarrier = true;

                if (customerShipment.ExistCarrier && customerShipment.Carrier.Equals(shippingAndHandlingComponent.Carrier))
                {
                    carrierValid = true;
                }
            }

            if (shippingAndHandlingComponent.ExistShipmentValue)
            {
                withShipmentValueBreak = true;

                if ((!shippingAndHandlingComponent.ShipmentValue.ExistFromAmount || shippingAndHandlingComponent.ShipmentValue.FromAmount <= customerShipment.ShipmentValue) &&
                    (!shippingAndHandlingComponent.ShipmentValue.ExistThroughAmount || shippingAndHandlingComponent.ShipmentValue.ThroughAmount >= customerShipment.ShipmentValue))
                {
                    shipmentValueBreakValid = true;
                }
            }

            if ((withGeographicBoundary && !geographicBoundaryValid) ||
                (withSpecifiedFor && !specifiedForValid) ||
                (withShipmentMethod && !shipmentMethodValid) ||
                (withCarrier && !carrierValid) ||
                (withShipmentValueBreak && !shipmentValueBreakValid))
            {
                return(false);
            }

            return(true);
        }
Exemple #4
0
        public static CustomerShipmentCreateComponent Build(this CustomerShipmentCreateComponent @this, CustomerShipment shipment, bool minimal = false)
        {
            @this.ShipToParty.Select(shipment.ShipToParty.DisplayName());

            @this.Driver.WaitForAngular();

            if (!minimal)
            {
                @this.ShipToAddress.Select(shipment.ShipToAddress);
                @this.ShipFromAddress.Select(shipment.ShipFromParty?.ShippingAddress);
                @this.ShipmentMethod.Select(shipment.ShipmentMethod);
                @this.ShipFromFacility.Select(((Organisation)shipment.ShipFromParty)?.FacilitiesWhereOwner?.First);
                @this.Carrier.Select(shipment.Carrier);
                @this.EstimatedShipDate.Set(shipment.EstimatedShipDate.Value.Date);
                @this.EstimatedArrivalDate.Set(shipment.EstimatedArrivalDate.Value.Date);
                @this.HandlingInstruction.Set(shipment.HandlingInstruction);
                @this.Comment.Set(shipment.Comment);

                if (shipment.ExistShipToContactPerson)
                {
                    @this.ShipToContactPerson.Select(shipment.ShipToContactPerson);
                }
            }

            return(@this);
        }
        public static bool AppsIsEligible(ShippingAndHandlingComponent shippingAndHandlingComponent, CustomerShipment customerShipment)
        {
            var withSpecifiedFor = false;
            var specifiedForValid = false;
            var withGeographicBoundary = false;
            var geographicBoundaryValid = false;
            var withShipmentValueBreak = false;
            var shipmentValueBreakValid = false;
            var withShipmentMethod = false;
            var shipmentMethodValid = false;
            var withCarrier = false;
            var carrierValid = false;

            if (shippingAndHandlingComponent.ExistSpecifiedFor)
            {
                withSpecifiedFor = true;

                if (customerShipment.ShipFromParty.Equals(shippingAndHandlingComponent.SpecifiedFor))
                {
                    specifiedForValid = true;
                }
            }

            if (shippingAndHandlingComponent.ExistGeographicBoundary)
            {
                withGeographicBoundary = true;

                if (customerShipment.ExistShipToAddress)
                {
                    foreach (Domain.GeographicBoundary geographicBoundary in customerShipment.ShipToAddress.GeographicBoundaries)
                    {
                        if (geographicBoundary.Equals(shippingAndHandlingComponent.GeographicBoundary))
                        {
                            geographicBoundaryValid = true;
                        }
                    }
                }
            }

            if (shippingAndHandlingComponent.ExistShipmentMethod)
            {
                withShipmentMethod = true;

                if (customerShipment.ExistShipmentMethod && customerShipment.ShipmentMethod.Equals(shippingAndHandlingComponent.ShipmentMethod))
                {
                    shipmentMethodValid = true;
                }
            }

            if (shippingAndHandlingComponent.ExistCarrier)
            {
                withCarrier = true;

                if (customerShipment.ExistCarrier && customerShipment.Carrier.Equals(shippingAndHandlingComponent.Carrier))
                {
                    carrierValid = true;
                }
            }

            if (shippingAndHandlingComponent.ExistShipmentValue)
            {
                withShipmentValueBreak = true;

                if ((!shippingAndHandlingComponent.ShipmentValue.ExistFromAmount || shippingAndHandlingComponent.ShipmentValue.FromAmount <= customerShipment.ShipmentValue) &&
                    (!shippingAndHandlingComponent.ShipmentValue.ExistThroughAmount || shippingAndHandlingComponent.ShipmentValue.ThroughAmount >= customerShipment.ShipmentValue))
                {
                    shipmentValueBreakValid = true;
                }
            }

            if ((withGeographicBoundary && !geographicBoundaryValid) ||
                (withSpecifiedFor && !specifiedForValid) ||
                (withShipmentMethod && !shipmentMethodValid) ||
                (withCarrier && !carrierValid) ||
                (withShipmentValueBreak && !shipmentValueBreakValid))
            {
                return false;
            }

            return true;
        }