Beispiel #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            string Msg;

            if (!Validate(out Msg))
            {
                MessageBox.Show(Msg);
                return;
            }
            BayWind.Address addr = new BayWind.Address()
            {
                Street    = textBoxStreet.Text,
                City      = textBoxCity.Text,
                State     = textBoxState.Text,
                Country   = textBoxCountry.Text,
                ZipCode   = textBoxZip.Text,
                AddressID = (int)AddressStore.GetNextSequence()
            };
            BayWind.Person p = new BayWind.Person()
            {
                FirstName   = textBoxFirstName.Text,
                LastName    = textBoxLastName.Text,
                PhoneNumber = textBoxPhone.Text,
                AddressID   = addr.AddressID
            };
            PeopleStore.Add(p.GetKey(), p);
            AddressStore.Add(addr.AddressID, addr);
            GoPreviousPage();
            DisplayPage();
        }
Beispiel #2
0
 private void buttonDelete_Click(object sender, EventArgs e)
 {
     BayWind.Person p = GetSelectedPerson();
     if (p != null)
     {
         PeopleStore.Remove(p.GetKey());
         GoPreviousPage();
         DisplayPage();
     }
 }