Esempio n. 1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            string name    = NameTextBox.Text;
            string surname = SurnameTextBox.Text;
            int    ph;

            int.TryParse(PhoneNrTextBox.Text, out ph);
            string address = AddressTextBox.Text;

            if (name == null || name.Equals(""))
            {
                MessageBox.Show("Fill the name field!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (surname == null || surname.Equals(""))
            {
                MessageBox.Show("Fill the surname field!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (address == null || address.Equals(""))
            {
                MessageBox.Show("Fill the address field!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (ph.ToString().Length < 9)
            {
                MessageBox.Show("Enter correct phone number!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                _parent.EditedClient(name, surname, ph, address);
                Close();
            }
        }