Esempio n. 1
0
        public Address(string addressType, string street, uint streetNo, uint apartmentNo, ZIP zip)
        {
            _addressType = addressType;
            _street      = street;
            _streetNo    = streetNo;
            _apartmentNo = apartmentNo;
            int i = ZIPList.LookUp(zip);

            _zip = ZIPList._zips[i];
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            #region Setup
            PersonKartotek mitKartotek = new PersonKartotek();
            ZIPList        ziplist     = new ZIPList();
            ZIP            aarhus      = new ZIP("8000", "Denmark", "Jylland", "Aarhus");
            ZIP            odense      = new ZIP("5000", "Denmark", "Fyn", "Odense");
            ZIP            hongkong    = new ZIP("518003", "China", "Hong Kong", "Hong Kong");
            #endregion

            #region Person1
            Email       email    = new Email("*****@*****.**");
            PhoneNumber phone1   = new PhoneNumber(22334455, "Private", "Telia");
            PhoneNumber phone2   = new PhoneNumber(11001100, "Workphone", "TDC");
            Address     address1 = new Address("Private", "Vestre Ringgade", 10, 3, aarhus);
            Address     address2 = new Address("Work", "Finlandsgade", 17, 1, aarhus);
            Address     address3 = new Address("Cottage", "Vollsmosegade", 1, 1, odense);
            Person      person1  = new Person("Nickolai", "Lundby", "Ernst", 130188, "Employee");
            person1.SetAddress(address1);
            person1.SetAddress(address2);
            person1.SetAddress(address3);
            person1.SetPhoneNumber(phone1);
            person1.SetPhoneNumber(phone2);
            person1.SetEmail(email);
            #endregion

            #region Person2
            Email       email2   = new Email("*****@*****.**");
            PhoneNumber phone3   = new PhoneNumber(88888888, "Private", "Telia");
            PhoneNumber phone4   = new PhoneNumber(44444444, "Workphone", "TDC");
            Address     address4 = new Address("Private", "Fynsgade", 4, 8, aarhus);
            Address     address5 = new Address("Work", "Norges Alle", 11, 3, aarhus);
            Address     address6 = new Address("Cottage", "Main Street", 13, 2, hongkong);
            Person      person2  = new Person("Stanie", "", "Cheung", 220296, "Employee");
            person2.SetAddress(address4);
            person2.SetAddress(address5);
            person2.SetAddress(address6);
            person2.SetPhoneNumber(phone3);
            person2.SetPhoneNumber(phone4);
            person2.SetEmail(email2);
            #endregion

            mitKartotek.AddPerson(person1);
            mitKartotek.AddPerson(person2);
            mitKartotek.PrintPersonKartotek();

            List <ZIP> z = ziplist.getList();

            foreach (var zip in z)
            {
                Console.WriteLine($"{zip.ZipCode}");
            }

            Console.ReadLine();
        }
Esempio n. 3
0
        public static int LookUp(ZIP zip)
        {
            if (_zips.Count == 0)
            {
                AddZip(zip);
                return(_zips.Count - 1);
            }
            bool isThere = _zips.Contains(zip);

            if (!isThere)
            {
                AddZip(zip);
            }
            else
            {
                return(_zips.IndexOf(zip));
            }

            return(_zips.Count - 1);
        }
Esempio n. 4
0
 private static void AddZip(ZIP zip)
 {
     _zips.Add(zip);
 }