Exemplo n.º 1
0
        public MerchantTribe.Commerce.Contacts.Address GetAsAddress()
        {
            MerchantTribe.Commerce.Contacts.Address a = new MerchantTribe.Commerce.Contacts.Address();
            if (lstCountry.Items.Count > 0)
            {
                a.CountryBvin = lstCountry.SelectedValue;
                a.CountryName = lstCountry.SelectedItem.ToString();
            }
            else
            {
                a.CountryBvin = "";
                a.CountryName = "Unknown";
            }
            if (lstState.Items.Count > 0)
            {
                a.RegionName = lstState.SelectedItem.Text;
                a.RegionBvin = lstState.SelectedItem.Value;
            }
            else
            {
                a.RegionName = stateField.Text.Trim();
                a.RegionBvin = "";
            }

            a.FirstName = this.FirstName;
            a.LastName = this.LastName;
            a.Company = this.CompanyName;
            a.Line1 = this.StreetLine1;
            a.Line2 = this.StreetLine2;
            a.Line3 = this.StreetLine3;
            a.City = this.City;
            a.PostalCode = this.PostalCode;
            a.Phone = this.PhoneNumber;
            if (this.AddressBvin.Value != string.Empty)
            {
                a.Bvin = this.AddressBvin.Value;
            }
            int type = 0;
            if (int.TryParse(this.AddressTypeField.Value, out type))
            {
                a.AddressType = (MerchantTribe.Commerce.Contacts.AddressTypes)type;
            }

            long storeId = 0;
            if (long.TryParse(this.StoreId.Value, out storeId)) a.StoreId = storeId;

            return a;
        }