private void btnPDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPDeleteActionPerformed
        // TODO add your handling code here:
        lblPHint.setVisible(false);
        int pid = Integer.parseInt(lblPID.getText());
        if (pid<=0)
            return;
        if ((ThisUser.UserType!=User.U_Types.ADMIN)&&(!tbxPDoctorID.getText().equals(ThisUser.UserID)))
        {
            tbxError.setText("Permission denied.");
            return;
        }
        String msg = "You are about to delete patient #"+String.valueOf(pid)+". \r\nDo you wish to continue?";
        int x = JOptionPane.showConfirmDialog(this, msg, "Do you wish to continue?",JOptionPane.YES_NO_OPTION);
        if (x!=0)
            return;
        Patient_Controller PC = new Patient_Controller("localhost", DBName, DBAccount, DBPwd);
        
        boolean flag = PC.DeletePatient(pid);
        if(!flag)
        {
            tbxError.setText(PC.err);
        }
        String key = tbxPSearch.getText().trim().replace("'", "");
        int Method  = cbxPSearchType.getSelectedIndex();
        SearchPatients(Method, key);  
        tbxError.setText("Deletion successful.");
    }