示例#1
0
        public CreateConsignmentRequest GetCreateConsignmentRequest(string saediFromId, string rmaId, string clientRef, out string onlineBookingURL)
        {
            ClientBLL clientBLL = new ClientBLL();
            Client    client = clientBLL.GetBySaediId(saediFromId, programVersion: "2");
            Address   collectionAddress, toAddress;

            onlineBookingURL = client.OspRef.OnlineBookingURL;

            string line1 = client.DeliveryAddress.Address1.ReplaceNullAndWhiteSpaceWithEmptyString();
            string line2 = client.DeliveryAddress.Address2.ReplaceNullAndWhiteSpaceWithEmptyString();
            string line3 = "";

            string[] address = new string[4];
            address[0] = client.DeliveryAddress.Address3.ReplaceNullAndWhiteSpaceWithEmptyString();
            address[1] = client.DeliveryAddress.Address4.ReplaceNullAndWhiteSpaceWithEmptyString();
            address[2] = client.DeliveryAddress.Address5.ReplaceNullAndWhiteSpaceWithEmptyString();
            address[3] = client.DeliveryAddress.Additional.ReplaceNullAndWhiteSpaceWithEmptyString();

            for (int i = 0; i < 4; i++)
            {
                if (line3 != "" && address[i] != "")
                {
                    line3 += (" " + address[i]);
                }
                else if (address[i] != "")
                {
                    line3 = address[i];
                }
            }

            collectionAddress = new Address(client.CompanyName, line1, line2, line3, "", client.TelNo, client.EmailAddress, client.DeliveryAddress.City, client.DeliveryAddress.PostalCode, client.DeliveryAddress.Country);

            toAddress = new Address(_shipmateConfig.DeliveryToName,
                                    _shipmateConfig.DeliveryToLine1,
                                    _shipmateConfig.DeliveryToLine2,
                                    _shipmateConfig.DeliveryToLine3,
                                    _shipmateConfig.DeliveryToCompanyName,
                                    _shipmateConfig.DeliveryToTelephone,
                                    _shipmateConfig.DeliveryToEmail,
                                    _shipmateConfig.DeliveryToCity,
                                    _shipmateConfig.DeliveryToPostcode,
                                    _shipmateConfig.DeliveryToCountry);

            return(new CreateConsignmentRequest(int.Parse(clientRef), rmaId, null, _shipmateConfig.ShipmateServiceKey, collectionAddress, toAddress, null));
        }