当前位置: 首页>>代码示例>>C#>>正文


C# IAddress类代码示例

本文整理汇总了C#中IAddress的典型用法代码示例。如果您正苦于以下问题:C# IAddress类的具体用法?C# IAddress怎么用?C# IAddress使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IAddress类属于命名空间,在下文中一共展示了IAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Shipment

        internal Shipment(IAddress origin, IAddress destination, LineItemCollection items)
        {
            Mandate.ParameterNotNull(origin, "origin");
            Mandate.ParameterNotNull(destination, "destination");
            Mandate.ParameterNotNull(items, "items");

            _fromOrganization = origin.Organization;
            _fromName = origin.Name;
            _fromAddress1 = origin.Address1;
            _fromAddress2 = origin.Address2;
            _fromLocality = origin.Locality;
            _fromRegion = origin.Region;
            _fromPostalCode = origin.PostalCode;
            _fromCountryCode = origin.CountryCode;
            _fromIsCommercial = origin.IsCommercial;
            _toOrganization = destination.Organization;
            _toName = destination.Name;
            _toAddress1 = destination.Address1;
            _toAddress2 = destination.Address2;
            _toLocality = destination.Locality;
            _toRegion = destination.Region;
            _toPostalCode = destination.PostalCode;
            _toCountryCode = destination.CountryCode;
            _toIsCommercial = destination.IsCommercial;

            _phone = destination.Phone;
            _email = destination.Email;

            _items = items;
        }
开发者ID:naepalm,项目名称:Merchello,代码行数:30,代码来源:Shipment.cs

示例2: BuildLocation

        /// <summary>
        /// Builds a location from an <see cref="IAddress"/> and <see cref="IGeocodeProviderResponse"/>.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <param name="response">
        /// The response.
        /// </param>
        /// <returns>
        /// The <see cref="ILocation"/>.
        /// </returns>
        public ILocation BuildLocation(IAddress address, IGeocodeProviderResponse response)
        {
            //TODO: HLF Fix this
            //var definitionFactory = new LocationTypeDefinitionFactory();
            //var def = definitionFactory.GetEmptyDefaultLocationTypeDefinition();

            //def.Fields.Address1().Value = address.Address1;
            //def.Fields.Address2().Value = address.Address2;
            //def.Fields.Locality().Value = address.Locality;
            //def.Fields.Region().Value = address.Region;
            //def.Fields.PostalCode().Value = address.PostalCode;
            //def.Fields.CountryCode().Value = address.CountryCode;

            var location = new Location()//def.Fields
                               {
                                   //LocationTypeId = def.Id,
                                   GeocodeStatus = response.Status
                               };

            if (response.Status != GeocodeStatus.Ok) return location;
            if (!response.Results.Any()) return location;

            var result = response.Results.First();

            location.Coordinate = new Coordinate() { Latitude = result.Latitude, Longitude = result.Longitude };
            location.Viewport = result.Viewport;

            return location;
        }
开发者ID:ismailmayat,项目名称:uLocate,代码行数:41,代码来源:LocationFactory.cs

示例3: AddressIsInZone

        public bool AddressIsInZone(IAddress address)
        {
            bool result = false;

            Country c = Country.FindByBvin(address.CountryData.Bvin);
            if (c != null)
            {
                foreach (ZoneArea a in Areas)
                {
                    if (a.CountryIsoAlpha3.Trim().ToLowerInvariant() ==
                        c.IsoAlpha3.Trim().ToLowerInvariant())
                    {
                        // Country matches
                        if (a.RegionAbbreviation.Trim() == string.Empty)
                        {
                            // empty region abbreviation means match all
                            return true;
                        }
                        else
                        {
                            if (address.RegionData.Abbreviation.Trim().ToLowerInvariant() ==
                                a.RegionAbbreviation.Trim().ToLowerInvariant())
                            {
                                return true;
                            }
                        }
                    }
                }
            }

            return result;
        }
开发者ID:appliedi,项目名称:MerchantTribe,代码行数:32,代码来源:Zone.cs

示例4: DefaultWarehousePackagingStrategy

 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultWarehousePackagingStrategy"/> class.
 /// </summary>
 /// <param name="lineItemCollection">
 /// The line item collection.
 /// </param>
 /// <param name="destination">
 /// The destination.
 /// </param>
 /// <param name="versionKey">
 /// The version key.
 /// </param>
 public DefaultWarehousePackagingStrategy(
     LineItemCollection lineItemCollection,
     IAddress destination,
     Guid versionKey)
     : base(lineItemCollection, destination, versionKey)
 {
 }
开发者ID:GaryLProthero,项目名称:Merchello,代码行数:19,代码来源:DefaultWarehousePackagingStrategy.cs

示例5: Call

 public INatterConnection Call(IAddress address)
 {
     var connection = CreateNewConnection(CreateConnectionId(), address);
     _connections[connection.ConnectionId] = connection;
     connection.Call();
     return connection;
 }
开发者ID:KevWK314,项目名称:Natter,代码行数:7,代码来源:NatterClient.cs

示例6: CopyFrom

 public static void CopyFrom(this IAddress to, IAddress from)
 {
     to.Street = from.Street;
     to.City = from.City;
     to.State = from.State;
     to.Zip = from.Zip;
 }
开发者ID:harshc,项目名称:KCSARA-Database,代码行数:7,代码来源:GeographyServices.cs

示例7: Create

        /// <summary>
        /// Creates a Braintree <see cref="Customer"/> from a Merchello <see cref="ICustomer"/>
        /// </summary>
        /// <param name="customer">
        /// The customer.
        /// </param>
        /// <param name="paymentMethodNonce">
        /// The "nonce-from-the-client"
        /// </param>
        /// <param name="billingAddress">
        /// The billing address
        /// </param>
        /// <param name="shippingAddress">
        /// The shipping Address.
        /// </param>
        /// <returns>
        /// The <see cref="Attempt{Customer}"/>.
        /// </returns>
        public Attempt<Customer> Create(ICustomer customer, string paymentMethodNonce = "", IAddress billingAddress = null, IAddress shippingAddress = null)
        {
            if (Exists(customer)) return Attempt.Succeed(GetBraintreeCustomer(customer));

            var request = RequestFactory.CreateCustomerRequest(customer, paymentMethodNonce, billingAddress);

            Creating.RaiseEvent(new Core.Events.NewEventArgs<CustomerRequest>(request), this);

            // attempt the API call
            var attempt = TryGetApiResult(() => BraintreeGateway.Customer.Create(request));

            if (!attempt.Success) return Attempt<Customer>.Fail(attempt.Exception);

            var result = attempt.Result;

            if (result.IsSuccess())
            {
                Created.RaiseEvent(new Core.Events.NewEventArgs<Customer>(result.Target), this);

                return Attempt.Succeed((Customer)RuntimeCache.GetCacheItem(MakeCustomerCacheKey(customer), () => result.Target));
            }

            var error = new BraintreeApiException(result.Errors);
            LogHelper.Error<BraintreeCustomerApiService>("Braintree API Customer Create return a failure", error);

            return Attempt<Customer>.Fail(error);
        }
开发者ID:cmgrey83,项目名称:Merchello.Plugin.Payment.Braintree,代码行数:45,代码来源:BraintreeCustomerApiService.cs

示例8: FixedRateTaxCalculationStrategy

 /// <summary>
 /// Initializes a new instance of the <see cref="FixedRateTaxCalculationStrategy"/> class.
 /// </summary>
 /// <param name="invoice">
 /// The invoice.
 /// </param>
 /// <param name="taxAddress">
 /// The tax address.
 /// </param>
 /// <param name="taxMethod">
 /// The tax method.
 /// </param>
 public FixedRateTaxCalculationStrategy(IInvoice invoice, IAddress taxAddress, ITaxMethod taxMethod)
     : base(invoice, taxAddress)
 {
     Mandate.ParameterNotNull(taxMethod, "countryTaxRate");
     
     _taxMethod = taxMethod;
 }
开发者ID:arknu,项目名称:Merchello,代码行数:19,代码来源:FixedRateTaxCalculationStrategy.cs

示例9: ShopifyAddress

        public ShopifyAddress(IAddress inAddress)
        {
            this.Address1 = inAddress.Street1;
            this.Address2 = inAddress.Street2;
            this.City = inAddress.City;
            this.Company = inAddress.Name;
            this.Country = Enumerable.FirstOrDefault<string>(CountryCodes.Instance().countryToCode.Where(Item => Item.Value == inAddress.CountryCode).Select(Item => Item.Key));
            this.CountryCode = inAddress.CountryCode;
            string[] names =  inAddress.Name.Split(' ');
            if(names!=null && names.Count()>0)
            {
                this.FirstName = names[0];
                //the remainder of the string is the last name.
                foreach (string name in names.Where(item => item!= FirstName).Select(item=>item).ToArray<string>())
                {
                    this.LastName += (name + " ");
                }
                LastName.TrimEnd(' '); //remove the trailing ' '
            }
            else
            {
                this.FirstName = "Unnamed";
                this.LastName = "Unnamed";
            }

            this.Name = inAddress.Name;

            this.PhoneNumber = "";
            this.Province = inAddress.Region;
            this.ProvinceCode = inAddress.Region;
            this.Zip = inAddress.PostalCode;
        }
开发者ID:shopster,项目名称:NconnectSter,代码行数:32,代码来源:ShopifyAddress.cs

示例10: ShipmentMock

        public ShipmentMock(IAddress origin, IAddress destination, LineItemCollection items)
        {
            this.ShippedDate = DateTime.Now;
            this.FromOrganization = origin.Organization;
            this.FromName = origin.Name;
            this.FromAddress1 = origin.Address1;
            this.FromAddress2 = origin.Address2;
            this.FromLocality = origin.Locality;
            this.FromRegion = origin.Region;
            this.FromPostalCode = origin.PostalCode;
            this.FromCountryCode = origin.CountryCode;
            this.FromIsCommercial = origin.IsCommercial;
            this.ToOrganization = destination.Organization;
            this.ToName = destination.Name;
            this.ToAddress1 = destination.Address1;
            this.ToAddress2 = destination.Address2;
            this.ToLocality = destination.Locality;
            this.ToRegion = destination.Region;
            this.ToPostalCode = destination.PostalCode;
            this.ToCountryCode = destination.CountryCode;
            this.ToIsCommercial = destination.IsCommercial;

            this.Phone = destination.Phone;
            this.Email = destination.Email;

            this.Items = items;
        }
开发者ID:arknu,项目名称:Merchello,代码行数:27,代码来源:ShipmentMock.cs

示例11: CalculateTaxForInvoice

        /// <summary>
        /// Calculates tax for invoice.
        /// </summary>
        /// <param name="invoice">
        /// The invoice.
        /// </param>
        /// <param name="taxAddress">
        /// The tax address.
        /// </param>
        /// <returns>
        /// The <see cref="ITaxCalculationResult"/>.
        /// </returns>
        public override ITaxCalculationResult CalculateTaxForInvoice(IInvoice invoice, IAddress taxAddress)
        {
            decimal amount = 0m;
            foreach (var item in invoice.Items)
            {
                // can I use?: https://github.com/Merchello/Merchello/blob/5706b8c9466f7417c41fdd29de7930b3e8c4dd2d/src/Merchello.Core/Models/ExtendedDataExtensions.cs#L287-L295
                if (item.ExtendedData.GetTaxableValue())
                    amount = amount + item.TotalPrice;
            }

            TaxRequest taxRequest = new TaxRequest();
            taxRequest.Amount = amount;
            taxRequest.Shipping = invoice.TotalShipping();
            taxRequest.ToCity = taxAddress.Locality;
            taxRequest.ToCountry = taxAddress.CountryCode;
            taxRequest.ToState = taxAddress.Region;
            taxRequest.ToZip = taxAddress.PostalCode;

            Models.TaxResult taxResult = _taxjarService.GetTax(taxRequest);

            if (taxResult.Success)
            {
                var extendedData = new ExtendedDataCollection();

                extendedData.SetValue(Core.Constants.ExtendedDataKeys.TaxTransactionResults, JsonConvert.SerializeObject(taxResult));

                return new TaxCalculationResult(TaxMethod.Name, taxResult.Rate, taxResult.TotalTax, extendedData);
            }

            throw new Exception("TaxJar.com error");
        }
开发者ID:drpeck,项目名称:Merchello,代码行数:43,代码来源:TaxJarTaxationGatewayMethod.cs

示例12: changes_to_the_source_should_be_marshalled_via_a_call_to_send

		public void changes_to_the_source_should_be_marshalled_via_a_call_to_send(Mock<SynchronizationContext> synchronizationContext, BindingManager bindingManager, IPerson targetObject, IAddress sourceObject)
		{
			synchronizationContext.Setup(x => x.Send(It.IsAny<SendOrPostCallback>(), It.IsAny<object>()));
			sourceObject.Line1 = "Line 1, mighty fine";

			synchronizationContext.VerifyAll();
		}
开发者ID:tfreitasleal,项目名称:MvvmFx,代码行数:7,代码来源:When_a_binding_has_a_synchronization_context.cs

示例13: Equals

 public bool Equals(IAddress other)
 {
     return AddressLine.Equals(other.AddressLine, StringComparison.CurrentCultureIgnoreCase)
            && City.Equals(other.City, StringComparison.CurrentCultureIgnoreCase)
            && State.Equals(other.State)
            && ZipCode.Equals(other.ZipCode, StringComparison.CurrentCultureIgnoreCase);
 }
开发者ID:jasonlaflair,项目名称:EfficientlyLazy.IdentityGenerator,代码行数:7,代码来源:Address.cs

示例14: GeocodeAddress

        public static MapsLookupResult GeocodeAddress(IAddress addr)
        {
            MapsLookupResult result = new MapsLookupResult { Result = LookupResult.Error };
            if (addr.Street.ToLower().StartsWith("po box"))
            {
                result.Result = LookupResult.NotFound;
                return result;
            }

            WebClient client = new WebClient();
            XmlDocument xml = new System.Xml.XmlDocument();
            string url = string.Format("http://maps.google.com/maps/geo?q={0}&key={1}&output=xml",
                System.Web.HttpUtility.UrlEncode(string.Format("{0}, {1} {2} {3}", addr.Street, addr.City, addr.State, addr.Zip)),
                System.Configuration.ConfigurationManager.AppSettings["MapsKey"]
                );

            xml.LoadXml(client.DownloadString(url));

            XmlElement root = xml.DocumentElement;
            XmlNamespaceManager nsmgr = new
            XmlNamespaceManager(xml.NameTable);
            nsmgr.AddNamespace("k", root.NamespaceURI);
            nsmgr.AddNamespace("d", "urn:oasis:names:tc:ciq:xsdschema:xAL:2.0");

            string status = xml.SelectSingleNode("//k:Response/k:Status/k:code", nsmgr).InnerText;
            if (status != "200")
            {
                // Error
            }
            else
            {
                XmlNode details = xml.SelectSingleNode("//d:AddressDetails", nsmgr);

                string accuracyString = ((XmlElement)details).GetAttribute("Accuracy");
                result.Quality = int.Parse(accuracyString);

                result.Result = LookupResult.Range;
                if (result.Quality > 5)
                {
                    result.Result = LookupResult.Success;
                    result.Street = details.SelectSingleNode("//d:ThoroughfareName", nsmgr).InnerText;
                }
                if (result.Quality > 4)
                {
                    result.Zip = details.SelectSingleNode("//d:PostalCodeNumber", nsmgr).InnerText;
                }
                result.City = details.SelectSingleNode("//d:LocalityName", nsmgr).InnerText;
                result.State = details.SelectSingleNode("//d:AdministrativeAreaName", nsmgr).InnerText;

                string[] coords = details.SelectSingleNode("//k:Response/k:Placemark/k:Point", nsmgr).InnerText.Split(',');
                double lat = double.Parse(coords[1]);
                double lng = double.Parse(coords[0]);
                double z = GeographyServices.GetElevation(lat, lng);

                string point = (z > 0) ? string.Format("POINT({0} {1} {2} NULL)", lng, lat, z) : string.Format("POINT({0} {1})", lng, lat);

                result.Geography = SqlGeography.STGeomFromText(new SqlChars(point.ToCharArray()), GeographyServices.SRID);
            }
            return result;
        }
开发者ID:harshc,项目名称:KCSARA-Database,代码行数:60,代码来源:GeographyServices.cs

示例15: Build

        /// <summary>
        /// Builds the <see cref="AddressType"/>.
        /// </summary>
        /// <param name="address">
        /// The address.
        /// </param>
        /// <returns>
        /// The <see cref="AddressType"/>.
        /// </returns>
        public AddressType Build(IAddress address)
        {
            try
            {
                return new AddressType
                           {
                               Name = address.Name,
                               Street1 = address.Address1,
                               Street2 = address.Address2,
                               PostalCode = address.PostalCode,
                               CityName = address.Locality,
                               StateOrProvince = address.Region,
                               CountryName = address.Country().Name,
                               Country =
                                   (CountryCodeType)
                                   Enum.Parse(typeof(CountryCodeType), address.Country().CountryCode, true),
                               Phone = address.Phone
                           };
            }
            catch (Exception ex)
            {
                var logData = MultiLogger.GetBaseLoggingData();
                logData.AddCategory("PayPal");

                MultiLogHelper.Error<PayPalBasicAmountTypeFactory>("Failed to build an AddressType", ex, logData);

                throw;
            }
        }
开发者ID:jlarc,项目名称:Merchello,代码行数:38,代码来源:PayPalAddressTypeFactory.cs


注:本文中的IAddress类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。