Ejemplo n.º 1
0
        public CreateAutoOrderRequest(AutoOrder autoOrder)
        {
            if (autoOrder == null)
            {
                return;
            }

            CustomerID = autoOrder.CustomerID;

            if (autoOrder.AutoOrderID != 0)
            {
                ExistingAutoOrderID        = autoOrder.AutoOrderID;
                OverwriteExistingAutoOrder = true;
            }

            Description  = autoOrder.Description;
            StartDate    = autoOrder.StartDate;
            StopDate     = autoOrder.StopDate;
            CurrencyCode = autoOrder.CurrencyCode;
            WarehouseID  = autoOrder.WarehouseID;
            ShipMethodID = autoOrder.ShipMethodID;
            PriceType    = PriceTypes.Wholesale;
            Frequency    = ExigoDAL.GetFrequencyType(autoOrder.FrequencyTypeID);
            PaymentType  = ExigoDAL.GetAutoOrderPaymentType(autoOrder.AutoOrderPaymentTypeID);
            ProcessType  = ExigoDAL.GetAutoOrderProcessType(autoOrder.AutoOrderProcessTypeID);
            Details      = autoOrder.Details.Select(c => new OrderDetailRequest()
            {
                ItemCode                         = c.ItemCode,
                Quantity                         = c.Quantity,
                ParentItemCode                   = c.ParentItemCode,
                BusinessVolumeEachOverride       = c.BVEachOverride,
                CommissionableVolumeEachOverride = c.CVEachOverride,
                DescriptionOverride              = c.ItemDescription,
                PriceEachOverride                = c.PriceEachOverride,
                ShippingPriceEachOverride        = c.ShippingPriceEachOverride,
                TaxableEachOverride              = c.TaxableEachOverride
            }).ToArray();

            if (autoOrder.ShippingAddress != null)
            {
                FirstName  = autoOrder.ShippingAddress.FirstName;
                MiddleName = autoOrder.ShippingAddress.MiddleName;
                LastName   = autoOrder.ShippingAddress.LastName;
                Company    = autoOrder.ShippingAddress.Company;
                Email      = autoOrder.ShippingAddress.Email;
                Phone      = autoOrder.ShippingAddress.Phone;
                Address1   = autoOrder.ShippingAddress.Address1;
                Address2   = autoOrder.ShippingAddress.Address2;
                City       = autoOrder.ShippingAddress.City;
                State      = autoOrder.ShippingAddress.State;
                Zip        = autoOrder.ShippingAddress.Zip;
                Country    = autoOrder.ShippingAddress.Country;
            }

            Notes   = autoOrder.Notes;
            Other11 = autoOrder.Other11;
            Other12 = autoOrder.Other12;
            Other13 = autoOrder.Other13;
            Other14 = autoOrder.Other14;
            Other15 = autoOrder.Other15;
            Other16 = autoOrder.Other16;
            Other17 = autoOrder.Other17;
            Other18 = autoOrder.Other18;
            Other19 = autoOrder.Other19;
            Other20 = autoOrder.Other20;
        }