4
Reply

Check Condition

Hassan khan

Hassan khan

May 12 2015 6:14 AM
473
I am creating a desktop application of hospital management system but i am stuck i want to add appointment of the patient the condition is that if patient make an appointment  twice in 24 hours it shows record already exist if he make 2nd an appointment after 24 hours or Next day then the data insert in database. what should i do here is code for Insert.
 
if (txtAppointmentID.Text.Length > 0 && txtAppointmentNumber.Text.Length > 0 && txtPatientID.Text.Length > 0 && cmbDoctorName.Text.Length > 0 && DateTimeAppointment.Text.Length > 0 && txtAppointmentDuration.Text.Length > 0 && txtAppointmentCharges.Text.Length > 0)
if (Appointment.IsExist(txtAppointmentID.Text))
{
MessageBox.Show("Appointment already Exist");
}
else
{
if (Appointment.InsertAppointmentRecord(txtAppointmentID.Text , txtAppointmentNumber.Text, txtPatientID.Text, cmbDoctorName.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");
}
if (txtAppointmentID.Text.Length == 0)
{
txtAppointmentID.Focus();
MessageBox.Show("Please Enter A Unique Appointment ID", "Appointment ID is Required");
}
if (txtAppointmentNumber.Text.Length == 0)
{
txtAppointmentNumber.Focus();
MessageBox.Show("Please Enter A Unique Appointment Number" , "Appointment Number is Required");
}
else if (txtPatientID.Text.Length == 0)
{
txtPatientID.Focus();
MessageBox.Show("Please Enter A Patient ID" , "Patient ID Is Required");
}
else if (cmbDoctorName.Text.Length == 0)
{
cmbDoctorName.Focus();
MessageBox.Show( "Please Enter Doctor Name" , "Doctor Name is Required");
}
else if (DateTimeAppointment.Text.Length == 0)
{
DateTimeAppointment.Focus();
MessageBox.Show( "Please Enter Appointment Date" , "Appointment date Is Required");
}
else if (txtAppointmentDuration.Text.Length == 0)
{
txtAppointmentDuration.Focus();
MessageBox.Show("Please Enter Appointment Duration" , "Appointment Duration Is Required");
}
else if (txtAppointmentCharges.Text.Length == 0)
{
txtAppointmentCharges.Focus();
MessageBox.Show("Please Enter Appointment Charges" , "Appointment Charges Is Required");
}
 

Answers (4)