protected void btnDeletePatient_Click(object sender, EventArgs e)
    {
        PatientDataContext patientDC       = new PatientDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True");
        PatientInformation patientToDelete = new PatientInformation();

        PatientAppointmentInfomationDataContext patientAppointmentInformationDC       = new PatientAppointmentInfomationDataContext("Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\SoftwareDevelopmentProjects\\WebProjects\\myTherapist\\myTherapist\\App_Data\\myTherapist.mdf; Integrated Security = True");
        PatientAppointmentInformation           patientAppointmentInformationToDelete = new PatientAppointmentInformation();

        Int32 patientId = 0;

        if (Session[CommonDefinitions.CommonDefinitions.PATIENT_ID] != null)
        {
            if (Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] == null)
            {
                lblWarningText.Text      = "Click Delete again to confirm this action.";
                lblWarningText.ForeColor = System.Drawing.Color.Red;
                lblWarningText.Visible   = true;
                Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = "yes";
            }
            else
            {
                if (Int32.TryParse(Session[CommonDefinitions.CommonDefinitions.PATIENT_ID].ToString(), out patientId))
                {
                    Session[CommonDefinitions.CommonDefinitions.DELETE_PATIENT_WARNING] = null;

                    PatientInformationTableManager patientTableMgr = new PatientInformationTableManager();
                    Patient patientInfo = new Patient();
                    patientInfo.Id = patientId;
                    patientTableMgr.Delete(patientInfo);


                    lblWarningText.Visible = false;

                    PatientListing1.LoadGrid();
                }
            }
        }
        else
        {
            lblWarningText.Visible   = true;
            lblWarningText.Text      = "Select a patient to delete.";
            lblWarningText.ForeColor = System.Drawing.Color.Red;
        }
    }
    private void AddEditPatientControl1_patientCareSaved(object sender, EventArgs e)
    {
        AddEditPatientControl1.Visible = false;

        if ((Session[CommonDefinitions.CommonDefinitions.EDIT_PATIENT_APPT] != null) || (Session[CommonDefinitions.CommonDefinitions.EDIT_PATIENT_FROM_HISTORY] != null))
        {
            // go back to patient history for a single patient
            PatientApptControl1.Visible    = false;
            PatientHistoryControl1.Visible = true;
            PatientHistoryControl1.Refresh();

            AllButtonsInvisible();

            btnPatientListing.Visible     = true;
            btnPatientInformation.Visible = true;
        }
        else
        {
            PatientListing1.LoadGrid();
            PatientListing1.Visible = true;
            menuPanel.Visible       = true;
        }
    }