示例#1
0
    private Address CreatePostalAddressFromFields()
    {
        var address = new Address()
        {
            Address1 = txtPostalAddress1.Text,
            Address2 = txtPostalAddress2.Text,
            Suburb   = txtPostalSuburb.Text,
            Postcode = txtPostalPostcode.Text,
            State    = txtPostalState.Text
        };

        if (AddressManager.AddressExists(address))
        {
            Address currentAddress =
                AddressManager.GetAddressByDetails(address.Address1, address.Address2, address.Suburb, address.Postcode, address.State);
            address.Id = currentAddress.Id;
        }

        if (string.IsNullOrEmpty(address.Address1))
        {
            return(null);
        }

        return(address);
    }