private void btnAdd_Click(object sender, EventArgs e)
{
if (txtAppointmentID.Text.Length > 0 && txtAppointmentNumber.Text.Length > 0 && txtPatientID.Text.Length > 0 && txtDoctorName.Text.Length > 0 && DateTimeAppointment.Text.Length > 0 && txtAppointmentDuration.Text.Length > 0 && txtAppointmentCharges.Text.Length > 0)
if (Appointment.IsExist(txtAppointmentID.Text) || Appointment.IsExist(txtAppointmentNumber.Text) || Appointment.ISExit(txtPatientID.Text))
{
MessageBox.Show("Appointment already Exist");
}
else
{
if (Appointment.InsertAppointmentRecord(txtAppointmentID.Text , txtAppointmentNumber.Text, txtPatientID.Text, txtDoctorName.Text, DateTimeAppointment.Value, txtAppointmentDuration.Text, txtAppointmentCharges.Text))
{
MessageBox.Show("Appointment Record Inserted Successfully" , "Insertion Succeeded");
GetAppointmentTable();
}
else
{
MessageBox.Show("Appointment Record Insertion Failed" , "Insertion Failed");
}
}
else
{
MessageBox.Show( "Fill Required Field" , "Empty Fields");

Khan Abrar AhmedRank #778 · 3K reputationPosted Apr 23, 2015, 5:51 AM EDT
private void btnAdd_Click(object sender, EventArgs e)
{
if (txtAppointmentID.Text.Length > 0 && txtAppointmentNumber.Text.Length > 0 && txtPatientID.Text.Length > 0 && txtDoctorName.Text.Length > 0 && DateTimeAppointment.Text.Length > 0 && txtAppointmentDuration.Text.Length > 0 && txtAppointmentCharges.Text.Length > 0)
if (Appointment.IsExist(txtAppointmentID.Text) && Appointment.IsExist(txtAppointmentNumber.Text) && Appointment.ISExit(txtPatientID.Text) && Appointment.ISExit(DateTimeAppointment.Text))
{
MessageBox.Show("Appointment already Exist");
}
else
{
if (Appointment.InsertAppointmentRecord(txtAppointmentID.Text , txtAppointmentNumber.Text, txtPatientID.Text, txtDoctorName.Text, DateTimeAppointment.Value, txtAppointmentDuration.Text, txtAppointmentCharges.Text))
{
MessageBox.Show("Appointment Record Inserted Successfully" , "Insertion Succeeded");
GetAppointmentTable();
}
else
{
MessageBox.Show("Appointment Record Insertion Failed" , "Insertion Failed");
}
}
else
{
MessageBox.Show( "Fill Required Field" , "Empty Fields");
}
}
Khargesh RajputRank #616 · 3.9K reputationPosted Apr 23, 2015, 8:09 PM EDT
Gowtham RajamanickamRank #57 · 29K reputationPosted Apr 23, 2015, 8:28 PM EDT
Hassan khan9 reputationPosted Apr 26, 2015, 12:18 AM EDT
The condition is If AppointmentNumber or PatientID or AppointmentID is exist then it shows record already exist here.