//-----------------------------------------------------------------------------------------------------
        public FileAnalysis Func_X12_300_GLO_CWO_XUS_SHP_01(
            string filename,
            string errorOut,
            string validOut,
            string processOut = "")
        {
            this.FileStatus = new FileAnalysis();
            if (File.Exists(filename))
            {
                var ediInt = Interchange.LoadFrom(File.OpenRead(filename));
                var xmlInt = new UniversalInterchange();
                if (ediInt.Groups != null)
                {
                    for (var g = 0; g < ediInt.Groups.Count; g++)
                    {
                        xmlInt.Header = new UniversalInterchangeHeader
                        {
                            SenderID = ediInt.Groups[g].Gs.D_142_2,
                            RecipientID = ediInt.Groups[g].Gs.D_124_3
                        };
                        xmlInt.Body = new UniversalInterchangeBody
                        {
                            UniversalShipment =
                                new UniversalShipmentData {version = "1.1"}
                        };
                        for (var m = 0; m < ediInt.Groups[g].Messages.Count; m++)
                        {
                            if (ediInt.Groups[g].Messages[m].Context.Tag == "300")
                            {
                                try
                                {
                                    var objMsg = ediInt.Groups[g].Messages[m].DeserializeItem<M_300>();
                                    var objShp = new Shipment
                                    {
                                        AdditionalTerms = string.Empty,
                                        AgentsReference = string.Empty,
                                        AWBServiceLevel =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        CartageWaybillNumber = string.Empty,
                                        CFSReference = string.Empty,
                                        FirstBuyerContact = string.Empty,
                                        Folio = string.Empty,
                                        OwnerRef = string.Empty,
                                        QuoteNumber = string.Empty,
                                        SecondBuyerContact = string.Empty,
                                        VesselName = string.Empty,
                                        VoyageFlightNo = string.Empty,
                                        WarehouseLocation = string.Empty,
                                        DataContext =
                                            new DataContext
                                            {
                                                DataSourceCollection =
                                                    new List<DataSource>
                                                    {
                                                        new DataSource
                                                        {
                                                            Type
                                                                =
                                                                "ForwardingBooking",
                                                            Key
                                                                =
                                                                string
                                                                    .Empty
                                                        }
                                                    },
                                                DataTargetCollection =
                                                    new List<DataTarget>
                                                    {
                                                        new DataTarget
                                                        {
                                                            Type
                                                                =
                                                                "ForwardingBooking"
                                                        }
                                                    },
                                                ActionPurpose =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "APP",
                                                        Description
                                                            =
                                                            "As Per Payload"
                                                    },
                                                Company =
                                                    new Company
                                                    {
                                                        Code = "JFK",
                                                        Country =
                                                            new Country
                                                            {
                                                                Code
                                                                    =
                                                                    "US",
                                                                Name
                                                                    =
                                                                    "United States"
                                                            },
                                                        Name =
                                                            "Walker International Transportation LLC"
                                                    },
                                                DataProvider = "X12300GLO",
                                                EnterpriseID = "WLT",
                                                EventBranch =
                                                    new Branch
                                                    {
                                                        Code = "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                EventDepartment =
                                                    new Department
                                                    {
                                                        Code =
                                                            "FES",
                                                        Name =
                                                            "Forwarding Export Sea"
                                                    },
                                                EventType =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "ADD"
                                                    },
                                                EventUser =
                                                    new Staff
                                                    {
                                                        Code = "JSM",
                                                        Name =
                                                            "Jerry S. Mabasa"
                                                    },
                                                ServerID = "JNJ",
                                                CodesMappedToTarget = true,
                                                CodesMappedToTargetSpecified =
                                                    true
                                            },
                                        ActualChargeable = 0M,
                                        ActualChargeableSpecified = true,
                                        BookingConfirmationReference = string.Empty,
                                        IsBooking = true,
                                        IsBookingSpecified = true,
                                        ContainerCount = 0,
                                        ContainerCountSpecified = true,
                                        ContainerMode = new ContainerMode(),
                                        FreightRate = 0M,
                                        FreightRateSpecified = true,
                                        FreightRateCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        GoodsDescription = string.Empty,
                                        GoodsValue = 0M,
                                        GoodsValueCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        HBLAWBChargesDisplay =
                                            new CodeDescriptionPair
                                            {
                                                Code = "SHW",
                                                Description =
                                                    "Show Collect Charges"
                                            },
                                        InsuranceValue = 0M,
                                        InsuranceValueCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        InterimReceiptNumber = string.Empty,
                                        IsDirectBooking = false,
                                        IsForwardRegistered = false,
                                        IsNeutralMaster = new IsNeutralMaster {Value = false},
                                        JobCosting =
                                            new ShipmentJobCosting
                                            {
                                                Branch =
                                                    new Branch
                                                    {
                                                        Code =
                                                            "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                Currency =
                                                    new Currency
                                                    {
                                                        Code
                                                            =
                                                            "USD",
                                                        Description
                                                            =
                                                            "United States Dollar"
                                                    },
                                                Department =
                                                    new Department
                                                    {
                                                        Code
                                                            =
                                                            "FES",
                                                        Name
                                                            =
                                                            "Forwarding Export Sea"
                                                    },
                                                HomeBranch =
                                                    new Branch
                                                    {
                                                        Code =
                                                            "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                OperationsStaff =
                                                    new Staff
                                                    {
                                                        Code =
                                                            "JSM"
                                                    },
                                                AccrualNotRecognized = 0M,
                                                AccrualNotRecognizedSpecified
                                                    = true,
                                                AccrualRecognized = 0M,
                                                AccrualRecognizedSpecified
                                                    = true,
                                                AgentRevenue = 0M,
                                                AgentRevenueSpecified =
                                                    true,
                                                LocalClientRevenue = 0M,
                                                LocalClientRevenueSpecified
                                                    = true,
                                                OtherDebtorRevenue = 0M,
                                                OtherDebtorRevenueSpecified
                                                    = true,
                                                SalesStaff =
                                                    new Staff
                                                    {
                                                        Code =
                                                            "JSM",
                                                        Name =
                                                            "Jerry S. Mabasa"
                                                    },
                                                TotalAccrual = 0M,
                                                TotalAccrualSpecified =
                                                    true,
                                                TotalCost = 0M,
                                                TotalCostSpecified = true,
                                                TotalJobProfit = 0M,
                                                TotalJobProfitSpecified =
                                                    true,
                                                TotalRevenue = 0M,
                                                TotalRevenueSpecified =
                                                    true,
                                                TotalWIP = 0M,
                                                TotalWIPSpecified = true,
                                                WIPNotRecognized = 0M,
                                                WIPNotRecognizedSpecified
                                                    = true,
                                                WIPRecognized = 0M,
                                                WIPRecognizedSpecified =
                                                    true,
                                                ChargeLineCollection =
                                                    new List
                                                        <
                                                            ShipmentJobCostingChargeLine
                                                            >()
                                            },
                                        OuterPacks = 0,
                                        OuterPacksSpecified = true,
                                        OuterPacksPackageType =
                                            new PackageType
                                            {
                                                Code = "PCS",
                                                Description = "Pieces"
                                            },
                                        PackingOrder = 0,
                                        ReleaseType =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ServiceLevel =
                                            new ServiceLevel
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ShipmentIncoTerm =
                                            new IncoTerm
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ShippedOnBoard =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        TotalVolume = 0M,
                                        TotalVolumeSpecified = true,
                                        TotalVolumeUnit =
                                            new UnitOfVolume
                                            {
                                                Code = "M3",
                                                Description = "Cubic Meters"
                                            },
                                        TotalWeight = 0M,
                                        TotalWeightUnit =
                                            new UnitOfWeight
                                            {
                                                Code = "KG",
                                                Description = "Kilograms"
                                            },
                                        TotalWeightSpecified = true,
                                        TransportMode =
                                            new CodeDescriptionPair
                                            {
                                                Code = "SEA",
                                                Description =
                                                    "Sea Freight"
                                            },
                                        WayBillNumber = string.Empty,
                                        WayBillType =
                                            new WayBillType
                                            {
                                                Code = "HWB",
                                                Description = "House Waybill"
                                            },
                                        LocalProcessing =
                                            new ShipmentLocalProcessing
                                            {
                                                DeliveryRequiredBy =
                                                    string.Empty,
                                                EstimatedDelivery =
                                                    string.Empty,
                                                EstimatedPickup =
                                                    string.Empty,
                                                FCLDeliveryEquipmentNeeded
                                                    =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "WUP",
                                                        Description
                                                            =
                                                            "Wait for Pack/Unpack"
                                                    },
                                                FCLPickupEquipmentNeeded
                                                    =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "WUP",
                                                        Description
                                                            =
                                                            "Wait for Pack/Unpack"
                                                    },
                                                InsuranceRequired =
                                                    false,
                                                PickupRequiredBy =
                                                    string.Empty,
                                                OrderNumberCollection
                                                    =
                                                    new List
                                                        <
                                                            ShipmentLocalProcessingOrderNumber
                                                            >()
                                            },
                                        ContainerCollection = new ShipmentContainerCollection(),
                                        DateCollection = new List<Date>(),
                                        OrganizationAddressCollection =
                                            new List<OrganizationAddress>(),
                                        NoteCollection = new List<Note>()
                                    };
                                    if (objMsg.S_Y1.D_375_8Specified)
                                    {
                                        objShp.ServiceLevel.Code =
                                            this.Func_SQL_TranslateX12TariffServiceLevel(objMsg.S_Y1.D_375_8.ToString());
                                    }
                                    if ((objMsg.S_B1.D_145_2 != null) || (objMsg.S_B1.D_145_2 != string.Empty))
                                    {
                                        objShp.WayBillNumber = objMsg.S_B1.D_145_2;
                                        objShp.DataContext.DataSourceCollection[0].Key = objMsg.S_B1.D_145_2;
                                    }
                                    var cntCount = 0;
                                    for (var y = 0; y < objMsg.G_Y2.Count; y++)
                                    {
                                        int value;
                                        int.TryParse(objMsg.G_Y2[y].S_Y2.D_95_1, out value);
                                        cntCount += value;
                                    }
                                    objShp.ContainerCount = cntCount;
                                    if (objShp.ContainerCount > 0)
                                    {
                                        objShp.ContainerMode.Code = "FCL";
                                        objShp.ContainerMode.Description = "Full Container Load";
                                    }
                                    else
                                    {
                                        objShp.ContainerMode.Code = "LCL";
                                        objShp.ContainerMode.Description = "Less Container Load";
                                    }
                                    int cntPgk;
                                    int.TryParse(objMsg.G_LX[0].S_L0.D_80_8, out cntPgk);
                                    objShp.OuterPacks = cntPgk;
                                    if (objMsg.G_LX[0].S_L0.D_211_14Specified)
                                    {
                                        objShp.OuterPacksPackageType.Code = objMsg.G_LX[0].S_L0.D_211_14.ToString();
                                        objShp.OuterPacksSpecified = true;
                                    }
                                    else
                                    {
                                        objShp.OuterPacksPackageType.Code = string.Empty;
                                        objShp.OuterPacksSpecified = false;
                                    }
                                    for (var r = 0; r < objMsg.G_R4.Count; r++)
                                    {
                                        switch (objMsg.G_R4[r].S_R4.D_115_1)
                                        {
                                            case EdiFabric.Definitions.X12_004010_300.X12_ID_115.D:
                                            {
                                                objShp.PortOfDischarge = new UNLOCO();
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.AC)
                                                    {
                                                        objShp.PortOfDischarge.Code =
                                                            this.Func_SQL_GetPortCodeFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                        objShp.PortOfDischarge.Name =
                                                            this.Func_SQL_GetPortNameFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                    }
                                                }
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.UN)
                                                    {
                                                        objShp.PortOfDischarge.Code =
                                                            objMsg.G_R4[r].S_R4.D_310_3.Replace(" ", string.Empty);
                                                        objShp.PortOfDischarge.Name = objMsg.G_R4[r].S_R4.D_114_4;
                                                    }
                                                }
                                                foreach (var t in objMsg.G_R4[r].S_DTM)
                                                {
                                                    if (t.D_374_1
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_374.Item371)
                                                    {
                                                        var arv = new Date
                                                        {
                                                            Type = DateType.Arrival,
                                                            Value =
                                                                this.Func_CON_ToISODate_STR(
                                                                    t.D_373_2,
                                                                    t.D_337_3),
                                                            IsEstimate = true,
                                                            IsEstimateSpecified = true
                                                        };
                                                        objShp.DateCollection.Add(arv);
                                                    }
                                                }
                                            }
                                                break;

                                            case EdiFabric.Definitions.X12_004010_300.X12_ID_115.J:
                                            case EdiFabric.Definitions.X12_004010_300.X12_ID_115.L:
                                            {
                                                objShp.PortOfLoading = new UNLOCO();
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.AC)
                                                    {
                                                        objShp.PortOfLoading.Code =
                                                            this.Func_SQL_GetPortCodeFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                        objShp.PortOfLoading.Name =
                                                            this.Func_SQL_GetPortNameFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                    }
                                                }
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.UN)
                                                    {
                                                        objShp.PortOfLoading.Code =
                                                            objMsg.G_R4[r].S_R4.D_310_3.Replace(" ", string.Empty);
                                                        objShp.PortOfLoading.Name = objMsg.G_R4[r].S_R4.D_114_4;
                                                    }
                                                }
                                                foreach (var t in objMsg.G_R4[r].S_DTM)
                                                {
                                                    if (t.D_374_1
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_374.Item010)
                                                    {
                                                        var dep = new Date
                                                        {
                                                            Type = DateType.Departure,
                                                            Value =
                                                                this.Func_CON_ToISODate_STR(
                                                                    t.D_373_2,
                                                                    t.D_337_3),
                                                            IsEstimate = true,
                                                            IsEstimateSpecified = true
                                                        };
                                                        objShp.DateCollection.Add(dep);
                                                    }
                                                }
                                            }
                                                break;

                                            case EdiFabric.Definitions.X12_004010_300.X12_ID_115.R:
                                            {
                                                objShp.PortOfOrigin = new UNLOCO();
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.AC)
                                                    {
                                                        objShp.PortOfOrigin.Code =
                                                            this.Func_SQL_GetPortCodeFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                        objShp.PortOfOrigin.Name =
                                                            this.Func_SQL_GetPortNameFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                    }
                                                }
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.UN)
                                                    {
                                                        objShp.PortOfOrigin.Code =
                                                            objMsg.G_R4[r].S_R4.D_310_3.Replace(" ", string.Empty);
                                                        objShp.PortOfOrigin.Name = objMsg.G_R4[r].S_R4.D_114_4;
                                                    }
                                                }
                                                foreach (var t in objMsg.G_R4[r].S_DTM)
                                                {
                                                    if (t.D_374_1
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_374.Item118)
                                                    {
                                                        objShp.LocalProcessing.EstimatedPickup =
                                                            this.Func_CON_ToISODate_STR(t.D_373_2, t.D_337_3);
                                                        objShp.LocalProcessing.PickupRequiredBy =
                                                            this.Func_CON_ToISODate_STR(t.D_373_2, t.D_337_3);
                                                        var pic = new Date
                                                        {
                                                            Type = DateType.Pickup,
                                                            Value =
                                                                this.Func_CON_ToISODate_STR(
                                                                    t.D_373_2,
                                                                    t.D_337_3),
                                                            IsEstimate = true,
                                                            IsEstimateSpecified = true
                                                        };
                                                        objShp.DateCollection.Add(pic);
                                                    }
                                                }
                                            }
                                                break;

                                            case EdiFabric.Definitions.X12_004010_300.X12_ID_115.E:
                                            {
                                                objShp.PortOfDestination = new UNLOCO();
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.AC)
                                                    {
                                                        objShp.PortOfDestination.Code =
                                                            this.Func_SQL_GetPortCodeFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                        objShp.PortOfDestination.Name =
                                                            this.Func_SQL_GetPortNameFromCityName(
                                                                objMsg.G_R4[r].S_R4.D_310_3,
                                                                objMsg.G_R4[r].S_R4.D_156_8,
                                                                objMsg.G_R4[r].S_R4.D_26_5);
                                                    }
                                                }
                                                if (objMsg.G_R4[r].S_R4.D_309_2Specified)
                                                {
                                                    if (objMsg.G_R4[r].S_R4.D_309_2
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_309.UN)
                                                    {
                                                        objShp.PortOfDestination.Code =
                                                            objMsg.G_R4[r].S_R4.D_310_3.Replace(" ", string.Empty);
                                                        objShp.PortOfDestination.Name = objMsg.G_R4[r].S_R4.D_114_4;
                                                    }
                                                }
                                                foreach (var t in objMsg.G_R4[r].S_DTM)
                                                {
                                                    if (t.D_374_1
                                                        == EdiFabric.Definitions.X12_004010_300.X12_ID_374.Item074)
                                                    {
                                                        objShp.LocalProcessing.DeliveryRequiredBy =
                                                            this.Func_CON_ToISODate_STR(t.D_373_2, t.D_337_3);
                                                        objShp.LocalProcessing.EstimatedDelivery =
                                                            this.Func_CON_ToISODate_STR(t.D_373_2, t.D_337_3);
                                                        var dlv = new Date
                                                        {
                                                            Type = DateType.Delivery,
                                                            Value =
                                                                this.Func_CON_ToISODate_STR(
                                                                    t.D_373_2,
                                                                    t.D_337_3),
                                                            IsEstimate = true,
                                                            IsEstimateSpecified = true
                                                        };
                                                        objShp.DateCollection.Add(dlv);
                                                        var dlvR = new Date
                                                        {
                                                            Type = DateType.DeliveryRequiredBy,
                                                            Value =
                                                                this.Func_CON_ToISODate_STR(
                                                                    t.D_373_2,
                                                                    t.D_337_3),
                                                            IsEstimate = true,
                                                            IsEstimateSpecified = true
                                                        };
                                                        objShp.DateCollection.Add(dlvR);
                                                    }
                                                }
                                            }
                                                break;
                                        }
                                    }
                                    for (var n9 = 0; n9 < objMsg.S_N9.Count; n9++)
                                    {
                                        var str = objMsg.S_N9[n9].D_128_1.ToString();
                                        if (str != string.Empty)
                                        {
                                            switch (str)
                                            {
                                                case "PO":
                                                {
                                                    var objRef = new ShipmentLocalProcessingOrderNumber
                                                    {
                                                        OrderReference
                                                            =
                                                            objMsg
                                                                .S_N9
                                                                //-----------------------------------------------------------------------------------------------------
                                                                [n9]
                                                                .D_127_2
                                                    };
                                                    objShp.LocalProcessing.OrderNumberCollection.Add(objRef);
                                                }
                                                    break;

                                                case "BN":
                                                {
                                                    var objRef =
                                                        new ShipmentAdditionalReferenceCollectionAdditionalReference
                                                        {
                                                            Type
                                                                =
                                                            {
                                                                Code
                                                                    =
                                                                    "BKG"
                                                            },
                                                            ReferenceNumber
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_127_2
                                                        };
                                                    objShp.AdditionalReferenceCollection.AdditionalReference.Add(
                                                        objRef);
                                                }
                                                    break;

                                                case "SI":
                                                {
                                                    var objRef =
                                                        new ShipmentAdditionalReferenceCollectionAdditionalReference
                                                        {
                                                            Type
                                                                =
                                                            {
                                                                Code
                                                                    =
                                                                    "UCR"
                                                            },
                                                            ReferenceNumber
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_127_2
                                                        };
                                                    objShp.AdditionalReferenceCollection.AdditionalReference.Add(
                                                        objRef);
                                                }
                                                    break;

                                                case "TS":
                                                {
                                                    var objRef =
                                                        new ShipmentAdditionalReferenceCollectionAdditionalReference
                                                        {
                                                            Type
                                                                =
                                                            {
                                                                Code
                                                                    =
                                                                    "CON"
                                                            },
                                                            ReferenceNumber
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_127_2
                                                        };
                                                    objShp.AdditionalReferenceCollection.AdditionalReference.Add(
                                                        objRef);
                                                }
                                                    break;

                                                case "OL":
                                                {
                                                    var objRef =
                                                        new ShipmentAdditionalReferenceCollectionAdditionalReference
                                                        {
                                                            Type
                                                                =
                                                            {
                                                                Code
                                                                    =
                                                                    "LID"
                                                            },
                                                            ReferenceNumber
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_127_2,
                                                            ContextInformation
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_369_3
                                                        };
                                                    objShp.AdditionalReferenceCollection.AdditionalReference.Add(
                                                        objRef);
                                                }
                                                    break;

                                                case "MB":
                                                {
                                                    var objRef =
                                                        new ShipmentAdditionalReferenceCollectionAdditionalReference
                                                        {
                                                            Type
                                                                =
                                                            {
                                                                Code
                                                                    =
                                                                    "BKG"
                                                            },
                                                            ReferenceNumber
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_127_2,
                                                            ContextInformation
                                                                =
                                                                objMsg
                                                                    .S_N9
                                                                    [
                                                                        n9
                                                                    ]
                                                                    .D_369_3
                                                        };
                                                    objShp.AdditionalReferenceCollection.AdditionalReference.Add(
                                                        objRef);
                                                }
                                                    break;
                                            }
                                        }
                                    }
                                    for (var cc = 0; cc < objMsg.G_Y2.Count; cc++)
                                    {
                                        var objCnt = new ShipmentContainerCollectionContainer
                                        {
                                            AirVentFlow = 0,
                                            Commodity =
                                                new Commodity
                                                {
                                                    Code
                                                        =
                                                        string
                                                            .Empty,
                                                    Description
                                                        =
                                                        string
                                                            .Empty
                                                },
                                            ContainerType =
                                                new ShipmentContainerCollectionContainerContainerType
                                                {
                                                    Code
                                                        =
                                                        objMsg
                                                            .G_Y2
                                                            [
                                                                cc
                                                            ]
                                                            .S_Y2
                                                            .D_24_4,
                                                    Category
                                                        =
                                                        new ShipmentContainerCollectionContainerContainerTypeCategory
                                                        {
                                                            Code
                                                                =
                                                                string
                                                                    .Empty,
                                                            Description
                                                                =
                                                                string
                                                                    .Empty
                                                        },
                                                    Description
                                                        =
                                                        string
                                                            .Empty,
                                                    ISOCode
                                                        =
                                                        string
                                                            .Empty
                                                },
                                            DepartureEstimatedPickup
                                                = string.Empty,
                                            DepartureSlotDateTime =
                                                string.Empty,
                                            DepartureSlotReference =
                                                string.Empty,
                                            EmptyRequired =
                                                string.Empty,
                                            FCL_LCL_AIR =
                                                new ContainerMode
                                                {
                                                    Code
                                                        =
                                                        Enum
                                                            .GetName
                                                            (
                                                                typeof
                                                                    (
                                                                    X12_ID_102
                                                                    ),
                                                                objMsg
                                                                    .G_Y2
                                                                    [
                                                                        cc
                                                                    ]
                                                                    .S_Y2
                                                                    .D_91_5)
                                                },
                                            ReleaseNum =
                                                string.Empty,
                                            SetPointTemp = 0M,
                                            TempRecorderSerialNo =
                                                string.Empty
                                        };
                                        int intCnt;
                                        int.TryParse(objMsg.G_Y2[cc].S_Y2.D_95_1, out intCnt);
                                        objCnt.ContainerCount = intCnt;
                                        objShp.ContainerCollection.Container.Add(objCnt);
                                    }
                                    objShp.ContainerCollection.Content = CollectionContent.Complete;
                                    objShp.ContainerCollection.ContentSpecified = true;
                                    for (var n1 = 0; n1 < objMsg.G_N1.Count; n1++)
                                    {
                                        var objAdd = new OrganizationAddress();
                                        var str = objMsg.G_N1[n1].S_N1.D_98_1.ToString();
                                        switch (str)
                                        {
                                            case "BT":
                                            {
                                                objAdd.AddressType = "LocalClient";
                                            }
                                                break;

                                            case "SH":
                                            {
                                                objAdd.AddressType = "ConsignorDocumentaryAddress";
                                            }
                                                break;

                                            case "AB":
                                            case "SF":
                                            {
                                                objAdd.AddressType = "ConsignorPickupDeliveryAddress";
                                            }
                                                break;

                                            case "AE":
                                            {
                                                objAdd.AddressType = "ConsigneePickupDeliveryAddress";
                                            }
                                                break;

                                            case "ST":
                                            {
                                                objAdd.AddressType = "ConsigneePickupDeliveryAddress";
                                            }
                                                break;

                                            case "CN":
                                            {
                                                objAdd.AddressType = "ConsigneeDocumentaryAddress";
                                            }
                                                break;
                                        }
                                        if (objAdd.AddressType != string.Empty)
                                        {
                                            if (objMsg.G_N1[n1].S_N1 != null)
                                            {
                                                if (objMsg.G_N1[n1].S_N1.D_67_4 != null)
                                                {
                                                    objAdd.OrganizationCode = objMsg.G_N1[n1].S_N1.D_67_4;
                                                }
                                                if (objMsg.G_N1[n1].S_N1.D_93_2 != null)
                                                {
                                                    objAdd.CompanyName = objMsg.G_N1[n1].S_N1.D_93_2;
                                                }
                                            }
                                            if (objMsg.G_N1[n1].S_N3.Count >= 1)
                                            {
                                                if (objMsg.G_N1[n1].S_N3[0].D_166_1 != null)
                                                {
                                                    objAdd.Address1 = objMsg.G_N1[n1].S_N3[0].D_166_1;
                                                }
                                            }
                                            if (objMsg.G_N1[n1].S_N3.Count >= 2)
                                            {
                                                if (objMsg.G_N1[n1].S_N3[1].D_166_2 != null)
                                                {
                                                    objAdd.Address2 = objMsg.G_N1[n1].S_N3[1].D_166_2;
                                                }
                                            }
                                            objAdd.City = objMsg.G_N1[n1].S_N4.D_19_1;
                                            if (objMsg.G_N1[n1].S_N4 != null)
                                            {
                                                if (objMsg.G_N1[n1].S_N4.D_19_1 != null)
                                                {
                                                    objAdd.City = objMsg.G_N1[n1].S_N4.D_19_1;
                                                }
                                                if (objMsg.G_N1[n1].S_N4.D_156_2 != null)
                                                {
                                                    objAdd.State = objMsg.G_N1[n1].S_N4.D_156_2;
                                                }
                                                if (objMsg.G_N1[n1].S_N4 != null)
                                                {
                                                    if (objMsg.G_N1[n1].S_N4.D_156_2 != null)
                                                    {
                                                        if ((objMsg.G_N1[n1].S_N4.D_19_1 != null)
                                                            && (objMsg.G_N1[n1].S_N4.D_156_2 != null)
                                                            && (objMsg.G_N1[n1].S_N4.D_26_4 != null))
                                                        {
                                                            objAdd.State =
                                                                this.Func_SQL_GetPortStateFromCityName(
                                                                    objMsg.G_N1[n1].S_N4.D_19_1,
                                                                    objMsg.G_N1[n1].S_N4.D_156_2,
                                                                    objMsg.G_N1[n1].S_N4.D_26_4) ?? string.Empty;
                                                        }
                                                    }
                                                }
                                                if (objMsg.G_N1[n1].S_N4.D_116_3 != null)
                                                {
                                                    objAdd.Postcode = objMsg.G_N1[n1].S_N4.D_116_3;
                                                }
                                                if (objMsg.G_N1[n1].S_N4.D_26_4 != null)
                                                {
                                                    objAdd.Country.Code = objMsg.G_N1[n1].S_N4.D_26_4;
                                                }
                                            }
                                            for (var g61 = 0; g61 < objMsg.G_N1[n1].S_G61_2.Count; g61++)
                                            {
                                                if (objMsg.G_N1[n1].S_G61_2[g61].D_93_2 != null)
                                                {
                                                    objAdd.Contact = objMsg.G_N1[n1].S_G61_2[g61].D_93_2;
                                                }
                                                if (objMsg.G_N1[n1].S_G61_2[g61].D_365_3Specified)
                                                {
                                                    if (objMsg.G_N1[n1].S_G61_2[g61].D_365_3 == X12_ID_365.TE)
                                                    {
                                                        objAdd.Phone = objMsg.G_N1[n1].S_G61_2[g61].D_364_4;
                                                    }
                                                    if (objMsg.G_N1[n1].S_G61_2[g61].D_365_3 == X12_ID_365.EM)
                                                    {
                                                        objAdd.Email = objMsg.G_N1[n1].S_G61_2[g61].D_364_4;
                                                    }
                                                }
                                            }
                                            objShp.OrganizationAddressCollection.Add(objAdd);
                                        }
                                    }
                                    var CNE = false;
                                    foreach (var org in objShp.OrganizationAddressCollection)
                                    {
                                        if (org.AddressType == "ConsigneeDocumentaryAddress")
                                        {
                                            CNE = true;
                                        }
                                    }
                                    if (CNE == false)
                                    {
                                        for (var o = 0; o < objShp.OrganizationAddressCollection.Count; o++)
                                        {
                                            if (objShp.OrganizationAddressCollection[o].AddressType
                                                == "ConsigneePickupDeliveryAddress")
                                            {
                                                var objAdd = new OrganizationAddress
                                                {
                                                    AddressType =
                                                        "ConsigneeDocumentaryAddress",
                                                    OrganizationCode =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].OrganizationCode,
                                                    CompanyName =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].CompanyName,
                                                    Address1 =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].Address1,
                                                    Address2 =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].Address2,
                                                    City =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].City,
                                                    State =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].State,
                                                    Postcode =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].Postcode,
                                                    Country =
                                                        objShp
                                                            .OrganizationAddressCollection
                                                            [o].Country
                                                };
                                                objShp.OrganizationAddressCollection.Add(objAdd);
                                            }
                                        }
                                    }
                                    if (objMsg.G_LX[0].S_L1 != null)
                                    {
                                        var decAmnt = 0M;
                                        var chgLine = new ShipmentJobCostingChargeLine
                                        {
                                            Branch =
                                                new Branch
                                                {
                                                    Code = "JFK",
                                                    Name =
                                                        "USJFK - Valley Stream, NY"
                                                },
                                            ChargeCode =
                                                new ChargeCode
                                                {
                                                    Code =
                                                        objMsg
                                                            .G_LX
                                                            [0
                                                            ]
                                                            .S_L1
                                                            .D_150_8
                                                            .ToString
                                                            (),
                                                    Description
                                                        =
                                                        objMsg
                                                            .G_LX
                                                            [0
                                                            ]
                                                            .S_L1
                                                            .D_150_8
                                                            .ToString
                                                            ()
                                                },
                                            ChargeCodeGroup =
                                                new CodeDescriptionPair
                                                {
                                                    Code
                                                        =
                                                        "FRT",
                                                    Description
                                                        =
                                                        "Freight"
                                                },
                                            CostApportionmentConsolNumber
                                                = new EntityReference(),
                                            CostGSTVATID = new TaxID(),
                                            CostIsPosted = false,
                                            CostLocalAmount = 0M,
                                            CostLocalAmountSpecified =
                                                true,
                                            CostOSAmount = 0M,
                                            CostOSAmountSpecified = true,
                                            CostOSCurrency =
                                                new Currency
                                                {
                                                    Code =
                                                        "USD",
                                                    Description
                                                        =
                                                        "United States Dollar"
                                                },
                                            CostOSGSTVATAmount = 0M,
                                            CostOSGSTVATAmountSpecified =
                                                true,
                                            Creditor =
                                                new OrganizationReference
                                                    (),
                                            Debtor =
                                                new OrganizationReference
                                                {
                                                    Key
                                                        =
                                                        "Organization",
                                                    Type
                                                        =
                                                        "GLOX12300"
                                                },
                                            Department =
                                                new Department
                                                {
                                                    Code =
                                                        "FES",
                                                    Name =
                                                        "Forwarding Export Sea"
                                                },
                                            Description =
                                                objMsg.G_LX[0].S_L1
                                                    .D_150_8.ToString(),
                                            ExternalDebtorCode = "JJSLC",
                                            SellInvoiceType = "FIN",
                                            SellIsPosted = false,
                                            SellLocalAmount = 0M,
                                            SellLocalAmountSpecified =
                                                true,
                                            SellOSAmount = 0M,
                                            SellOSCurrency =
                                                new Currency
                                                {
                                                    Code =
                                                        "USD",
                                                    Description
                                                        =
                                                        "United States Dollar"
                                                },
                                            SellOSGSTVATAmount = 0M,
                                            SellOSGSTVATAmountSpecified =
                                                true,
                                            DisplaySequence = 1
                                        };
                                        decimal.TryParse(objMsg.G_LX[0].S_L1.D_58_4, out decAmnt);
                                        chgLine.SellLocalAmount = decAmnt;
                                        objShp.JobCosting.ChargeLineCollection.Add(chgLine);
                                    }
                                    for (var k1 = 0; k1 < objMsg.S_K1.Count; k1++)
                                    {
                                        var note = new Note
                                        {
                                            IsCustomDescription = true,
                                            Description = "Imported Notes",
                                            NoteText =
                                                objMsg.S_K1[k1].D_61_1 + Environment.NewLine
                                                + objMsg.S_K1[k1].D_61_2
                                        };
                                        objShp.NoteCollection.Add(note);
                                    }

                                    var ediList = this.Func_EDI_GetOriginalMessage(filename, '*', '~');
                                    if (ediList.Count > 0)
                                    {
                                        var ediNote = new Note
                                        {
                                            IsCustomDescription = true,
                                            Description = "Original EDI Message"
                                        };
                                        foreach (var item in ediList)
                                        {
                                            if (ediNote.NoteText == string.Empty)
                                            {
                                                ediNote.NoteText = item;
                                            }
                                            else
                                            {
                                                ediNote.NoteText = ediNote.NoteText + Environment.NewLine + item;
                                            }
                                        }
                                        objShp.NoteCollection.Add(ediNote);
                                    }
                                    xmlInt.Body.UniversalShipment.Shipment = objShp;
                                }
                                catch (Exception exc)
                                {
                                    Debug.Print(exc.Message);
                                    throw;
                                }
                            }
                        }
                        xmlInt.Serialize();
                        xmlInt.SaveToFile(
                            string.Concat(validOut, "\\300_GLO_", Path.GetFileNameWithoutExtension(filename), ".xml"));
                        this.FileStatus.FileOutName = string.Concat(
                            validOut,
                            "\\300_GLO_",
                            Path.GetFileNameWithoutExtension(filename),
                            ".xml");
                        this.FileStatus.Status = true;
                        Func_File_Move(filename, string.Concat(processOut, "\\", Path.GetFileName(filename)));
                    }
                }
            }
            else
            {
                this.FileStatus.ExcpMessage = "Cannot Find: " + filename;
            }
            return this.FileStatus;
        }
 /// <summary>
 /// ShipmentTransportLeg class constructor
 /// </summary>
 public ShipmentTransportLeg()
 {
     _customizedFieldCollection = new List<CustomizedField>();
     _departureFrom = new OrganizationAddress();
     _departureCTO = new OrganizationAddress();
     _creditor = new OrganizationAddress();
     _carrierServiceLevel = new ServiceLevel();
     _carrier = new OrganizationAddress();
     _arrivalCTO = new OrganizationAddress();
     _arrivalAt = new OrganizationAddress();
     _portOfLoading = new UNLOCO();
     _portOfDischarge = new UNLOCO();
 }
        //-----------------------------------------------------------------------------------------------------
        public FileAnalysis Func_X12_300_GLO_CWO_XUS_SHP(
            string filename,
            string errorOut,
            string validOut,
            string processOut = "")
        {
            this.FileStatus = new FileAnalysis();
            if (File.Exists(filename))
            {
                var ediInt = Interchange.LoadFrom(File.OpenRead(filename));
                var xmlInt = new UniversalInterchange();
                if (ediInt.Groups != null)
                {
                    for (var g = 0; g < ediInt.Groups.Count; g++)
                    {
                        xmlInt.Header = new UniversalInterchangeHeader
                        {
                            SenderID = ediInt.Groups[g].Gs.D_142_2,
                            RecipientID = ediInt.Groups[g].Gs.D_124_3
                        };
                        xmlInt.Body = new UniversalInterchangeBody
                        {
                            UniversalShipment =
                                new UniversalShipmentData {version = "1.1"}
                        };
                        for (var m = 0; m < ediInt.Groups[g].Messages.Count; m++)
                        {
                            if (ediInt.Groups[g].Messages[m].Context.Tag == "300")
                            {
                                try
                                {
                                    var xmlMsg = ediInt.Serialize();
                                    var objMsg = ediInt.Groups[g].Messages[m].DeserializeItem<M_300>();
                                    var xmlDoc = new XmlDocument();
                                    xmlDoc.LoadXml(xmlMsg.ToString());
                                    var nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
                                    nsmgr.AddNamespace("ns", "www.edifabric.com/x12");
                                    var objShp = new Shipment
                                    {
                                        AdditionalTerms = string.Empty,
                                        AgentsReference = string.Empty,
                                        AWBServiceLevel =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        CartageWaybillNumber = string.Empty,
                                        CFSReference = string.Empty,
                                        FirstBuyerContact = string.Empty,
                                        Folio = string.Empty,
                                        OwnerRef = string.Empty,
                                        QuoteNumber = string.Empty,
                                        SecondBuyerContact = string.Empty,
                                        VesselName = string.Empty,
                                        VoyageFlightNo = string.Empty,
                                        WarehouseLocation = string.Empty,
                                        DataContext =
                                            new DataContext
                                            {
                                                DataSourceCollection =
                                                    new List<DataSource>
                                                    {
                                                        new DataSource
                                                        {
                                                            Type
                                                                =
                                                                "ForwardingBooking",
                                                            Key
                                                                =
                                                                string
                                                                    .Empty
                                                        }
                                                    },
                                                DataTargetCollection =
                                                    new List<DataTarget>
                                                    {
                                                        new DataTarget
                                                        {
                                                            Type
                                                                =
                                                                "ForwardingBooking"
                                                        }
                                                    },
                                                ActionPurpose =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "APP",
                                                        Description
                                                            =
                                                            "As Per Payload"
                                                    },
                                                Company =
                                                    new Company
                                                    {
                                                        Code = "JFK",
                                                        Country =
                                                            new Country
                                                            {
                                                                Code
                                                                    =
                                                                    "US",
                                                                Name
                                                                    =
                                                                    "United States"
                                                            },
                                                        Name =
                                                            "Walker International Transportation LLC"
                                                    },
                                                DataProvider = "X12300GLO",
                                                EnterpriseID = "WLT",
                                                EventBranch =
                                                    new Branch
                                                    {
                                                        Code = "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                EventDepartment =
                                                    new Department
                                                    {
                                                        Code =
                                                            "FES",
                                                        Name =
                                                            "Forwarding Export Sea"
                                                    },
                                                EventType =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            "ADD"
                                                    },
                                                EventUser =
                                                    new Staff
                                                    {
                                                        Code = "JSM",
                                                        Name =
                                                            "Jerry S. Mabasa"
                                                    },
                                                ServerID = "JNJ",
                                                CodesMappedToTarget = true,
                                                CodesMappedToTargetSpecified =
                                                    true
                                            },
                                        ActualChargeable = 0M,
                                        ActualChargeableSpecified = true,
                                        BookingConfirmationReference = string.Empty,
                                        IsBooking = true,
                                        IsBookingSpecified = true,
                                        ContainerCount = 0,
                                        ContainerCountSpecified = true,
                                        ContainerMode = new ContainerMode(),
                                        FreightRate = 0M,
                                        FreightRateSpecified = true,
                                        FreightRateCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        GoodsDescription = string.Empty,
                                        GoodsValue = 0M,
                                        GoodsValueCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        HBLAWBChargesDisplay =
                                            new CodeDescriptionPair
                                            {
                                                Code = "SHW",
                                                Description =
                                                    "Show Collect Charges"
                                            },
                                        InsuranceValue = 0M,
                                        InsuranceValueCurrency =
                                            new Currency
                                            {
                                                Code = "USD",
                                                Description = "United States Dollar"
                                            },
                                        InterimReceiptNumber = string.Empty,
                                        IsDirectBooking = false,
                                        IsForwardRegistered = false,
                                        IsNeutralMaster = new IsNeutralMaster {Value = false},
                                        JobCosting =
                                            new ShipmentJobCosting
                                            {
                                                Branch =
                                                    new Branch
                                                    {
                                                        Code =
                                                            "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                Currency =
                                                    new Currency
                                                    {
                                                        Code
                                                            =
                                                            "USD",
                                                        Description
                                                            =
                                                            "United States Dollar"
                                                    },
                                                Department =
                                                    new Department
                                                    {
                                                        Code
                                                            =
                                                            "FES",
                                                        Name
                                                            =
                                                            "Forwarding Export Sea"
                                                    },
                                                HomeBranch =
                                                    new Branch
                                                    {
                                                        Code =
                                                            "JFK",
                                                        Name =
                                                            "USJFK - Valley Stream, NY"
                                                    },
                                                OperationsStaff =
                                                    new Staff
                                                    {
                                                        Code =
                                                            "JSM"
                                                    },
                                                AccrualNotRecognized = 0M,
                                                AccrualNotRecognizedSpecified
                                                    = true,
                                                AccrualRecognized = 0M,
                                                AccrualRecognizedSpecified
                                                    = true,
                                                AgentRevenue = 0M,
                                                AgentRevenueSpecified =
                                                    true,
                                                LocalClientRevenue = 0M,
                                                LocalClientRevenueSpecified
                                                    = true,
                                                OtherDebtorRevenue = 0M,
                                                OtherDebtorRevenueSpecified
                                                    = true,
                                                SalesStaff =
                                                    new Staff
                                                    {
                                                        Code =
                                                            "JSM",
                                                        Name =
                                                            "Jerry S. Mabasa"
                                                    },
                                                TotalAccrual = 0M,
                                                TotalAccrualSpecified =
                                                    true,
                                                TotalCost = 0M,
                                                TotalCostSpecified = true,
                                                TotalJobProfit = 0M,
                                                TotalJobProfitSpecified =
                                                    true,
                                                TotalRevenue = 0M,
                                                TotalRevenueSpecified =
                                                    true,
                                                TotalWIP = 0M,
                                                TotalWIPSpecified = true,
                                                WIPNotRecognized = 0M,
                                                WIPNotRecognizedSpecified
                                                    = true,
                                                WIPRecognized = 0M,
                                                WIPRecognizedSpecified =
                                                    true,
                                                ChargeLineCollection =
                                                    new List
                                                        <
                                                            ShipmentJobCostingChargeLine
                                                            >()
                                            },
                                        OuterPacks = 0,
                                        OuterPacksSpecified = true,
                                        OuterPacksPackageType =
                                            new PackageType
                                            {
                                                Code = "PCS",
                                                Description = "Pieces"
                                            },
                                        PackingOrder = 0,
                                        ReleaseType =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ServiceLevel =
                                            new ServiceLevel
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ShipmentIncoTerm =
                                            new IncoTerm
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        ShippedOnBoard =
                                            new CodeDescriptionPair
                                            {
                                                Code = string.Empty,
                                                Description = string.Empty
                                            },
                                        TotalVolume = 0M,
                                        TotalVolumeSpecified = true,
                                        TotalVolumeUnit =
                                            new UnitOfVolume
                                            {
                                                Code = "M3",
                                                Description = "Cubic Meters"
                                            },
                                        TotalWeight = 0M,
                                        TotalWeightUnit =
                                            new UnitOfWeight
                                            {
                                                Code = "KG",
                                                Description = "Kilograms"
                                            },
                                        TotalWeightSpecified = true,
                                        TransportMode =
                                            new CodeDescriptionPair
                                            {
                                                Code = "SEA",
                                                Description =
                                                    "Sea Freight"
                                            },
                                        WayBillNumber = string.Empty,
                                        WayBillType =
                                            new WayBillType
                                            {
                                                Code = "HWB",
                                                Description = "House Waybill"
                                            },
                                        LocalProcessing =
                                            new ShipmentLocalProcessing
                                            {
                                                DeliveryRequiredBy =
                                                    string.Empty,
                                                EstimatedDelivery =
                                                    string.Empty,
                                                EstimatedPickup =
                                                    string.Empty,
                                                FCLDeliveryEquipmentNeeded
                                                    =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            string
                                                                .Empty,
                                                        Description
                                                            =
                                                            string
                                                                .Empty
                                                    },
                                                FCLPickupEquipmentNeeded
                                                    =
                                                    new CodeDescriptionPair
                                                    {
                                                        Code
                                                            =
                                                            string
                                                                .Empty,
                                                        Description
                                                            =
                                                            string
                                                                .Empty
                                                    },
                                                InsuranceRequired =
                                                    false,
                                                PickupRequiredBy =
                                                    string.Empty,
                                                OrderNumberCollection
                                                    =
                                                    new List
                                                        <
                                                            ShipmentLocalProcessingOrderNumber
                                                            >()
                                            },
                                        ContainerCollection = new ShipmentContainerCollection(),
                                        PackingLineCollection = new List<PackingLine>(),
                                        DateCollection = new List<Date>(),
                                        OrganizationAddressCollection =
                                            new List<OrganizationAddress>(),
                                        NoteCollection = new List<Note>()
                                    };

                                    objShp.WayBillNumber = this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:S_B1/ns:D_145_2");

                                    objShp.CFSReference = this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:S_B1/ns:D_145_2");

                                    objShp.OwnerRef = objShp.WayBillNumber;

                                    objShp.BookingConfirmationReference = this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:S_N9[ns:D_128_1='MB']/ns:D_127_2");

                                    var orgLOC = new OrganizationAddress
                                    {
                                        AddressType = "LocalClient",
                                        OrganizationCode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/ns:D_67_4"),
                                        CompanyName =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/ns:D_93_2"),
                                        Address1 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N3/ns:D_166_1"),
                                        Address2 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N3/ns:D_166_2"),
                                        City =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                        Postcode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_116_3"),
                                        State =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                        Country =
                                            new Country
                                            {
                                                Code =
                                                    Func_SQL_ConvertCountryISO3ToISO2
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            },
                                        Contact =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='BT']/parent::ns:G_N1_2/ns:S_G61_2[1]/ns:D_93_2"),
                                        Email =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='BT']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='EM']/ns:D_364_4"),
                                        Phone =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='BT']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='TE']/ns:D_364_4"),
                                        Port =
                                            new UNLOCO
                                            {
                                                Code =
                                                    this
                                                        .Func_SQL_GetPortCodeFromCityName
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='BT']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            }
                                    };

                                    objShp.OrganizationAddressCollection.Add(orgLOC);

                                    var orgCNR = new OrganizationAddress
                                    {
                                        AddressType = "ConsignorDocumentaryAddress",
                                        OrganizationCode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/ns:D_67_4"),
                                        CompanyName =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/ns:D_93_2"),
                                        Address1 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N3/ns:D_166_1"),
                                        Address2 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N3/ns:D_166_2"),
                                        City =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                        Postcode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_116_3"),
                                        State =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                        Country =
                                            new Country
                                            {
                                                Code =
                                                    Func_SQL_ConvertCountryISO3ToISO2
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            },
                                        Contact =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SH']/parent::ns:G_N1_2/ns:S_G61_2[1]/ns:D_93_2"),
                                        Email =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SH']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='EM']/ns:D_364_4"),
                                        Phone =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SH']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='TE']/ns:D_364_4"),
                                        Port =
                                            new UNLOCO
                                            {
                                                Code =
                                                    this
                                                        .Func_SQL_GetPortCodeFromCityName
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SH']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            }
                                    };

                                    objShp.OrganizationAddressCollection.Add(orgCNR);

                                    //objShp.PortOfOrigin = new UNLOCO
                                    //{
                                    //    Code = this
                                    //       .Func_SQL_GetPortCodeFromCityName
                                    //       (
                                    //           this
                                    //       .Func_XML_GetResultString
                                    //       (
                                    //           xmlDoc,
                                    //           nsmgr,
                                    //           @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_310_3"),
                                    //           this
                                    //       .Func_XML_GetResultString
                                    //       (
                                    //           xmlDoc,
                                    //           nsmgr,
                                    //           @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_156_8"),
                                    //           this
                                    //       .Func_XML_GetResultString
                                    //       (
                                    //           xmlDoc,
                                    //           nsmgr,
                                    //           @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_26_5"))
                                    //};

                                    var orgCNRPck = new OrganizationAddress
                                    {
                                        AddressType =
                                            "ConsignorPickupDeliveryAddress",
                                        OrganizationCode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/ns:D_67_4"),
                                        CompanyName =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/ns:D_93_2"),
                                        Address1 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N3/ns:D_166_1"),
                                        Address2 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N3/ns:D_166_2"),
                                        City =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                        Postcode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_116_3"),
                                        State =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                        Country =
                                            new Country
                                            {
                                                Code =
                                                    Func_SQL_ConvertCountryISO3ToISO2
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            },
                                        Contact =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SF']/parent::ns:G_N1_2/ns:S_G61_2[1]/ns:D_93_2"),
                                        Email =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SF']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='EM']/ns:D_364_4"),
                                        Phone =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='SF']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='TE']/ns:D_364_4"),
                                        Port =
                                            new UNLOCO
                                            {
                                                Code =
                                                    this
                                                        .Func_SQL_GetPortCodeFromCityName
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='SF']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            }
                                    };
                                    objShp.OrganizationAddressCollection.Add(orgCNRPck);

                                    var orgCNE = new OrganizationAddress
                                    {
                                        AddressType = "ConsigneeDocumentaryAddress",
                                        OrganizationCode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/ns:D_67_4"),
                                        CompanyName =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/ns:D_93_2"),
                                        Address1 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N3/ns:D_166_1"),
                                        Address2 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N3/ns:D_166_2"),
                                        City =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                        Postcode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_116_3"),
                                        State =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                        Country =
                                            new Country
                                            {
                                                Code =
                                                    Func_SQL_ConvertCountryISO3ToISO2
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            },
                                        Contact =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='CN']/parent::ns:G_N1_2/ns:S_G61_2[1]/ns:D_93_2"),
                                        Email =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='CN']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='EM']/ns:D_364_4"),
                                        Phone =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='CN']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='TE']/ns:D_364_4"),
                                        Port =
                                            new UNLOCO
                                            {
                                                Code =
                                                    this
                                                        .Func_SQL_GetPortCodeFromCityName
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='CN']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            }
                                    };
                                    objShp.OrganizationAddressCollection.Add(orgCNE);

                                    //objShp.PortOfDischarge = new UNLOCO
                                    //{
                                    //    Code =
                                    //        this
                                    //        .Func_SQL_GetPortCodeFromCityName
                                    //        (
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_19_1"),
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_156_2"),
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_26_4"))
                                    //};

                                    //objShp.PortOfDestination = new UNLOCO
                                    //{
                                    //    Code =
                                    //        this
                                    //        .Func_SQL_GetPortCodeFromCityName
                                    //        (
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_19_1"),
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_156_2"),
                                    //     this
                                    //        .Func_XML_GetResultString
                                    //        (
                                    //     xmlDoc,
                                    //     nsmgr,
                                    //     @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_N4_2/ns:D_26_4"))
                                    //};

                                    var orgCNEDlv = new OrganizationAddress
                                    {
                                        AddressType =
                                            "ConsigneePickupDeliveryAddress",
                                        OrganizationCode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/ns:D_67_4"),
                                        CompanyName =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/ns:D_93_2"),
                                        Address1 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N3/ns:D_166_1"),
                                        Address2 =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N3/ns:D_166_2"),
                                        City =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                        Postcode =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_116_3"),
                                        State =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                        Country =
                                            new Country
                                            {
                                                Code =
                                                    Func_SQL_ConvertCountryISO3ToISO2
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            },
                                        Contact =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_G61_2[1]/ns:D_93_2"),
                                        Email =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='EM']/ns:D_364_4"),
                                        Phone =
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_204/ns:G_S5/ns:G_N1_2/ns:S_N1_2[ns:D_98_1='ST']/parent::ns:G_N1_2/ns:S_G61_2[ns:D_365_3='TE']/ns:D_364_4"),
                                        Port =
                                            new UNLOCO
                                            {
                                                Code =
                                                    this
                                                        .Func_SQL_GetPortCodeFromCityName
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_19_1"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_156_2"),
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_N1/ns:S_N1[ns:D_98_1='ST']/parent::ns:G_N1/ns:S_N4/ns:D_26_4")),
                                                Name = ""
                                            }
                                    };

                                    objShp.OrganizationAddressCollection.Add(orgCNEDlv);

                                    objShp.ServiceLevel.Code =
                                        this.Func_SQL_TranslateX12TariffServiceLevel(
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:S_Y1/ns:D_375_8"));

                                    if (this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_309_2") == "AC")
                                    {
                                        objShp.PortOfOrigin = new UNLOCO
                                        {
                                            Code =
                                                this.Func_SQL_GetPortCodeFromCityName(
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_310_3"),
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_156_8"),
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_26_5"))
                                        };
                                    }
                                    else
                                    {
                                        objShp.PortOfOrigin = new UNLOCO
                                        {
                                            Code =
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='R']/ns:D_310_3")
                                        };
                                    }

                                    if (this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='L']/ns:D_309_2") == "AC")
                                    {
                                        objShp.PortOfLoading = new UNLOCO
                                        {
                                            Code =
                                                this.Func_SQL_GetPortCodeFromCityName(
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='L']/ns:D_310_3"),
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='L']/ns:D_156_8"),
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='L']/ns:D_26_5"))
                                        };
                                    }
                                    else
                                    {
                                        objShp.PortOfLoading = new UNLOCO
                                        {
                                            Code =
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='L']/ns:D_310_3")
                                        };
                                    }

                                    if (this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='D']/ns:D_309_2") == "AC")
                                    {
                                        objShp.PortOfDischarge = new UNLOCO
                                        {
                                            Code =
                                                this
                                                    .Func_SQL_GetPortCodeFromCityName(
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='D']/ns:D_310_3"),
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='D']/ns:D_156_8"),
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='D']/ns:D_26_5"))
                                        };
                                    }
                                    else
                                    {
                                        objShp.PortOfDischarge = new UNLOCO
                                        {
                                            Code =
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='D']/ns:D_310_3")
                                        };
                                    }

                                    if (this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='E']/ns:D_309_2") == "AC")
                                    {
                                        objShp.PortOfDestination = new UNLOCO
                                        {
                                            Code =
                                                this
                                                    .Func_SQL_GetPortCodeFromCityName(
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='E']/ns:D_310_3"),
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='E']/ns:D_156_8"),
                                                        this.Func_XML_GetResultString(
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='E']/ns:D_26_5"))
                                        };
                                    }
                                    else
                                    {
                                        objShp.PortOfDestination = new UNLOCO
                                        {
                                            Code =
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_R4[ns:D_115_1='E']/ns:D_310_3")
                                        };
                                    }

                                    if (string.IsNullOrEmpty(objShp.PortOfDestination.Code))
                                    {
                                        objShp.PortOfDestination = objShp.PortOfDischarge;
                                    }

                                    objShp.TotalWeight = this.Func_XML_GetResultIntNumber(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_81_4");
                                    objShp.TotalWeightUnit = new UnitOfWeight
                                    {
                                        Code =
                                            this
                                                .Func_SQL_TranslateX12_Weight_UoM(
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_188_11"))
                                    };
                                    objShp.TotalWeightSpecified = true;

                                    objShp.DocumentedWeight = objShp.TotalWeight;
                                    objShp.DocumentedWeightSpecified = true;

                                    objShp.ManifestedWeight = objShp.TotalWeight;
                                    objShp.ManifestedWeightSpecified = true;

                                    objShp.TotalVolume = this.Func_XML_GetResultIntNumber(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_183_6");
                                    objShp.TotalVolumeUnit = new UnitOfVolume
                                    {
                                        Code =
                                            this
                                                .Func_SQL_TranslateX12_Volume_UoM(
                                                    this.Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_184_7"))
                                    };
                                    objShp.TotalVolumeSpecified = true;

                                    objShp.DocumentedVolume = objShp.TotalVolume;
                                    objShp.DocumentedVolumeSpecified = true;

                                    objShp.ManifestedVolume = objShp.TotalVolume;
                                    objShp.ManifestedVolumeSpecified = true;

                                    objShp.OuterPacks = this.Func_XML_GetResultIntNumber(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_80_8");
                                    objShp.OuterPacksPackageType = new PackageType
                                    {
                                        Code =
                                            Func_SQL_GetCWOPackageForm(
                                                this
                                                    .Func_XML_GetResultString(
                                                        xmlDoc,
                                                        nsmgr,
                                                        @"//ns:M_300/ns:G_LX/ns:S_L0/ns:D_211_9"))
                                    };
                                    objShp.OuterPacksSpecified = true;

                                    var packLine = new PackingLine
                                    {
                                        PackQty = objShp.OuterPacks,
                                        PackType =
                                            new PackageType
                                            {
                                                Code =
                                                    objShp
                                                        .OuterPacksPackageType
                                                        .Code,
                                                Description =
                                                    objShp
                                                        .OuterPacksPackageType
                                                        .Description
                                            },
                                        Weight = objShp.TotalWeight,
                                        WeightUnit = objShp.TotalWeightUnit,
                                        WeightSpecified = true,
                                        Volume = objShp.TotalVolume,
                                        VolumeUnit = objShp.TotalVolumeUnit,
                                        VolumeSpecified = true
                                    };
                                    objShp.PackingLineCollection.Add(packLine);

                                    var cntData = new ShipmentContainerCollectionContainer
                                    {
                                        AirVentFlow = 0,
                                        Commodity =
                                            new Commodity
                                            {
                                                Code
                                                    =
                                                    string
                                                        .Empty,
                                                Description
                                                    =
                                                    string
                                                        .Empty
                                            },
                                        ContainerType =
                                            new ShipmentContainerCollectionContainerContainerType
                                            {
                                                ISOCode
                                                    =
                                                    this
                                                        .Func_XML_GetResultString
                                                        (
                                                            xmlDoc,
                                                            nsmgr,
                                                            @"//ns:M_300/ns:G_Y2/ns:S_Y2/ns:D_24_4"),
                                                Code
                                                    =
                                                    Func_SQL_GetCWOContainerType
                                                        (
                                                            this
                                                                .Func_XML_GetResultString
                                                                (
                                                                    xmlDoc,
                                                                    nsmgr,
                                                                    @"//ns:M_300/ns:G_Y2/ns:S_Y2/ns:D_24_4"))
                                            }
                                    };
                                    cntData.ContainerCount = this.Func_XML_GetResultIntNumber(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:G_Y2/ns:S_Y2/ns:D_95_1");

                                    objShp.ContainerCollection.Container.Add(cntData);

                                    objShp.LocalProcessing.EstimatedPickup =
                                        this.Func_CON_ToISODate_ISO(
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='118']/ns:D_373_2"),
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='118']/ns:D_337_3"));
                                    objShp.LocalProcessing.PickupRequiredBy = objShp.LocalProcessing.EstimatedPickup;
                                    //this.Func_CON_ToISODate_ISO(
                                    //    this.Func_XML_GetResultString(
                                    //        xmlDoc,
                                    //        nsmgr,
                                    //        @"//ns:M_204/ns:G_S5/ns:S_G62_2[ns:D_176_3='K']/ns:D_373_2"),
                                    //    this.Func_XML_GetResultString(
                                    //        xmlDoc,
                                    //        nsmgr,
                                    //        @"//ns:M_204/ns:G_S5/ns:S_G62_2[ns:D_176_3='K']/ns:D_337_4"));
                                    objShp.LocalProcessing.EstimatedDelivery =
                                        this.Func_CON_ToISODate_ISO(
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='371']/ns:D_373_2"),
                                            this.Func_XML_GetResultString(
                                                xmlDoc,
                                                nsmgr,
                                                @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='371']/ns:D_337_3"));
                                    objShp.LocalProcessing.DeliveryRequiredBy = objShp.LocalProcessing.EstimatedDelivery;
                                    //this.Func_CON_ToISODate_ISO(
                                    //    this.Func_XML_GetResultString(
                                    //        xmlDoc,
                                    //        nsmgr,
                                    //        @"//ns:M_204/ns:G_S5/ns:S_G62_2[ns:D_176_3='L']/ns:D_373_2"),
                                    //    this.Func_XML_GetResultString(
                                    //        xmlDoc,
                                    //        nsmgr,
                                    //        @"//ns:M_204/ns:G_S5/ns:S_G62_2[ns:D_176_3='L']/ns:D_337_4"));

                                    var dteETD = new Date
                                    {
                                        Type = DateType.Departure,
                                        IsEstimate = true,
                                        IsEstimateSpecified = true,
                                        Value =
                                            this.Func_CON_ToISODate_ISO(
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='010']/ns:D_373_2"),
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='010']/ns:D_337_3"))
                                    };

                                    objShp.DateCollection.Add(dteETD);

                                    var dteETA = new Date
                                    {
                                        Type = DateType.Arrival,
                                        IsEstimate = true,
                                        IsEstimateSpecified = true,
                                        Value =
                                            this.Func_CON_ToISODate_ISO(
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='371']/ns:D_373_2"),
                                                this.Func_XML_GetResultString(
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:G_R4/ns:S_DTM[ns:D_374_1='371']/ns:D_337_3"))
                                    };

                                    objShp.DateCollection.Add(dteETA);

                                    var dteBkd = new Date
                                    {
                                        Type = DateType.BookingConfirmed,
                                        IsEstimate = false,
                                        IsEstimateSpecified = true,
                                        Value =
                                            this.Func_CON_ToISODate_ISO(
                                                ediInt.Groups[g].Gs.D_29_4,
                                                ediInt.Groups[g].Gs.D_30_5)
                                        //this.Func_CON_ToISODate_ISO(this.Func_XML_GetResultString(xmlDoc, nsmgr, @"//ns:M_204/ns:S_G62/ns:D_373_2"), this.Func_XML_GetResultString(xmlDoc, nsmgr, @"//ns:M_204///ns:S_G62/ns:D_337_4"))
                                    };

                                    objShp.DateCollection.Add(dteBkd);

                                    var ordRef = new ShipmentLocalProcessingOrderNumber();
                                    ordRef.OrderReference = this.Func_XML_GetResultString(
                                        xmlDoc,
                                        nsmgr,
                                        @"//ns:M_300/ns:S_N9[ns:D_128_1='PO']/ns:D_127_2");

                                    objShp.LocalProcessing.OrderNumberCollection.Add(ordRef);

                                    var ucrRef = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type =
                                        {
                                            Code
                                                =
                                                "UCR"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='SI']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(ucrRef.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(ucrRef);
                                    }

                                    var oagRef = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type =
                                        {
                                            Code
                                                =
                                                "OAG"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='CG']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(oagRef.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(oagRef);
                                    }

                                    var bkgRefBn = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type
                                            =
                                        {
                                            Code
                                                =
                                                "BKG"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='BN']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(bkgRefBn.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(bkgRefBn);
                                    }

                                    var bkgRefMb = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type
                                            =
                                        {
                                            Code
                                                =
                                                "BKG"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='MB']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(bkgRefMb.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(bkgRefMb);
                                    }

                                    var bkgCon = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type =
                                        {
                                            Code
                                                =
                                                "CON"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='TS']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(bkgCon.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(bkgCon);
                                    }

                                    var bkgLid = new ShipmentAdditionalReferenceCollectionAdditionalReference
                                    {
                                        Type =
                                        {
                                            Code
                                                =
                                                "LID"
                                        },
                                        ReferenceNumber
                                            =
                                            this
                                                .Func_XML_GetResultString
                                                (
                                                    xmlDoc,
                                                    nsmgr,
                                                    @"//ns:M_300/ns:S_N9[ns:D_128_1='OL']/ns:D_127_2")
                                    };

                                    if (!string.IsNullOrEmpty(bkgLid.ReferenceNumber))
                                    {
                                        objShp.AdditionalReferenceCollection.AdditionalReference.Add(bkgLid);
                                    }

                                    var ediList = this.Func_EDI_GetOriginalMessage(filename, '*', '~');
                                    if (ediList.Count > 0)
                                    {
                                        var ediNote = new Note
                                        {
                                            IsCustomDescription = true,
                                            Description = "Original EDI Message"
                                        };
                                        foreach (var item in ediList)
                                        {
                                            if (ediNote.NoteText == string.Empty)
                                            {
                                                ediNote.NoteText = item;
                                            }
                                            else
                                            {
                                                ediNote.NoteText = ediNote.NoteText + Environment.NewLine + item;
                                            }
                                        }
                                        objShp.NoteCollection.Add(ediNote);
                                    }

                                    //var ediAdd = new Note
                                    //{
                                    //    IsCustomDescription = true,
                                    //    Description = "Must Respond By"
                                    //};

                                    //ediAdd.NoteText = "Must Respond By: " + Func_CON_ToISODate_DTM(this.Func_XML_GetResultString(xmlDoc, nsmgr, @"//ns:M_204/ns:S_G62/ns:D_373_2 "), this.Func_XML_GetResultString(xmlDoc, nsmgr, @"//ns:M_204/ns:S_G62/ns:D_337_4"));

                                    //objShp.NoteCollection.Add(ediAdd);

                                    xmlInt.Body.UniversalShipment.Shipment = objShp;
                                }
                                catch (Exception exc)
                                {
                                    Debug.Print(exc.Message);
                                    throw;
                                }
                            }
                        }
                        xmlInt.Serialize();
                        xmlInt.SaveToFile(
                            string.Concat(validOut, "\\300_GLO_", Path.GetFileNameWithoutExtension(filename), ".xml"));
                        this.FileStatus.FileOutName = string.Concat(
                            validOut,
                            "\\300_GLO_",
                            Path.GetFileNameWithoutExtension(filename),
                            ".xml");
                        this.FileStatus.Status = true;
                        Func_File_Move(filename, string.Concat(processOut, "\\", Path.GetFileName(filename)));
                    }
                }
            }
            else
            {
                this.FileStatus.ExcpMessage = "Cannot Find: " + filename;
            }
            return this.FileStatus;
        }
 /// <summary>
 /// ShipmentOrderOrderLine class constructor
 /// </summary>
 public ShipmentOrderOrderLine()
 {
     _uNDGCollection = new List<UNDG>();
     _customizedFieldCollection = new List<CustomizedField>();
     _weightUnit = new UnitOfWeight();
     _volumeUnit = new UnitOfVolume();
     _unitPriceCurrency = new Currency();
     _status = new CodeDescriptionPair();
     _product = new ShipmentOrderOrderLineProduct();
     _packageQtyUnit = new PackageType();
     _orderedQtyUnit = new CodeDescriptionPair();
     _location = new ShipmentOrderOrderLineLocation();
     _innerPacksQtyUnit = new PackageType();
     _incoTerm = new IncoTerm();
     _customsData = new ShipmentOrderOrderLineCustomsData();
     _consignee = new OrganizationAddress();
     _commodity = new Commodity();
 }
 /// <summary>
 /// ShipmentInstruction class constructor
 /// </summary>
 public ShipmentInstruction()
 {
     _instructionPackingLineLinkCollection = new List<ShipmentInstructionInstructionPackingLineLink>();
     _instructionContainerLinkCollection = new List<ShipmentInstructionInstructionContainerLink>();
     _customizedFieldCollection = new List<CustomizedField>();
     _type = new CodeDescriptionPair();
     _status = new CodeDescriptionPair();
     _dropMode = new CodeDescriptionPair();
     _address = new OrganizationAddress();
 }
 /// <summary>
 /// CommercialInfoCommercialInvoice class constructor
 /// </summary>
 public CommercialInfoCommercialInvoice()
 {
     _organizationAddressCollection = new List<OrganizationAddress>();
     _noteCollection = new List<Note>();
     _customsReferenceCollection = new List<CustomsReference>();
     _commercialInvoiceLineCollection = new List<CommercialInfoCommercialInvoiceCommercialInvoiceLine>();
     _commercialChargeCollection = new List<CommercialCharge>();
     _addInfoGroupCollection = new List<AddInfoGroup>();
     _addInfoCollection = new List<AddInfo>();
     _weightUnit = new UnitOfWeight();
     _volumeUnit = new UnitOfVolume();
     _supplier = new OrganizationAddress();
     _messageStatus = new CodeDescriptionPair();
     _invoiceCurrency = new Currency();
     _incoTerm = new CodeDescriptionPair();
     _exchangeRateType = new CodeDescriptionPair();
     _buyer = new OrganizationAddress();
     _billType = new WayBillType();
 }
 /// <summary>
 /// DataTarget class constructor
 /// </summary>
 public DataTarget()
 {
     _owner = new OrganizationAddress();
 }
 /// <summary>
 /// AdditionalService class constructor
 /// </summary>
 public AdditionalService()
 {
     _location = new OrganizationAddress();
     _contractor = new OrganizationAddress();
     _serviceCode = new CodeDescriptionPair();
 }
 public static bool LoadFromFile(string fileName, out OrganizationAddress obj)
 {
     Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an OrganizationAddress object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output OrganizationAddress object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, out OrganizationAddress obj, out Exception exception)
 {
     exception = null;
     obj = default(OrganizationAddress);
     try
     {
         obj = LoadFromFile(fileName);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string input, out OrganizationAddress obj)
 {
     Exception exception = null;
     return Deserialize(input, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an OrganizationAddress object
 /// </summary>
 /// <param name="input">string workflow markup to deserialize</param>
 /// <param name="obj">Output OrganizationAddress object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this Serializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string input, out OrganizationAddress obj, out Exception exception)
 {
     exception = null;
     obj = default(OrganizationAddress);
     try
     {
         obj = Deserialize(input);
         return true;
     }
     catch (Exception ex)
     {
         exception = ex;
         return false;
     }
 }