private void SaveButton_Click(object sender, EventArgs e) { if (PhoneTextBox.Text == "" || CompanyIDMaskedTextBox.Text == "" || AddressTextBox.Text == "" || EmailTextBox.Text == "") { MessageBox.Show("Insert All Fields"); } else { string PhoneNum = PhoneTextBox.Text; int Error = 0; int z; for (int i = 0; i < PhoneNum.Length; i++) { z = (int)PhoneNum[i]; if (z < 40 || z > 57) { Error = 1; break; } } if (Error == 0) { int r = ControllerObject.AddCompany(Convert.ToInt32(CompanyIDMaskedTextBox.Text), CompanyNameMaskedTextBox.Text, AddressTextBox.Text, Convert.ToInt32(PhoneTextBox.Text), EmailTextBox.Text + AtLabel.Text + EmailDomainComboBox.Text + ComLabel.Text); if (r != 0) { MessageBox.Show(CompanyNameMaskedTextBox.Text + " " + "is Added"); Hide(); new Admin(Username).Show(); } else { MessageBox.Show("Error in Adding" + " " + CompanyNameMaskedTextBox.Text); return; } } else { MessageBox.Show("Invalid Phone Number! Check Your Entry"); } } }