Ejemplo n.º 1
0
        private void Sync()
        {
            //now we want to add it to the node
            if (_shippingNode != null && _packages.Count > 0)
            {
                _shippingNode.shippingpackages
                    = new AutoGen.ShippingPackage[_packages.Count];

                for (int i = 0; i < _packages.Count; i++)
                {
                    ShippingPackage package = _packages[i] as ShippingPackage;

                    AutoGen.ShippingPackage sp = new GCheckout.AutoGen.ShippingPackage();

                    _shippingNode.shippingpackages[i] = sp;

                    if (package.AddressCategory != DeliveryAddressCategory.UNKNOWN)
                    {
                        sp.deliveryaddresscategory = package.AddressCategory.ToString();
                    }

                    if (package.Height > 0)
                    {
                        sp.height = GetDimension(package.Height);
                    }
                    if (package.Length > 0)
                    {
                        sp.length = GetDimension(package.Length);
                    }

                    ShipFrom sf = package.ShippingLocation;
                    sp.shipfrom             = new GCheckout.AutoGen.AnonymousAddress();
                    sp.shipfrom.city        = sf.City;
                    sp.shipfrom.countrycode = sf.CountryCode;
                    sp.shipfrom.id          = sf.ID;
                    sp.shipfrom.postalcode  = sf.PostalCode;
                    sp.shipfrom.region      = sf.Region;

                    if (package.Width > 0)
                    {
                        sp.width = GetDimension(package.Width);
                    }
                }
            }
        }
        private void Sync()
        {
            //now we want to add it to the node
              if (_shippingNode != null && _packages.Count > 0) {
            _shippingNode.shippingpackages
              = new AutoGen.ShippingPackage[_packages.Count];

            for (int i = 0; i < _packages.Count; i++) {

              ShippingPackage package = _packages[i] as ShippingPackage;

              AutoGen.ShippingPackage sp = new GCheckout.AutoGen.ShippingPackage();

              _shippingNode.shippingpackages[i] = sp;

              if (package.AddressCategory != DeliveryAddressCategory.UNKNOWN)
            sp.deliveryaddresscategory = package.AddressCategory.ToString();

              if (package.Height > 0)
            sp.height = GetDimension(package.Height);
              if (package.Length > 0)
            sp.length = GetDimension(package.Length);

              ShipFrom sf = package.ShippingLocation;
              sp.shipfrom = new GCheckout.AutoGen.AnonymousAddress();
              sp.shipfrom.city = sf.City;
              sp.shipfrom.countrycode = sf.CountryCode;
              sp.shipfrom.id = sf.ID;
              sp.shipfrom.postalcode = sf.PostalCode;
              sp.shipfrom.region = sf.Region;

              if (package.Width > 0)
            sp.width = GetDimension(package.Width);
            }
              }
        }