/// <summary>
 /// Add a Ship Address For Calculated Shipping
 /// </summary>
 /// <param name="id">The ID of the Ship From</param>
 /// <param name="city">
 /// The &lt;city&gt; tag identifies the city associated with a
 /// shipping adrress
 /// </param>
 /// <param name="region">
 /// The &lt;region&gt; tag identifies the state or province associated
 /// with a shipping address.
 /// </param>
 /// <param name="postalCode">
 /// The &lt;postal-code&gt; tag identifies the zip code or postal code.
 /// </param>
 /// <param name="addressCategory">
 /// The &lt;delivery-address-category&gt; tag indicates whether the shipping 
 /// method should be applied to a residential or a commercial address. Valid
 /// values for this tag are RESIDENTIAL and COMMERCIAL. Please note that 
 /// these names are case-sensitive.
 /// </param>
 /// <param name="height">The Height of the Package</param>
 /// <param name="length">The Length of the Package</param>
 /// <param name="width">The Width of the Package</param>
 /// <returns></returns>
 public ShippingPackage AddShippingPackage(string id, string city,
     string region, string postalCode,
     DeliveryAddressCategory addressCategory,
     int height, int length, int width)
 {
     return _carrierCalculatedShipping.AddShippingPackage(id, city, region,
     postalCode, "US", addressCategory, height, length, width);
 }
示例#2
0
        /// <summary>
        /// Add a Ship Address For Calculated Shipping
        /// </summary>
        /// <param name="shipFromId">The ID of the Ship From</param>
        /// <param name="city">
        /// The &lt;city&gt; tag identifies the city associated with a
        /// shipping adrress
        /// </param>
        /// <param name="region">
        /// The &lt;region&gt; tag identifies the state or province associated
        /// with a shipping address.
        /// </param>
        /// <param name="postalCode">
        /// The &lt;postal-code&gt; tag identifies the zip code or postal code.
        /// </param>
        /// <param name="countryCode">
        /// This tag contains the two-letter
        /// <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1</a>
        /// country code for the postal area.
        /// </param>
        /// <param name="addressCategory">
        /// The &lt;delivery-address-category&gt; tag indicates whether the shipping
        /// method should be applied to a residential or a commercial address. Valid
        /// values for this tag are RESIDENTIAL and COMMERCIAL. Please note that
        /// these names are case-sensitive.
        /// </param>
        /// <param name="height">The Height of the Package</param>
        /// <param name="length">The Length of the Package</param>
        /// <param name="width">The Width of the Package</param>
        /// <returns></returns>
        public ShippingPackage AddShippingPackage(string shipFromId, string city, string region,
                                                  string postalCode, string countryCode, DeliveryAddressCategory addressCategory,
                                                  int height, int length, int width)
        {
            ShippingPackage retVal = AddShippingPackage(shipFromId, city, region,
                                                        postalCode, countryCode);

            retVal.AddressCategory = addressCategory;
            retVal.Height          = height;
            retVal.Length          = length;
            retVal.Width           = width;

            return(retVal);
        }
        /// <summary>
        /// Add a Ship Address For Calculated Shipping
        /// </summary>
        /// <param name="shipFromId">The ID of the Ship From</param>
        /// <param name="city">
        /// The &lt;city&gt; tag identifies the city associated with a
        /// shipping adrress
        /// </param>
        /// <param name="region">
        /// The &lt;region&gt; tag identifies the state or province associated
        /// with a shipping address.
        /// </param>
        /// <param name="postalCode">
        /// The &lt;postal-code&gt; tag identifies the zip code or postal code.
        /// </param>
        /// <param name="countryCode">
        /// This tag contains the two-letter 
        /// <a href="http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/list-en1.html">ISO 3166-1</a>
        /// country code for the postal area.
        /// </param>
        /// <param name="addressCategory">
        /// The &lt;delivery-address-category&gt; tag indicates whether the shipping 
        /// method should be applied to a residential or a commercial address. Valid
        /// values for this tag are RESIDENTIAL and COMMERCIAL. Please note that 
        /// these names are case-sensitive.
        /// </param>
        /// <param name="height">The Height of the Package</param>
        /// <param name="length">The Length of the Package</param>
        /// <param name="width">The Width of the Package</param>
        /// <returns></returns>
        public ShippingPackage AddShippingPackage(string shipFromId, string city, string region, 
            string postalCode, string countryCode, DeliveryAddressCategory addressCategory,
            int height, int length, int width)
        {
            ShippingPackage retVal = AddShippingPackage(shipFromId, city, region,
            postalCode, countryCode);

              retVal.AddressCategory = addressCategory;
              retVal.Height = height;
              retVal.Length = length;
              retVal.Width = width;

              return retVal;
        }
示例#4
0
        /// <summary>
        /// Creates a new <see cref="Category" /> instance from the provided model.
        /// </summary>
        /// <param name="model">The model coming from the API.</param>
        /// <returns>Returns the created category instance.</returns>
        private Category GetCategory(Models.Categories.Category model)
        {
            // Initializes the category
            Category category;

            // Checks whether the category is a contact category
            switch (model.objectType)
            {
            case "Contact":
                category = new ContactCategory();
                break;

            case "Document":
                category = new DocumentCategory();
                break;

            case "ProjectTime":
                category = new ProjectTimeCategory();
                break;

            case "Task":
                category = new TaskCategory();
                break;

            case "Part":
                category = new PartCategory();
                break;

            case "Project":
                category = new ProjectCategory();
                break;

            case "ContactAddress":
                switch (model.translationCode)
                {
                case "CATEGORY_WORK":
                    category = new WorkAddressCategory();
                    break;

                case "CATEGORY_PRIVAT":
                    category = new PrivateAddressCategory();
                    break;

                case "CATEGORY_INVOICE_ADDRESS":
                    category = new InvoiceAddressCategory();
                    break;

                case "CATEGORY_DELIVERY_ADDRESS":
                    category = new DeliveryAddressCategory();
                    break;

                case "CATEGORY_PICKUP_ADDRESS":
                    category = new PickupAddressCategory();
                    break;

                case "CATEGORY_EMPTY":
                default:
                    return(null);
                }
                break;

            default:
                return(null);
            }

            // Sets the category specific properties
            category.Id = model.id;
            category.CreationDateTime = string.IsNullOrWhiteSpace(model.create) ? (Nullable <DateTime>)null : DateTime.Parse(model.create);
            category.UpdateDateTime   = string.IsNullOrWhiteSpace(model.update) ? (Nullable <DateTime>)null : DateTime.Parse(model.update);
            category.Name             = model.name;
            category.Color            = model.color;
            category.Code             = model.code;
            category.Priority         = int.Parse(model.priority);

            // Returns the created category
            return(category);
        }