private void patientregbutton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(pnametextBox.Text)) { MessageBox.Show("Please enter patient's name"); } else if (paddresscomboBox.SelectedItem == null) { MessageBox.Show("Please enter patient's address"); } else if (!pgenderradioButton.Checked && !pfemaleradioButton.Checked) { MessageBox.Show("Please select patient's gender"); } else if (string.IsNullOrEmpty(pdobdateTimePicker.Text)) { MessageBox.Show("Please enter patient's dateofbirth"); } else if (string.IsNullOrEmpty(pcontacttextBox.Text)) { MessageBox.Show("Please enter patient's contact number"); } else if (pstatuscombobox.SelectedItem == null) { MessageBox.Show("Please enter patient's status"); } else { string gender = ""; if (pgenderradioButton.Checked == true) { gender = pgenderradioButton.Text; } else if (pfemaleradioButton.Checked == true) { gender = pfemaleradioButton.Text; } if (pcontacttextBox.Text.Length < 11) { MessageBox.Show("Invalid Contactno"); if (pstatuscombobox.SelectedItem.ToString() == "In Door") { if (proomcomboBox.SelectedItem == null) { MessageBox.Show("Please enter patient's roomno"); } } } else { da.patient_admit(pnametextBox.Text, paddresscomboBox.Text, gender, pdobdateTimePicker.Text, pcontacttextBox.Text, pstatuscombobox.Text, proomcomboBox.Text, loginName); MessageBox.Show("Patient admitted successfully"); pnametextBox.Text = ""; pcontacttextBox.Text = ""; paddresscomboBox.Text = ""; pstatuscombobox.Text = ""; proomcomboBox.Text = ""; pgenderradioButton.Checked = false; pfemaleradioButton.Checked = false; } } }