protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         int patientId = Convert.ToInt32(Request.QueryString["patientid"].ToString());
         GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
         ds = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
         GridView1.DataSource = ds;
         GridView1.DataBind();
     }
 }
 protected void Button3_Click(object sender, EventArgs e)
 {
     appointmentToken = TextBox7.Text;
     reset();
     GetPatientInfoByAppointmentTokenBL objGetPatientInfoByAppointmentTokenBL = new GetPatientInfoByAppointmentTokenBL();
     ds = objGetPatientInfoByAppointmentTokenBL.GetPatientInfoByAppointmentToken(appointmentToken);
     if(ds.Tables[0].Rows.Count != 0)
     {
         Panel1.Visible = true;
         patientId = Convert.ToInt32(ds.Tables[0].Rows[0]["ID"].ToString());
         Label2.Text = ds.Tables[0].Rows[0]["PATIENT_NAME"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["PATIENT_DOB"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["PATIENT_PRIMARY_PHONE"].ToString();
         appointmentDate = ds.Tables[0].Rows[0]["APPOINTMENT_DATE"].ToString();
         appointmentTime = ds.Tables[0].Rows[0]["APPOINTMENT_TIME"].ToString();
         DateTime dt = Convert.ToDateTime(appointmentDate);
         if(dt == DateTime.Now.Date)
         {
             Label5.Text = "";
             Panel2.Visible = true;
             Panel3.Visible = true;
             Panel4.Visible = false;
             LinkButton2.Visible = false;
             GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
             ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
             GridView1.DataSource = ds1;
             GridView1.DataBind();
             Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
             ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
             GridView2.DataSource = ds2;
             GridView2.DataBind();
             GridView3.DataSource = null;
             GridView3.DataBind();
         }
         else
         {
             Panel2.Visible = false;
             Panel3.Visible = true;
             Panel4.Visible = false;
             LinkButton2.Visible = false;
             Label5.Text = "Patient Does Not Have Appointment Today";
             Label5.ForeColor = System.Drawing.Color.Red;
             Label5.BackColor = System.Drawing.Color.Yellow;
             GetPatientAppointmentHistoryBL objGetPatientAppointmentHistoryBL = new GetPatientAppointmentHistoryBL();
             ds1 = objGetPatientAppointmentHistoryBL.GetPatientAppointmentHistory(patientId);
             GridView1.DataSource = ds1;
             GridView1.DataBind();
             Doctor_GetOPDTreatmentAllMedicinesBL objGetOPDTreatmentAllMedicinesBL = new Doctor_GetOPDTreatmentAllMedicinesBL();
             ds2 = objGetOPDTreatmentAllMedicinesBL.Doctor_GetOPDTreatmentAllMedicines(patientId);
             GridView2.DataSource = ds2;
             GridView2.DataBind();
             GridView3.DataSource = null;
             GridView3.DataBind();
         }
     }
     else
     {
         Panel1.Visible = false;
         Panel2.Visible = false;
         Panel3.Visible = false;
         Panel4.Visible = false;
         LinkButton2.Visible = false;
         Label5.Text = "No Patient Found";
         Label5.ForeColor = System.Drawing.Color.Red;
     }
 }