Exemple #1
0
        /// <summary>
        /// Gets the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task GetTransportDocument()
        {
            long?id = ConsoleApp.AskId("Enter the Id of the CMR to retrieve");

            if (id.HasValue)
            {
                TransportDocument transportDocument = await this.GetTransportDocument(id.Value);

                if (transportDocument != null)
                {
                    Console.WriteLine();
                    Console.WriteLine("CMR with ID " + transportDocument.Id.ToString() + " succesfully retrieved!");
                    Console.WriteLine();
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("CMR with ID {0} not found!", id);
                }
            }
        }
        /// <summary>
        /// Gets the transport document by external identifier.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task GetTransportDocumentByExternalId()
        {
            string id = ConsoleApp.AskStringValue("Enter the external Id of the CMR to retrieve");

            if (!string.IsNullOrEmpty(id))
            {
                TransportDocument transportDocument = await this.soapClient.GetTransportDocumentByExternalIdAsync(id);

                if (transportDocument != null)
                {
                    Console.WriteLine();
                    Console.WriteLine("CMR with ID " + transportDocument.Id.ToString() + " succesfully retrieved!");
                    Console.WriteLine();
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("CMR with ID {0} not found!", id);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Gets the transport document by external identifier.
        /// </summary>
        /// <returns>Task.</returns>
        /// <exception cref="NotImplementedException"></exception>
        public async Task GetTransportDocumentByExternalId()
        {
            string id = ConsoleApp.AskStringValue("Enter the external Id of the CMR to retrieve");

            if (!string.IsNullOrEmpty(id))
            {
                var result = await GetTransportDocuments($"filter=externalId eq \"{id}\"");

                TransportDocument transportDocument = result.FirstOrDefault();
                if (transportDocument != null)
                {
                    Console.WriteLine();
                    Console.WriteLine("CMR with ID " + transportDocument.Id.ToString() + " succesfully retrieved!");
                    Console.WriteLine();
                    Console.WriteLine();
                }
                else
                {
                    Console.WriteLine("CMR with ID {0} not found!", id);
                }
            }
        }
Exemple #4
0
        /// <summary>
        /// Updates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task UpdateTransportDocument()
        {
            var id = ConsoleApp.AskId("Enter the Id of the CMR to update");

            TransportDocument newDocument = new TransportDocument
            {
                Id = id,
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe 3",
                            ExternalId = "JOHNDOE_12"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "123459",
                            LicensePlate = "5-JNK-716"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "678990",
                            LicensePlate = "5-TRV-388"
                        },
                    }
                }
            };

            var state = await this.client.PostJsonAsync <TransportDocumentReturnState>(new Uri(this.oauthSettings.BaseUrl + "/api/v2/transportdocuments"), newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }
        /// <summary>
        /// Updates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task UpdateTransportDocument()
        {
            var id = ConsoleApp.AskId("Enter the Id of the CMR to update");

            TransportDocument newDocument = new TransportDocument
            {
                Id = id,
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe 3",
                            ExternalId = "JOHNDOE_12"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "123459",
                            LicensePlate = "5-JNK-716"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "678990",
                            LicensePlate = "5-TRV-388"
                        },
                    }
                }
            };

            TransportDocumentReturnState state = await this.soapClient.CreateTransportDocumentAsync(newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }
Exemple #6
0
        /// <summary>
        /// Creates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task CreateTransportDocument()
        {
            var dossierNumber = ConsoleApp.AskStringValue("DossierNumber");
            var externalId    = ConsoleApp.AskStringValue("ExternalId");

            TransportDocument newDocument = new TransportDocument
            {
                DossierNumber = dossierNumber,
                ExternalId    = externalId,
                IssuedDate    = DateTime.Today,
                Consignor     = new Contact
                {
                    ExternalId = "14-14",
                    Name       = "ACME Bakeries",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                PrimaryCarrier = new Carrier
                {
                    ExternalId = "16-16",
                    Name       = "PIONIRA",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 15",
                        City          = "Zeebrugge",
                        Postalcode    = "8380"
                    },
                    License = "9999999",
                    // Use the signature text to provide the information to put into field 15 of the CMR
                    SignatureText = "Transport PIONIRA"
                },
                Consignee = new Contact
                {
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe",
                            ExternalId = "JOHNDOE_42"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "12345",
                            LicensePlate = "5-JNK-736"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "67890",
                            LicensePlate = "5-TRV-368"
                        },
                    }
                },
                //GoodsText = "2 pal. bruin brood",
                Goods = new Product[]
                {
                    new Product
                    {
                        Code        = "Code",
                        Description = "u",
                        LotNumber   = "-",
                        Quantity    = 5,
                        Reference   = "8",
                        SealNumber  = "Sealnr",
                        ExternalId  = "4646",
                    },
                    new Product
                    {
                        Code       = "Code2",
                        SealNumber = "Sealnr",
                        ExternalId = "422646",
                    }
                },
                ECmr = true
            };

            TransportDocumentReturnState state = await this.client.PostJsonAsync <TransportDocumentReturnState>(new Uri(this.oauthSettings.BaseUrl + "/api/v2/transportdocuments"), newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }
        /// <summary>
        /// Creates the transport document.
        /// </summary>
        /// <returns>Task.</returns>
        public async Task CreateTransportDocument()
        {
            var dossierNumber = ConsoleApp.AskStringValue("DossierNumber");
            var externalId    = ConsoleApp.AskStringValue("ExternalId");

            TransportDocument newDocument = new TransportDocument
            {
                DossierNumber = dossierNumber,
                ExternalId    = externalId,
                IssuedDate    = DateTime.Today,
                IssuedPlace   = "Zeebrugge",
                Consignor     = new Contact
                {
                    ExternalId   = "14-14",
                    Name         = "ACME Bakeries",
                    EmailAddress = "*****@*****.**",
                    Address      = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                Pickup = new Destination
                {
                    ExternalId = "14-14",
                    Name       = "ACME Bakeries",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Zeebrugge",
                        Postalcode    = "8380",
                    },
                    Datetime = DateTime.Now.AddDays(1),
                    // Use the signature text to provide the information to put into field 14 of the CMR
                    SignatureText = "ACME Bakeries"
                },
                PrimaryCarrier = new Carrier
                {
                    ExternalId = "16-16",
                    Name       = "PIONIRA",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 15",
                        City          = "Zeebrugge",
                        Postalcode    = "8380"
                    },
                    License = "9999999",
                    // Use the signature text to provide the information to put into field 15 of the CMR
                    SignatureText = "Transport PIONIRA"
                },
                Consignee = new Contact
                {
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                Delivery = new Destination
                {
                    Datetime   = DateTime.Now.AddDays(2),
                    ExternalId = "15-15",
                    Name       = "ACME Warehouse",
                    Address    = new Address
                    {
                        StreetAddress = "Baron de Maerelaan 8",
                        City          = "Gent",
                        Postalcode    = "9000"
                    }
                },
                TransportExecutions = new TransportExecution[]
                {
                    new TransportExecution
                    {
                        Driver = new Driver
                        {
                            Name       = "John Doe",
                            ExternalId = "JOHNDOE_42"
                        },
                        Truck = new Vehicle
                        {
                            ExternalId   = "12345",
                            LicensePlate = "5-JNK-736"
                        },
                        Trailer = new Vehicle
                        {
                            ExternalId   = "67890",
                            LicensePlate = "5-TRV-368"
                        },
                    }
                },
                GoodsText = "2 pal. bruin brood",
                Goods     = new Product[]
                {
                    new Product
                    {
                        Code       = "Code",
                        SealNumber = "Sealnr",
                        ExternalId = "4646",
                    }
                },
                ECmr = true
            };

            TransportDocumentReturnState state = await this.soapClient.CreateTransportDocumentAsync(newDocument);

            if (state != null)
            {
                Console.WriteLine("CMR succesfully created!");
                DumpReturnState(state);
            }
        }