Esempio n. 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();
        }
Esempio n. 2
0
 void DisplayFields(BayWind.Person p)
 {
     textBoxFirstName.Text = p.FirstName;
     textBoxLastName.Text  = p.LastName;
     textBoxPhone.Text     = p.PhoneNumber;
     if (AddressStore.Search(p.AddressID))
     {
         BayWind.Address addr = AddressStore.CurrentValue;
         textBoxStreet.Text  = addr.Street;
         textBoxCity.Text    = addr.City;
         textBoxState.Text   = addr.State;
         textBoxCountry.Text = addr.Country;
         textBoxZip.Text     = addr.ZipCode;
     }
 }