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");
I am writing this code but the condition only checked on AppointmentID however it is primary key. what can I write so it can check the complete condition?
2nd I want to write such like code that if AppointmentNumber and personID is insert in current day mean if entered 23/4/2015 date and record is present then show "Record Exist" if I entered next day 24/4/2015 then record insert if appointmentnumber already exists.