Esempio n. 1
0
        private DeliveryBubble MapLegacyDelivery(DeliveryLegacy legacyDelivery)
        {
            if (string.IsNullOrEmpty(legacyDelivery.CT_ST) || !legacyDelivery.CT_ST.Contains(' '))
            {
                throw new Exception("Invalid city and state.");
            }

            string[] cityAndState = legacyDelivery.CT_ST.Split(' ');

            return(new DeliveryBubble
            {
                DeliveryID = legacyDelivery.NMB_CLM,
                DestinationStreet = (legacyDelivery.STR ?? string.Empty).Trim(),
                DestinationCity = cityAndState[0].Trim(),
                DestinationState = cityAndState[1].Trim(),
                DestinationZipCode = (legacyDelivery.ZP ?? string.Empty).Trim()
            });
        }
Esempio n. 2
0
        private DeliveryBubble MapLegacyDelivery(DeliveryLegacy legacyDelivery)
        {
            if (legacyDelivery.CT_ST == null || !legacyDelivery.CT_ST.Contains(" "))
            {
                throw new Exception("Invalid city and state");
            }

            string[] cityAndState = legacyDelivery.CT_ST.Split(' ');

            var delivery = new DeliveryBubble
            {
                DeliveryID         = legacyDelivery.NMB_CLM,
                DestinationStreet  = (legacyDelivery.STR ?? "").Trim(),
                DestinationCity    = cityAndState[0].Trim(),
                DestinationState   = cityAndState[1].Trim(),
                DestinationZipCode = (legacyDelivery.ZP ?? "").Trim()
            };

            return(delivery);
        }
Esempio n. 3
0
        private IList <DeliveryLegacy> MapBubbleDeliveries(IList <DeliveryBubble> updatedDeliveries)
        {
            var result = new List <DeliveryLegacy>();

            foreach (DeliveryBubble bubbleDelivery in updatedDeliveries)
            {
                var legacyDelivery = new DeliveryLegacy
                {
                    NMB_CLM  = bubbleDelivery.DeliveryID,
                    ESTM_CLM = (double?)bubbleDelivery.CostEstimate
                };
                if (bubbleDelivery.Lines.Count > 0)
                {
                    legacyDelivery.PRD_LN_1     = bubbleDelivery.Lines[0].ProductID;
                    legacyDelivery.PRD_LN_1_AMN = bubbleDelivery.Lines[0].Amount.ToString();
                }
                if (bubbleDelivery.Lines.Count > 1)
                {
                    legacyDelivery.PRD_LN_2     = bubbleDelivery.Lines[1].ProductID;
                    legacyDelivery.PRD_LN_2_AMN = bubbleDelivery.Lines[1].Amount.ToString();
                }
                if (bubbleDelivery.Lines.Count > 2)
                {
                    legacyDelivery.PRD_LN_3     = bubbleDelivery.Lines[2].ProductID;
                    legacyDelivery.PRD_LN_3_AMN = bubbleDelivery.Lines[2].Amount.ToString();
                }
                if (bubbleDelivery.Lines.Count > 3)
                {
                    legacyDelivery.PRD_LN_4     = bubbleDelivery.Lines[3].ProductID;
                    legacyDelivery.PRD_LN_4_AMN = bubbleDelivery.Lines[3].Amount.ToString();
                }
                result.Add(legacyDelivery);
            }

            return(result);
        }