private void BtnAddSupplier(object sender, RoutedEventArgs e) { if (!(txtsupId.Text.Equals("") || txtCompanyName.Text.Equals("") || txtAddress.Text.Equals("") || txtCity.Text.Equals("") || txtRegion.Text.Equals("") || txtPostCode.Text.Equals("") || txtCountry.Text.Equals("") || txtPhoneNumber.Text.Equals("") || txtEmail.Text.Equals(""))) { Supplier s = new Supplier(); s.SupplierID = Int32.Parse(txtsupId.Text); s.CompanyName = txtCompanyName.Text; s.Address = txtAddress.Text; s.City = txtCity.Text; s.Region = txtRegion.Text; s.PostalCode = txtPostCode.Text; s.Country = txtCountry.Text; s.Phone = txtPhoneNumber.Text; s.Email = txtEmail.Text; if (da.EmailIsValid(txtEmail.Text)) { string msg = da.AddSupplier(s); MessageBox.Show("" + msg); if (msg.Equals("New Supplier Added")) { MainWindow mw = Application.Current.Windows.OfType <MainWindow>().FirstOrDefault(); if (mw != null) { mw.MainFrame.Content = new ManageSuppliers(); } } } else { MessageBox.Show("Wrong email please enter correct email"); } } else { MessageBox.Show("All textbox must be full"); } //is knowlegde obtained through observetion critical tested and expirinmented }