예제 #1
0
        public Customer()
        {
            _creditCards = new List<CreditCard>();
            _creditCards.Add(new CreditCard());
            _creditCards.Add(new CreditCard());
            _creditCards.Add(new CreditCard());

            _billingAddress = new Address(Enums.AddressType.Billing);
            _shippingAddress = new Address(Enums.AddressType.Shipping);
        }
예제 #2
0
 public void SetAddress(Address address)
 {
     txtState.Text = address.State;
     txtCity.Text = address.City;
     txtZip.Text = address.Zip;
     txtAddress.Text = address.Line1 + Environment.NewLine + address.Line2 + Environment.NewLine + address.Line3 + Environment.NewLine + address.Line4;
     //txtLine1.Text = address.Line1;
     //txtLine2.Text = address.Line2;
     //txtLine3.Text = address.Line3;
     //txtLine4.Text = address.Line4;
 }
예제 #3
0
        public Address GetAddress()
        {
            var pieces = txtAddress.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            Address a = new Address(_addressType);

            if (pieces.Count() > 0)
                a.Line1 = pieces[0];
            if (pieces.Count() > 1)
                a.Line2 = pieces[1];
            if (pieces.Count() > 2)
                a.Line3 = pieces[2];
            if (pieces.Count() > 3)
                a.Line4 = pieces[3];

            a.City = txtCity.Text;
            a.State = txtState.Text;
            a.Zip = txtZip.Text;

            return a;
        }
예제 #4
0
        Address XmlToAddress(XElement xAddressSet, Enums.AddressType addressType)
        {
            var xAddress = (from xA in xAddressSet.Elements("Address")
                            where xA.Element("Type").Value == addressType.ToString()
                            select xA).SingleOrDefault();
            if (xAddress == null)
                return new Address(addressType);

            Address a = new Address(addressType);
            a.Line1 = xAddress.Element("Line1").Value;
            a.Line2 = xAddress.Element("Line2").Value;
            a.Line3 = xAddress.Element("Line3").Value;
            a.Line4 = xAddress.Element("Line4").Value;
            a.State = xAddress.Element("State").Value;
            a.City = xAddress.Element("City").Value;
            a.Zip = xAddress.Element("Zip").Value;

            return a;
        }
예제 #5
0
 XElement AddressToXml(Address a)
 {
     XElement xAddress = new XElement("Address",
         new XElement("Type", a.AddressType.ToString()),
         new XElement("Line1", a.Line1),
         new XElement("Line2", a.Line2),
         new XElement("Line3", a.Line3),
         new XElement("Line4", a.Line4),
         new XElement("City", a.City),
         new XElement("State", a.State),
         new XElement("Zip", a.Zip)
         );
     return xAddress;
 }