private void buttonNext_Click(object sender, EventArgs e) { if (textBoxPatientName.Text.Trim() == string.Empty) { MessageBox.Show("Please enter The Patient Name"); textBoxPatientName.Focus(); return; } if (comboBoxMonth.SelectedIndex == -1) { MessageBox.Show("Please Select Month from th List", "Error", MessageBoxButtons.OK); comboBoxMonth.Focus(); return; } if (comboBoxDay.SelectedIndex == -1) { MessageBox.Show("Please Select Day from th List", "Error", MessageBoxButtons.OK); comboBoxDay.Focus(); return; } if (comboBoxYear.SelectedIndex == -1) { MessageBox.Show("Please Select Year from th List", "Error", MessageBoxButtons.OK); comboBoxYear.Focus(); return; } else { this.Close(); } //***********************************************Phone-Number Validation*************************************** Regex validator = new Regex("(2|3|4|5|6|7|8|9){1}[0-9]{9}"); string match = validator.Match(textBoxPhone.Text).Value.ToString(); if (match.Length != 10) { MessageBox.Show("Please Type Phone Number into Digit", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); textBoxPhone.Focus(); } //**************************************************************************************************************** DialogResult dialouge = MessageBox.Show("New Patient??", "Done Sucessfully", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialouge == DialogResult.OK) { this.Hide(); DeskEmployeeForm obj = new DeskEmployeeForm(); obj.Show(); } if (dialouge == DialogResult.No) { } }
private void buttonLogin_Click(object sender, EventArgs e) { string userName = "******"; string password = "******"; textBoxUserName.Focus(); if (textBoxUserName.Text == userName && textBoxPassword.Text == password) { if (radioButtonAdmin.Checked != true && radioButtonDeskEmployee.Checked != true && radioButtonDoctor.Checked != true) { string msg = "Please, "; msg += "Select Employee Type to preocced"; MessageBox.Show(msg, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { buttonLogin.Focus(); if (radioButtonAdmin.Checked == true) { this.Hide(); AdminForm adminObject = new AdminForm(); adminObject.Show(); } else if (radioButtonDeskEmployee.Checked == true) { this.Hide(); DeskEmployeeForm obj = new DeskEmployeeForm(); obj.Show(); } else if (radioButtonDoctor.Checked == true) { this.Hide(); DoctorForm obj = new DoctorForm(); obj.Show(); } } } else { MessageBox.Show("Invalid Username or Passord", "Invalid User", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Error); } }