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


C# Address.ToXml方法代码示例

本文整理汇总了C#中Address.ToXml方法的典型用法代码示例。如果您正苦于以下问题:C# Address.ToXml方法的具体用法?C# Address.ToXml怎么用?C# Address.ToXml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


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

示例1: btnBillingAddress_Click

        /// <summary>
        /// Handles the Click event of the btnBillingAddress control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected void btnBillingAddress_Click(object sender, EventArgs e)
        {
            //First, get the BillingAddress squared away
              Address address = new Address();
              if (!billingAddress.NewAddressPanel.Visible) {
            //From the ddl
            Guid selectedAddress = new Guid(billingAddress.AddressList.SelectedValue);
            address = WebProfile.Current.AddressCollection.Find(
              addressToFind =>
              addressToFind.AddressId == selectedAddress && addressToFind.AddressType == AddressType.BillingAddress);
              }
              else {
            if (!string.IsNullOrEmpty(billingAddress.AddressId)) {
              //They are editing an existing address
              Guid selectedAddress = new Guid(billingAddress.AddressId);
              address = WebProfile.Current.AddressCollection.Find(
            addressToFind =>
            addressToFind.AddressId == selectedAddress && addressToFind.AddressType == AddressType.BillingAddress);
              if (address.AddressId != Guid.Empty) {
            //go ahead and remove it - we are just going to add it with the updated info
            WebProfile.Current.AddressCollection.Remove(address);
              }
            }
            address.FirstName = billingAddress.FirstName;
            address.LastName = billingAddress.LastName;
            address.Phone = billingAddress.Phone;
            address.Email = billingAddress.Email;
            address.Address1 = billingAddress.Address1;
            address.Address2 = billingAddress.Address2;
            address.City = billingAddress.City;
            address.StateOrRegion = billingAddress.StateOrRegion;
            address.PostalCode = billingAddress.PostalCode;
            address.Country = billingAddress.Country;
            address.UserName = WebUtility.GetUserName();
            address.AddressType = AddressType.BillingAddress;
            WebProfile.Current.AddressCollection.Add(address);
            WebProfile.Current.Save();
            //set the id so we can get it to determine if it's an edit or not
            billingAddress.AddressId = address.AddressId.ToString();
              }

              order.BillToAddress = address.ToXml();
              order.Save(WebUtility.GetUserName());

              SetBillingAddressDisplay();

              //Second, check to see if we are using it for shipping as well
              if (chkUseForShipping.Checked) {
            if (billingAddress.NewAddressPanel.Visible) {
              shippingAddress.NewAddressPanel.Visible = true;
              //copy over the info
              shippingAddress.AddressId = billingAddress.AddressId;
              shippingAddress.FirstName = billingAddress.FirstName;
              shippingAddress.LastName = billingAddress.LastName;
              shippingAddress.Phone = billingAddress.Phone;
              shippingAddress.Email = billingAddress.Email;
              shippingAddress.Address1 = billingAddress.Address1;
              shippingAddress.Address2 = billingAddress.Address2;
              shippingAddress.City = billingAddress.City;
              shippingAddress.StateOrRegion = billingAddress.StateOrRegion;
              shippingAddress.PostalCode = billingAddress.PostalCode;
              shippingAddress.Country = billingAddress.Country;
            }
            //We need to see if its already in there as a ShippingAddress and if not, add it

            //First, look it up to see if it's already in the Shipping Address list

            //We keep the ID the same, just changing the AddressType, so search based on ID
            //is ok because the lists are sorted by AddressType when loaded
            ListItem itsInThere = shippingAddress.AddressList.Items.FindByValue(address.AddressId.ToString());
            if (itsInThere == null) {
              //then add it
              Address shipAddress = new Address(address);
              shipAddress.AddressType = AddressType.ShippingAddress;
              WebProfile.Current.AddressCollection.Add(shipAddress);
              WebProfile.Current.Save();
              //now, reload the addresses
              shippingAddress.LoadAddresses();
            }
            //set the shipping address as selected
            shippingAddress.AddressList.ClearSelection();
            shippingAddress.AddressList.Items.FindByValue(address.AddressId.ToString()).Selected = true;

            //set the order shipping address
            order.ShippingAmount = 0;
            order.ShipToAddress = address.ToXml();
            order.Save(WebUtility.GetUserName());

            SetShippingAddressDisplay();
              }
              SetProcessOrderEnablement();
        }
开发者ID:microinfo,项目名称:dashcommerce-3,代码行数:97,代码来源:paypalcheckout.aspx.cs

示例2: btnShippingAddress_Click

 /// <summary>
 /// Handles the Click event of the btnShippingAddress control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
 protected void btnShippingAddress_Click(object sender, EventArgs e)
 {
     Address address = new Address();
       if (!shippingAddress.NewAddressPanel.Visible) {
     Guid selectedAddress = new Guid(shippingAddress.AddressList.SelectedValue);
     address = WebProfile.Current.AddressCollection.Find(
       addressToFind =>
       addressToFind.AddressId == selectedAddress && addressToFind.AddressType == AddressType.ShippingAddress);
       }
       else {
     if (!string.IsNullOrEmpty(shippingAddress.AddressId)) {
       //They are editing an existing address
       Guid selectedAddress = new Guid(shippingAddress.AddressId);
       address = WebProfile.Current.AddressCollection.Find(
     addressToFind =>
     addressToFind.AddressId == selectedAddress && addressToFind.AddressType == AddressType.ShippingAddress);
       if (address.AddressId != Guid.Empty) {
     //go ahead and remove it - we are just going to add it with the updated info
     WebProfile.Current.AddressCollection.Remove(address);
       }
     }
     address.FirstName = shippingAddress.FirstName;
     address.LastName = shippingAddress.LastName;
     address.Phone = shippingAddress.Phone;
     address.Email = shippingAddress.Email;
     address.Address1 = shippingAddress.Address1;
     address.Address2 = shippingAddress.Address2;
     address.City = shippingAddress.City;
     address.StateOrRegion = shippingAddress.StateOrRegion;
     address.PostalCode = shippingAddress.PostalCode;
     address.Country = shippingAddress.Country;
     address.UserName = WebUtility.GetUserName();
     address.AddressType = AddressType.ShippingAddress;
     WebProfile.Current.AddressCollection.Add(address);
     WebProfile.Current.Save();
     //set the id so we can get it to determine if it's an edit or not
     shippingAddress.AddressId = address.AddressId.ToString();
       }
       order.ShippingAmount = 0;
       order.ShipToAddress = address.ToXml();
       order.Save(WebUtility.GetUserName());
       SetShippingAddressDisplay();
       SetProcessOrderEnablement();
 }
开发者ID:microinfo,项目名称:dashcommerce-3,代码行数:49,代码来源:paypalcheckout.aspx.cs


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