public TherapistTableManager()
 {
     //
     // TODO: Add constructor logic here
     //
     therapistDatabaseContext = new TherapistsDataContext(WebConfigurationManager.ConnectionStrings[CommonDefinitions.CommonDefinitions.MYTHERAPIST_DATABASE_CONNECTION_STRING].ConnectionString);
     patientApptInformationDatabaseContext = new PatientAppointmentInfomationDataContext(WebConfigurationManager.ConnectionStrings[CommonDefinitions.CommonDefinitions.MYTHERAPIST_DATABASE_CONNECTION_STRING].ConnectionString);
 }
 public PatientAppointmentInformationTableManager()
 {
     //
     // TODO: Add constructor logic here
     //
     patientApptDataContext        = new PatientAppointmentInfomationDataContext(WebConfigurationManager.ConnectionStrings["MyTherapistDatabaseConnectionString"].ConnectionString);
     patientAppointmentInformation = new PatientAppointmentInformation();
     dataEncryptionAlgorithm       = new MyTherapistEncryption.SecurityController();
 }
    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;
        }
    }