diff --git a/iTrust/WebRoot/auth/hcp-uap/activatePatient.jsp b/iTrust/WebRoot/auth/hcp-uap/activatePatient.jsp
new file mode 100644
index 0000000000000000000000000000000000000000..f6bcd32398ab272937790d4d874f681ea209347e
--- /dev/null
+++ b/iTrust/WebRoot/auth/hcp-uap/activatePatient.jsp
@@ -0,0 +1,129 @@
+<%@taglib prefix="itrust" uri="/WEB-INF/tags.tld"%>
+<%@page errorPage="/auth/exceptionHandler.jsp"%>
+
+<%@page import="edu.ncsu.csc.itrust.dao.DAOFactory"%>
+<%@page import="edu.ncsu.csc.itrust.beans.PatientBean"%>
+<%@page import="edu.ncsu.csc.itrust.action.EditPatientAction"%>
+<%@page import="edu.ncsu.csc.itrust.BeanBuilder"%>
+<%@page import="edu.ncsu.csc.itrust.enums.Ethnicity"%>
+<%@page import="edu.ncsu.csc.itrust.enums.BloodType"%>
+<%@page import="edu.ncsu.csc.itrust.exception.FormValidationException"%>
+<%@page import="edu.ncsu.csc.itrust.enums.Gender"%>
+<%@page import="edu.ncsu.csc.itrust.beans.DiagnosisBean"%>
+<%@page import="edu.ncsu.csc.itrust.action.ActivateAndDeactivatePreRegi"%>
+
+<%@include file="/global.jsp"%>
+
+<%
+    pageTitle = "iTrust - Activate a Pre-Registered Patient";
+%>
+
+<%@include file="/header.jsp"%>
+<itrust:patientNav thisTitle="Deactivate" />
+<%
+    /* Require a Patient ID first */
+    String pidString = (String) session.getAttribute("pid");
+
+    if (pidString == null || pidString.equals("") || 1 > pidString.length()) {
+        out.println("pidstring is null");
+        response.sendRedirect("/iTrust/auth/getPatientID.jsp?forward=hcp-uap/deactivatePatient.jsp");
+        return;
+    }
+    
+    /* If the patient id doesn't check out, then kick 'em out to the exception handler */
+    EditPatientAction action = new EditPatientAction(prodDAO, loggedInMID.longValue(), pidString);
+
+    /* Now take care of updating information */
+    PatientBean p;
+    
+    if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
+            request.getParameter("understand") != null && request.getParameter("understand").equals("I UNDERSTAND")) {
+        try {
+            action.activate();
+            long patientMID = action.getPatient().getMID();
+            
+            ActivateAndDeactivatePreRegi activate = new ActivateAndDeactivatePreRegi(prodDAO, loggedInMID.longValue(), pidString);
+            activate.activate();
+            loggingAction.logEvent(TransactionType.PATIENT_ACTIVATE, loggedInMID.longValue(), 
+                    Long.valueOf((String)session.getAttribute("pid")).longValue(), "");
+%>
+
+
+    <a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp" style="text-decoration: none;">
+        <input type=button value="Go Back to Pre-Registered Patient List" onClick="location='/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp';">
+    </a>
+    <br /><br /><br /><br /><br />
+    
+    <div align=center>
+        <span class="iTrustMessage">Patient Successfully Activated! You can </span>
+         <a href="editPHR.jsp" style="text-decoration: none;">
+        <input type=button value="Edit Patient" onClick="location='editPHR.jsp';">
+    </a>
+    </div>
+    <br /><br /><br /><br /><br />
+<%
+        } catch (Exception e) {
+%>
+    <br />
+    <div align=center>
+        <span class="iTrustError"><%=StringEscapeUtils.escapeHtml(e.getMessage()) %></span>
+    </div>
+    <br />
+<%
+        }
+    } else {
+        p = action.getPatient();
+
+        if (request.getParameter("formIsFilled") != null && request.getParameter("formIsFilled").equals("true") &&
+            (request.getParameter("understand") == null || !request.getParameter("understand").equals("I UNDERSTAND"))) {
+%>
+    <br />
+    <div align=center>
+        <span class="iTrustError">You must type "I UNDERSTAND" in the textbox.</span>
+    </div>
+    <br />
+<%
+    }
+    
+%>
+
+<form id="activateForm" action="activatePatient.jsp" method="post">
+<input type="hidden" name="formIsFilled" value="true"><br />
+<table cellspacing=0 align=center cellpadding=0>
+    <tr>
+        <td valign=top>
+        <table class="fTable" align=center style="width: 350px;">
+            <tr>
+                <th colspan="4">Activate Patient</th>
+            </tr>        
+            <tr>
+            
+                <td class="subHeaderVertical">First Name:</td>
+                <td><%= StringEscapeUtils.escapeHtml("" + (p.getFirstName())) %></td>
+                <td class="subHeaderVertical">Last Name:</td>
+                <td><%= StringEscapeUtils.escapeHtml("" + (p.getLastName())) %></td>
+            </tr>
+            <tr>
+                <td colspan="4">Are you absolutely sure you want to ACTIVATE this
+                patient?  If you are sure, type "I UNDERSTAND" into the box below 
+                and click the button</td>
+            </tr>
+            <tr>
+                <td colspan="4"><div align="center"><input name="understand" type="text"></div></td>
+            </tr>
+        </table>
+        </td>
+    </tr>
+</table>
+<br />
+<div align=center>
+    <input type="submit" name="action"
+        style="font-size: 16pt; font-weight: bold;" value="Activate Patient"><br /><br />
+</div>
+</form>
+<% } %>
+<br />
+<br />
+<itrust:patientNav thisTitle="Activate" />
+
+<%@include file="/footer.jsp"%>
diff --git a/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientInfo.jsp b/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientInfo.jsp
index 48a38912b1bf6fb5125ca48b44dd33fdf39f1941..e3e5cd08fc276e14bf31560a8e745db10997ec3a 100644
--- a/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientInfo.jsp
+++ b/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientInfo.jsp
@@ -37,17 +37,17 @@ DateFormat df = DateFormat.getDateInstance();
 
 String switchString = "";
 if (request.getParameter("switch") != null) {
-	switchString = request.getParameter("switch");
+    switchString = request.getParameter("switch");
 }
 
 String relativeString = "";
 if (request.getParameter("relative") != null) {
-	relativeString = request.getParameter("relative");
+    relativeString = request.getParameter("relative");
 }
 
 String patientString = "";
 if (request.getParameter("patient") != null) {
-	patientString = request.getParameter("patient");
+    patientString = request.getParameter("patient");
 }
 
 String pidString;
@@ -56,56 +56,52 @@ long pid = 0;
 if (switchString.equals("true")) pidString = "";
 else if (!relativeString.equals("")) {
 
-	int relativeIndex = Integer.parseInt(relativeString);
-	List<PatientBean> relatives = (List<PatientBean>) session.getAttribute("relatives");
-	pid = relatives.get(relativeIndex).getMID();
-	pidString = "" + pid;
-	session.removeAttribute("relatives");
-	session.setAttribute("pid", pidString);
+    int relativeIndex = Integer.parseInt(relativeString);
+    List<PatientBean> relatives = (List<PatientBean>) session.getAttribute("relatives");
+    pid = relatives.get(relativeIndex).getMID();
+    pidString = "" + pid;
+    session.removeAttribute("relatives");
+    session.setAttribute("pid", pidString);
 }
 else if (!patientString.equals("")) {
 
-	int patientIndex = Integer.parseInt(patientString);
-	List<PatientBean> patients = (List<PatientBean>) session.getAttribute("patients");
-	pid = patients.get(patientIndex).getMID();
-	pidString = "" + pid;
-	session.removeAttribute("patients");
-	session.setAttribute("pid", pidString);
+    int patientIndex = Integer.parseInt(patientString);
+    List<PatientBean> patients = (List<PatientBean>) session.getAttribute("patients");
+    pid = patients.get(patientIndex).getMID();
+    pidString = "" + pid;
+    session.removeAttribute("patients");
+    session.setAttribute("pid", pidString);
 }
 else {
-	if (session.getAttribute("pid") == null) {
-		pid = 0;
-		pidString = "";
-	} else {
-		pid = (long) Long.parseLong((String) session.getAttribute("pid"));
-		pidString = ""+pid;
-	}
+    if (session.getAttribute("pid") == null) {
+        pid = 0;
+        pidString = "";
+    } else {
+        pid = (long) Long.parseLong((String) session.getAttribute("pid"));
+        pidString = ""+pid;
+    }
 }
 
 if (pidString == null || 1 > pidString.length()) {
-	response.sendRedirect("../getPatientID.jsp?forward=hcp-uap/editPHR.jsp");
-	
-   	return;
+    response.sendRedirect("../getPatientID.jsp?forward=hcp-uap/editPHR.jsp");
+    
+       return;
 }
 loggingAction.logEvent(TransactionType.PATIENT_HEALTH_INFORMATION_VIEW, loggedInMID.longValue(), pid, "");
 
-//else {
-//	session.removeAttribute("pid");
-//}
-
 
 EditPHRAction action = new EditPHRAction(prodDAO,loggedInMID.longValue(), pidString);
 pid = action.getPid();
 String confirm = "";
 if(request.getParameter("addA") != null)
 {
-	try{
-		confirm = action.updateAllergies(pid,request.getParameter("description"));
-		loggingAction.logEvent(TransactionType.PATIENT_HEALTH_INFORMATION_EDIT, loggedInMID.longValue(), pid, "");
-	} catch(Exception e)
-	{
-		confirm = e.getMessage();
-	}
+    try{
+        confirm = action.updateAllergies(pid,request.getParameter("description"));
+        loggingAction.logEvent(TransactionType.PATIENT_HEALTH_INFORMATION_EDIT, loggedInMID.longValue(), pid, "");
+    } catch(Exception e)
+    {
+        confirm = e.getMessage();
+    }
 }
 
 PatientBean patient = action.getPatient();
@@ -116,105 +112,107 @@ List<FamilyMemberBean> family = action.getFamily();
 %>
 
 
-<%@page import="edu.ncsu.csc.itrust.exception.NoHealthRecordsException"%><script type="text/javascript">
-function showRisks(){
-	document.getElementById("risks").style.display="inline";
-	document.getElementById("riskButton").style.display="none";
-}
+<%@page import="edu.ncsu.csc.itrust.exception.NoHealthRecordsException"%>
+
+<script type="text/javascript">
+    function showRisks(){
+        document.getElementById("risks").style.display="inline";
+        document.getElementById("riskButton").style.display="none";
+    }
 </script>
 
 <% if (!"".equals(confirm)) {%>
 <span class="iTrustError"><%= StringEscapeUtils.escapeHtml("" + (confirm)) %></span><br />
 <% } %>
 
-<br />
-
 
+<br />
 <a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp" style="text-decoration: none;">
     <input type=button value="Go Back to Pre-Registered Patient List" onClick="location='/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp';">
 </a>
 <br /><br />
 
-
+<td>
+     <a href="activatePatient.jsp" style="text-decoration: none;">
+                <input type=button value="Activate" >
+     </a>
+</td>
 
 <div align=center>
-	<div style="margin-right: 10px;">
-		<table class="fTable" align="center">
-			<tr>
-				<th colspan="2">Patient Information</th>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical">Name:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getFullName())) %></td>
-			</tr>
-			<tr>
-				<td  class="subHeaderVertical">Address:</td>
-				<td > <%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress1())) %><br />
-				     <%="".equals(patient.getStreetAddress2()) ? "" : patient.getStreetAddress2() + "<br />"%>
-				     <%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress3())) %><br />									  
-				</td>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical">Phone:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getPhone())) %></td>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical" >Email:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getEmail())) %></td>
-			</tr>
-
-
-			<tr>
-				<th colspan="2">Insurance Information</th>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical" >Provider Name:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcName())) %></td>
-			</tr>
-			<tr>
-				<td  class="subHeaderVertical">Address:</td>
-				<td > <%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress1())) %><br />
-					<%="".equals(patient.getIcAddress2()) ? "" : patient.getIcAddress2() + "<br />"%>
-					<%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress3())) %><br />							
-				</td>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical">Phone:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcPhone())) %></td>
-			</tr>
-		</table>
-		<br />
-
-	</div>
-	<div style="margin-right: 10px;">
-		<table class="fTable" align="center">
-			<tr>
-				<th colspan="2">Basic Health Records</th>
-			</tr>
-			<% if (null == mostRecent) { %>
-			<tr><td colspan=2>No basic health records are on file for this patient</td></tr>
-			<% } else {%>
-			<tr>
-				<td class="subHeaderVertical">Height:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getHeight())) %>in.</td>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical">Weight:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getWeight())) %>lbs.</td>
-			</tr>
-			<tr>
-				<td class="subHeaderVertical">Smoker?:</td>
-				<td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getSmokingStatus()) + " - " + (mostRecent.getSmokingStatusDesc())) %></td>
-			</tr>
-
-			<% } //closing for "there is a most recent record for this patient" %>
-		</table>
-		<br />
-		
-	</div>
-	
+    <div style="margin-right: 10px;">
+        <table class="fTable" align="center">
+            <tr>
+                <th colspan="2">Patient Information</th>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical">Name:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (patient.getFullName())) %></td>
+            </tr>
+            <tr>
+                <td  class="subHeaderVertical">Address:</td>
+                <td > <%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress1())) %><br />
+                     <%="".equals(patient.getStreetAddress2()) ? "" : patient.getStreetAddress2() + "<br />"%>
+                     <%= StringEscapeUtils.escapeHtml("" + (patient.getStreetAddress3())) %><br />                                      
+                </td>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical">Phone:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (patient.getPhone())) %></td>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical" >Email:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (patient.getEmail())) %></td>
+            </tr>
+
+            <tr>
+                <th colspan="2">Insurance Information</th>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical" >Provider Name:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcName())) %></td>
+            </tr>
+            <tr>
+                <td  class="subHeaderVertical">Address:</td>
+                <td > <%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress1())) %><br />
+                    <%="".equals(patient.getIcAddress2()) ? "" : patient.getIcAddress2() + "<br />"%>
+                    <%= StringEscapeUtils.escapeHtml("" + (patient.getIcAddress3())) %><br />                            
+                </td>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical">Phone:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (patient.getIcPhone())) %></td>
+            </tr>
+        </table>
+        <br />
+
+    </div>
+    
+    <div style="margin-right: 10px;">
+        <table class="fTable" align="center">
+            <tr>
+                <th colspan="2">Basic Health Records</th>
+            </tr>
+            <% if (null == mostRecent) { %>
+            <tr><td colspan=2>No basic health records are on file for this patient</td></tr>
+            <% } else {%>
+            <tr>
+                <td class="subHeaderVertical">Height:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getHeight())) %>in.</td>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical">Weight:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getWeight())) %>lbs.</td>
+            </tr>
+            <tr>
+                <td class="subHeaderVertical">Smoker?:</td>
+                <td ><%= StringEscapeUtils.escapeHtml("" + (mostRecent.getSmokingStatus()) + " - " + (mostRecent.getSmokingStatusDesc())) %></td>
+            </tr>
+
+            <% } //closing for "there is a most recent record for this patient" %>
+        </table>
+        <br />
+    </div>
 </div>
-
 <br />
 <br />
 
diff --git a/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientList.jsp b/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientList.jsp
index 565d87152112fc753e5a96d452b46c14b03207c3..82f420c2b084ce7311746150fb3dcd5bca8a7586 100644
--- a/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientList.jsp
+++ b/iTrust/WebRoot/auth/hcp-uap/viewPreRegisteredPatientList.jsp
@@ -18,110 +18,119 @@ pageTitle = "iTrust - View All Pre-Registered Patients";
 
 <%
 ViewPreRegisteredPatientListAction action = new ViewPreRegisteredPatientListAction(prodDAO, loggedInMID.longValue());
-                            ///////////////////////              ViewPatientOfficeVisitHistoryAction(prodDAO, loggedInMID.longValue());
 
-//List<PatientBean> PreRegisteredPatientList = action.getPatients();   ////////   action   is    in     ViewPreRegisteredPatientListAction
-                             ////////////////       ????????????????  change   <PatientVisitBean> patientVisits  to   PreRegisteredPatientList
 List<PatientBean> PreRegisteredPatientList = action.getPreRegisteredPatients();
-                            		 
-loggingAction.logEvent(TransactionType.PATIENT_LIST_VIEW, loggedInMID, 0, "");  //////////   ?????????     TransactionType.PATIENT_LIST_VIEW
+                                     
+loggingAction.logEvent(TransactionType.PATIENT_LIST_VIEW, loggedInMID, 0, "");
 
 %>
-			<script src="/iTrust/DataTables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
-			<script type="text/javascript">
-				jQuery.fn.dataTableExt.oSort['lname-asc']  = function(x,y) {
-					var a = x.split(" ");
-					var b = y.split(" ");
-					return ((a[1] < b[1]) ? -1 : ((a[1] > b[1]) ?  1 : 0));
-				};
-				
-				jQuery.fn.dataTableExt.oSort['lname-desc']  = function(x,y) {
-					var a = x.split(" ");
-					var b = y.split(" ");
-					return ((a[1] < b[1]) ? 1 : ((a[1] > b[1]) ?  -1 : 0));
-				};
-			</script>
-			<script type="text/javascript">	
-   				$(document).ready(function() {
-       				$("#patientList").dataTable( {
-       					"aaColumns": [ [2,'dsc'] ],
-       					"aoColumns": [ { "sType": "lname" }, null, null],
-       					"bStateSave": true,
-       					"sPaginationType": "full_numbers"
-       				});
-   				});
-			</script>
-			<style type="text/css" title="currentStyle">
-				@import "/iTrust/DataTables/media/css/demo_table.css";		
-			</style>
+
+<script src="/iTrust/DataTables/media/js/jquery.dataTables.min.js" type="text/javascript"></script>
+    <script type="text/javascript">
+    jQuery.fn.dataTableExt.oSort['lname-asc']  = function(x,y) {
+        var a = x.split(" ");
+        var b = y.split(" ");
+        return ((a[1] < b[1]) ? -1 : ((a[1] > b[1]) ?  1 : 0));
+    };
+                
+    jQuery.fn.dataTableExt.oSort['lname-desc']  = function(x,y) {
+        var a = x.split(" ");
+        var b = y.split(" ");
+        return ((a[1] < b[1]) ? 1 : ((a[1] > b[1]) ?  -1 : 0));
+    };
+</script>
+            
+<script type="text/javascript">    
+       $(document).ready(function() {
+                       $("#patientList").dataTable( {
+                           "aaColumns": [ [2,'dsc'] ],
+                           "aoColumns": [ { "sType": "lname" }, null, null],
+                           "bStateSave": true,
+                           "sPaginationType": "full_numbers"
+                       });
+                   });
+</script>
+
+
+<style type="text/css" title="currentStyle">
+@import "/iTrust/DataTables/media/css/demo_table.css";        
+</style>
 
 <br />
-	<h2>Pre-Registered Patients</h2>
+    <h2>Pre-Registered Patients</h2>
+    
 <form action="viewReport.jsp" method="post" name="myform">
 <table class="display fTable" id="patientList" align="center">
-	
-	
-	<script type="text/javascript">
-        function showRisks(){       /////////////////////////////////////        for  BUTTONS  DEACTIVE,   Should  HIDE  ROW.
-	        //document.getElementById("risks").style.display="inline";
-	        //document.getElementById("riskButton").style.display="none";
-	        return;
-        }
+    
+    <script type="text/javascript">
+        var editButtonId = "";
+        
+        function showButton(){
+            document.getElementById(editButtonId).style.display="none";
+            return;
+        }  
     </script>
-	
-	<thead>
 
+    <thead>
+    <tr class="">
+        <th>Deactivate</th>
+        <th>Name</th>
+        <th>Address</th>
+        <th>Email</th>
 
-	<tr class="">
-	    <th>Approve</th>
-	    <th>Deactivate</th>
-		<th>Name</th>
-		<th>Address</th>
-		<th>Email</th>
-
-	</tr>
-	</thead>
-	<tbody>
-	<%
-		List<PatientBean> patientsList = new ArrayList<PatientBean>();         ///////////////////////////////////
-		int index = 0;
-		
-		for (PatientBean bean : PreRegisteredPatientList) {      //////////   ????????????????????   Change   PatientVisitBean to   PatientBean
-			patientsList.add(bean);
-	%>
-	<tr>
-	    <td>
-	        <a href="editPatient.jsp" style="text-decoration: none;">
-		    	<input type=button value="Activate" onclick="javascript:showRisks();">
-		    </a>
-		</td>
-	    <td>
-	        <a href="editPatient.jsp" style="text-decoration: none;">
-		    	<input type=button value="DeActivate" onclick="javascript:showRisks();">
-		    </a>
-	    </td>
-	    
-		<td >
-			<a href="viewPreRegisteredPatientInfo.jsp?patient=<%= StringEscapeUtils.escapeHtml("" + (index)) %>">
-		
-		
-			<%= StringEscapeUtils.escapeHtml("" + (bean.getFullName())) %>	
-		
-		
-			</a>
-			</td>
-		<td ><%= StringEscapeUtils.escapeHtml("" + (bean.getStreetAddress1() +" " +bean.getStreetAddress2() +" " +bean.getStreetAddress3())) %></td>
-		<td >
-				<%= StringEscapeUtils.escapeHtml("" + (bean.getEmail())) %>
-		</td>
-	</tr>
-	<%
-			index ++;
-		}
-		
-		session.setAttribute("patients", patientsList);                 ////////////////////        ??????????????????????????????????????????
-	%>
-	</tbody>
+    </tr>
+    </thead>
+    <tbody>
+    <%
+        List<PatientBean> patientsList = new ArrayList<PatientBean>();
+        int index = 0;
+        
+        for (PatientBean bean : PreRegisteredPatientList) {
+            patientsList.add(bean);
+            String idName = "row" + index;
+            String editButtonName = "button" + index;
+    %>
+    
+    <script type="text/javascript">
+        
+        row_id = "<%=idName%>";
+        
+        function hideRow(rowId){  
+            rowId = "<%=idName%>";
+            document.getElementById(rowId).style.display="none";
+            return;
+        }
+        
+        editButtonId = "<%=editButtonName%>";
+        
+    </script>
+    
+    <tr id=<%=idName%>>
+        <td>
+            <a style="text-decoration: none;">
+                <input type=button value="DeActivate" onclick="javascript:hideRow(row_id);">
+            </a>
+        </td>
+        
+        <td >
+            <a href="viewPreRegisteredPatientInfo.jsp?patient=<%= StringEscapeUtils.escapeHtml("" + (index)) %>" id=<%=editButtonName%>>
+        
+            <%= StringEscapeUtils.escapeHtml("" + (bean.getFullName())) %>    
+        
+            </a>
+        </td>
+        <td ><%= StringEscapeUtils.escapeHtml("" + (bean.getStreetAddress1() +" " +bean.getStreetAddress2() +" " +bean.getCity() +" " +bean.getState()) +" " +bean.getZip()) %></td>
+        <td >
+                <%= StringEscapeUtils.escapeHtml("" + (bean.getEmail())) %>
+        </td>
+    </tr>
+    <%
+            index ++;
+        }
+        
+        session.setAttribute("patients", patientsList);
+    %>
+    </tbody>
 </table>
 </form>
 <br />
diff --git a/iTrust/WebRoot/auth/hcp/menu.jsp b/iTrust/WebRoot/auth/hcp/menu.jsp
index 6ef780f2609c3e2c4a7342bb3c78003951c1c0cf..a5b31eb260cb613f90a0c066787f0ef9d09dad0c 100644
--- a/iTrust/WebRoot/auth/hcp/menu.jsp
+++ b/iTrust/WebRoot/auth/hcp/menu.jsp
@@ -1,158 +1,159 @@
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#info-menu">
-		<h2 class="panel-title">Patient Info</h2>
-	</div>
-	<div class="panel-body" id="info-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp">Pre-Registered Patients</a></li>
-		    <li><a href="/iTrust/auth/hcp-uap/viewPatientOfficeVisitHistory.jsp">All Patients</a>
-			<li><a href="/iTrust/auth/hcp-uap/viewBasicHealth.jsp">Basic Health Information</a>
-			<li><a href="/iTrust/auth/hcp-uap/editPatient.jsp">Patient Information</a>
-			<li><a href="/iTrust/auth/hcp-uap/editPHR.jsp">PHR Information</a>
-			<li><a href="/iTrust/auth/hcp/editRepresentatives.jsp">Representatives</a>
-			<li><a href="/iTrust/auth/hcp-uap/viewImmunizations.jsp">Immunization Report</a>
-		    <li><a href="/iTrust/auth/hcp-er/emergencyReport.jsp">Emergency Patient Report</a>
-		    <li><a href="/iTrust/auth/hcp-uap/viewMyReportRequests.jsp">My Report Requests</a>
-		    <li><a href="/iTrust/auth/hcp-uap/viewRecordsReleases.jsp">Records Release Requests</a>
-		    <li><a href="/iTrust/auth/hcp-uap/chronicDiseaseRisks.jsp">Chronic Disease Risks</a>
-			<li><a href="/iTrust/auth/hcp-pha/viewDiagnosisStatistics.jsp">Diagnosis Trends</a>
-			<li><a href="/iTrust/auth/hcp/groupReport.jsp">Group Report</a>
-			<li><a href="/iTrust/auth/hcp/changeDependency.jsp">Patient Dependency</a>
-			<!--<li><a href="/iTrust/auth/hcp-uap/deactivatePatient.jsp">Deactivate Patient</a>  -->
-			<li><a href="/iTrust/auth/hcp/auditPage.jsp">Audit Patients</a>
-			<li><a href="/iTrust/auth/hcp-nutritionist/viewFoodDiaries.jsp">Patient Food Diaries</a>
-			<li><a href="/iTrust/auth/hcp-nutritionist/macronutrients.jsp">Patient Macronutrient Intake</a>
-			<li><a href="/iTrust/auth/hcp-fitness/viewExerciseDiaries.jsp">Patient Exercise Diaries</a>
-			<li><a href="/iTrust/auth/hcp/viewSleepDiaries.jsp">Patient Sleep Diaries</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#info-menu">
+        <h2 class="panel-title">Patient Info</h2>
+    </div>
+    
+    <div class="panel-body" id="info-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp-uap/viewPreRegisteredPatientList.jsp">View Pre-Registered Patients</a>
+            <li><a href="/iTrust/auth/hcp-uap/viewPatientOfficeVisitHistory.jsp">All Patients</a>
+            <li><a href="/iTrust/auth/hcp-uap/viewBasicHealth.jsp">Basic Health Information</a>
+            <li><a href="/iTrust/auth/hcp-uap/editPatient.jsp">Patient Information</a>
+            <li><a href="/iTrust/auth/hcp-uap/editPHR.jsp">PHR Information</a>
+            <li><a href="/iTrust/auth/hcp/editRepresentatives.jsp">Representatives</a>
+            <li><a href="/iTrust/auth/hcp-uap/viewImmunizations.jsp">Immunization Report</a>
+            <li><a href="/iTrust/auth/hcp-er/emergencyReport.jsp">Emergency Patient Report</a>
+            <li><a href="/iTrust/auth/hcp-uap/viewMyReportRequests.jsp">My Report Requests</a>
+            <li><a href="/iTrust/auth/hcp-uap/viewRecordsReleases.jsp">Records Release Requests</a>
+            <li><a href="/iTrust/auth/hcp-uap/chronicDiseaseRisks.jsp">Chronic Disease Risks</a>
+            <li><a href="/iTrust/auth/hcp-pha/viewDiagnosisStatistics.jsp">Diagnosis Trends</a>
+            <li><a href="/iTrust/auth/hcp/groupReport.jsp">Group Report</a>
+            <li><a href="/iTrust/auth/hcp/changeDependency.jsp">Patient Dependency</a>
+            <li><a href="/iTrust/auth/hcp-uap/deactivatePatient.jsp">Deactivate Patient</a>
+            <li><a href="/iTrust/auth/hcp/auditPage.jsp">Audit Patients</a>
+            <li><a href="/iTrust/auth/hcp-nutritionist/viewFoodDiaries.jsp">Patient Food Diaries</a>
+            <li><a href="/iTrust/auth/hcp-nutritionist/macronutrients.jsp">Patient Macronutrient Intake</a>
+            <li><a href="/iTrust/auth/hcp-fitness/viewExerciseDiaries.jsp">Patient Exercise Diaries</a>
+            <li><a href="/iTrust/auth/hcp/viewSleepDiaries.jsp">Patient Sleep Diaries</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#appt-menu">
-		<h2 class="panel-title">Appointments</h2>
-	</div>
-	<div class="panel-body" id="appt-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp/scheduleAppt.jsp">Schedule Appointment</a>
-			<li><a href="/iTrust/auth/hcp/viewMyAppts.jsp">View My Appointments</a>
-			<li><a href="/iTrust/auth/hcp/viewMyApptRequests.jsp">Appointment Requests</a>
-		    <li><a href="/iTrust/auth/hcp/calendar.jsp">Appointment Calendar</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#appt-menu">
+        <h2 class="panel-title">Appointments</h2>
+    </div>
+    <div class="panel-body" id="appt-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp/scheduleAppt.jsp">Schedule Appointment</a>
+            <li><a href="/iTrust/auth/hcp/viewMyAppts.jsp">View My Appointments</a>
+            <li><a href="/iTrust/auth/hcp/viewMyApptRequests.jsp">Appointment Requests</a>
+            <li><a href="/iTrust/auth/hcp/calendar.jsp">Appointment Calendar</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"   anim-type="collapse" anim-target="#ov-menu">
-		<h2 class="panel-title">Office Visits</h2>
-	</div>
-	<div class="panel-body" id="ov-menu">
-		<ul class="nav nav-sidebar">
-		   <li><a href="/iTrust/auth/hcp-uap/documentOfficeVisit.jsp">Document Office Visit</a>
-		   <li><a href="/iTrust/auth/hcp/visitReminders.jsp">Office Visit Reminders</a>
-		   <li><a href="/iTrust/auth/hcp/LabProcHCP.jsp">Laboratory Procedures</a>
-		   <li><a href="/iTrust/auth/hcp-uap/viewSentReferrals.jsp">Sent Referrals</a>
-		   <li><a href="/iTrust/auth/hcp-uap/viewReceivedReferrals.jsp">Received Referrals</a>
-		</ul>
-	</div>
+    <div class="panel-heading"   anim-type="collapse" anim-target="#ov-menu">
+        <h2 class="panel-title">Office Visits</h2>
+    </div>
+    <div class="panel-body" id="ov-menu">
+        <ul class="nav nav-sidebar">
+           <li><a href="/iTrust/auth/hcp-uap/documentOfficeVisit.jsp">Document Office Visit</a>
+           <li><a href="/iTrust/auth/hcp/visitReminders.jsp">Office Visit Reminders</a>
+           <li><a href="/iTrust/auth/hcp/LabProcHCP.jsp">Laboratory Procedures</a>
+           <li><a href="/iTrust/auth/hcp-uap/viewSentReferrals.jsp">Sent Referrals</a>
+           <li><a href="/iTrust/auth/hcp-uap/viewReceivedReferrals.jsp">Received Referrals</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#msg-menu">
-		<h2 class="panel-title">Messaging</h2>
-	</div>
-	<div class="panel-body" id="msg-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp/sendMessage.jsp">Compose a Message</a>
-			<li><a href="/iTrust/auth/hcp-patient/messageInbox.jsp">Message Inbox</a>
-			<li><a href="/iTrust/auth/hcp-patient/messageOutbox.jsp">Message Outbox</a>
-		    <li><a href="/iTrust/auth/hcp-uap/showEmailHistory.jsp">Email History</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#msg-menu">
+        <h2 class="panel-title">Messaging</h2>
+    </div>
+    <div class="panel-body" id="msg-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp/sendMessage.jsp">Compose a Message</a>
+            <li><a href="/iTrust/auth/hcp-patient/messageInbox.jsp">Message Inbox</a>
+            <li><a href="/iTrust/auth/hcp-patient/messageOutbox.jsp">Message Outbox</a>
+            <li><a href="/iTrust/auth/hcp-uap/showEmailHistory.jsp">Email History</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#tele-menu">
-		<h2 class="panel-title">Telemedicine</h2>
-	</div>
-	<div class="panel-body" id="tele-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp/editPatientList.jsp">Edit Patient List</a>
-			<li><a href="/iTrust/auth/hcp/monitorPatients.jsp">Monitor Patients</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#tele-menu">
+        <h2 class="panel-title">Telemedicine</h2>
+    </div>
+    <div class="panel-body" id="tele-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp/editPatientList.jsp">Edit Patient List</a>
+            <li><a href="/iTrust/auth/hcp/monitorPatients.jsp">Monitor Patients</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#add-menu">
-		<h2 class="panel-title">Add</h2>
-	</div>
-	<div class="panel-body" id="add-menu">
-		<ul class="nav nav-sidebar">
-		   <li><a href="/iTrust/auth/hcp-uap/addPatient.jsp">Patient</a></li>
-		   <li><a href="/iTrust/auth/hcp-uap/uploadPatientFile.jsp">Upload Patient File</a></li>
-		   <li><a href="/iTrust/auth/hcp/addUAP.jsp">UAP</a></li>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#add-menu">
+        <h2 class="panel-title">Add</h2>
+    </div>
+    <div class="panel-body" id="add-menu">
+        <ul class="nav nav-sidebar">
+           <li><a href="/iTrust/auth/hcp-uap/addPatient.jsp">Patient</a></li>
+           <li><a href="/iTrust/auth/hcp-uap/uploadPatientFile.jsp">Upload Patient File</a></li>
+           <li><a href="/iTrust/auth/hcp/addUAP.jsp">UAP</a></li>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#pi-menu">
-		<h2 class="panel-title">Personal Info</h2>
-	</div>
-	<div class="panel-body" id="pi-menu">
-		<ul class="nav nav-sidebar">
-   			<li><a href="/iTrust/auth/staff/editMyDemographics.jsp">My Demographics</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#pi-menu">
+        <h2 class="panel-title">Personal Info</h2>
+    </div>
+    <div class="panel-body" id="pi-menu">
+        <ul class="nav nav-sidebar">
+               <li><a href="/iTrust/auth/staff/editMyDemographics.jsp">My Demographics</a>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#ob-menu">
-		<h2 class="panel-title">Obstetrics</h2>
-	</div>
-	<div class="panel-body" id="ob-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp/obstetricsHome.jsp">Obstetrics Home</a></li>
-			<li><a href="/iTrust/auth/hcp/addObstetricsInitialRecord.jsp">Initialize Obstetrics Patient</a></li>
-			<li><a href="/iTrust/auth/hcp/obstetricsHome.jsp?view">View Obstetrics Records</a></li>
-			<li><a href="/iTrust/auth/hcp/addObstetricsOfficeVisit.jsp">Add Obstetrics Office Visit</a></li>
-			<li><a href="/iTrust/auth/hcp/obstetricsPreExistingConditions.jsp">Patient Pre-existing Conditions</a></li>
-			<li><a href="/iTrust/auth/hcp/obstetricsAlergies.jsp">Patient Allergies</a></li>
-			<li><a href="/iTrust/auth/hcp/laborDeliveryReport.jsp">Labor and Delivery Report</a></li>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#ob-menu">
+        <h2 class="panel-title">Obstetrics</h2>
+    </div>
+    <div class="panel-body" id="ob-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp/obstetricsHome.jsp">Obstetrics Home</a></li>
+            <li><a href="/iTrust/auth/hcp/addObstetricsInitialRecord.jsp">Initialize Obstetrics Patient</a></li>
+            <li><a href="/iTrust/auth/hcp/obstetricsHome.jsp?view">View Obstetrics Records</a></li>
+            <li><a href="/iTrust/auth/hcp/addObstetricsOfficeVisit.jsp">Add Obstetrics Office Visit</a></li>
+            <li><a href="/iTrust/auth/hcp/obstetricsPreExistingConditions.jsp">Patient Pre-existing Conditions</a></li>
+            <li><a href="/iTrust/auth/hcp/obstetricsAlergies.jsp">Patient Allergies</a></li>
+            <li><a href="/iTrust/auth/hcp/laborDeliveryReport.jsp">Labor and Delivery Report</a></li>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#oph-menu">
-		<h2 class="panel-title">Ophthalmology</h2>
-	</div>
-	<div class="panel-body" id="oph-menu">
-		<ul class="nav nav-sidebar">
-			<li><a href="/iTrust/auth/hcp/ophthalmologyHome.jsp">Ophthalmology Home</a></li>
-			<li><a href="/iTrust/auth/hcp/viewOphthalmologyScheduleRequests.jsp">View Ophthalmology Office Visit Requests</a></li>
-			<li><a href="/iTrust/auth/hcp/viewOphthalmologyScheduleOV.jsp">View Scheduled Ophthalmology Office Visits</a></li>
-			<li><a href="/iTrust/auth/hcp/ophthalmologyHome.jsp?view">View Ophthalmology Records</a></li>
-			<li><a href="/iTrust/auth/hcp/addOphthalmologyOV.jsp">Add Ophthalmology Office Visit</a></li>
-			<li><a href="/iTrust/auth/hcp/ophthalmologySurgeryHome.jsp">Surgical Ophthalmology Home</a></li>
-			<li><a href="/iTrust/auth/hcp/ophthalmologySurgeryHome.jsp?view">View Surgical Ophthalmology Records</a></li>
-			<li><a href="/iTrust/auth/hcp/addOphthalmologySurgery.jsp">Add Surgical Ophthalmology Office Visit</a></li>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#oph-menu">
+        <h2 class="panel-title">Ophthalmology</h2>
+    </div>
+    <div class="panel-body" id="oph-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/hcp/ophthalmologyHome.jsp">Ophthalmology Home</a></li>
+            <li><a href="/iTrust/auth/hcp/viewOphthalmologyScheduleRequests.jsp">View Ophthalmology Office Visit Requests</a></li>
+            <li><a href="/iTrust/auth/hcp/viewOphthalmologyScheduleOV.jsp">View Scheduled Ophthalmology Office Visits</a></li>
+            <li><a href="/iTrust/auth/hcp/ophthalmologyHome.jsp?view">View Ophthalmology Records</a></li>
+            <li><a href="/iTrust/auth/hcp/addOphthalmologyOV.jsp">Add Ophthalmology Office Visit</a></li>
+            <li><a href="/iTrust/auth/hcp/ophthalmologySurgeryHome.jsp">Surgical Ophthalmology Home</a></li>
+            <li><a href="/iTrust/auth/hcp/ophthalmologySurgeryHome.jsp?view">View Surgical Ophthalmology Records</a></li>
+            <li><a href="/iTrust/auth/hcp/addOphthalmologySurgery.jsp">Add Surgical Ophthalmology Office Visit</a></li>
+        </ul>
+    </div>
 </div>
 
 <div class="panel panel-default">
-	<div class="panel-heading"  anim-type="collapse" anim-target="#other-menu">
-		<h2 class="panel-title">Other</h2>
-	</div>
-	<div class="panel-body" id="other-menu">
-		<ul class="nav nav-sidebar">
-		    <li><a href="/iTrust/auth/staff/linkToResources.jsp">Edit Diagnoses URLs</a>
-		    <li><a href="/iTrust/auth/hcp/manageWards.jsp">Manage Wards</a>
-		    <li><a href="/iTrust/auth/staff/editPersonnel.jsp">UAPs</a>
-			<li><a href="/iTrust/auth/surveyResults.jsp">Satisfaction Survey Results</a>
-			<li><a href="/iTrust/auth/hcp/viewPrescriptionRenewalNeeds.jsp">Potential Prescription-Renewals</a>
-		</ul>
-	</div>
+    <div class="panel-heading"  anim-type="collapse" anim-target="#other-menu">
+        <h2 class="panel-title">Other</h2>
+    </div>
+    <div class="panel-body" id="other-menu">
+        <ul class="nav nav-sidebar">
+            <li><a href="/iTrust/auth/staff/linkToResources.jsp">Edit Diagnoses URLs</a>
+            <li><a href="/iTrust/auth/hcp/manageWards.jsp">Manage Wards</a>
+            <li><a href="/iTrust/auth/staff/editPersonnel.jsp">UAPs</a>
+            <li><a href="/iTrust/auth/surveyResults.jsp">Satisfaction Survey Results</a>
+            <li><a href="/iTrust/auth/hcp/viewPrescriptionRenewalNeeds.jsp">Potential Prescription-Renewals</a>
+        </ul>
+    </div>
 </div>
diff --git a/iTrust/sql/data/patient92.sql b/iTrust/sql/data/patient92.sql
new file mode 100644
index 0000000000000000000000000000000000000000..391c3b2ac1c134866a2e0f91684f210a1dbde299
--- /dev/null
+++ b/iTrust/sql/data/patient92.sql
@@ -0,0 +1,30 @@
+/*Inserting dependent Brittany Franco*/
+INSERT INTO patients
+(MID,
+lastName,
+firstName,
+email,
+address1,
+address2,
+city,
+state,
+phone,
+dateofbirth,
+Gender)
+VALUES
+(492,
+'Franco',
+'Brittany',
+'brfranco@gmail.com',
+'1333 Who Cares Road',
+'Suite 102',
+'Raleigh',
+'NC',
+'919-971-0000',
+'2006-10-25',
+'Female')
+ ON DUPLICATE KEY UPDATE MID = MID;
+
+INSERT INTO users(MID, password, role, sQuestion, sAnswer, isDependent)
+			VALUES (492, '30c952fab122c3f9759f02a6d95c3758b246b4fee239957b2d4fee46e26170c4', 'preRegisteredPatient', 'what is your favorite color?', 'blue', 0)
+ ON DUPLICATE KEY UPDATE MID = MID;
diff --git a/iTrust/src/edu/ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java b/iTrust/src/edu/ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java
new file mode 100644
index 0000000000000000000000000000000000000000..c8eb65899a5ce1b0caad70b187edea6dfef44f24
--- /dev/null
+++ b/iTrust/src/edu/ncsu/csc/itrust/action/ActivateAndDeactivatePreRegi.java
@@ -0,0 +1,108 @@
+package edu.ncsu.csc.itrust.action;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import edu.ncsu.csc.itrust.action.base.PatientBaseAction;
+import edu.ncsu.csc.itrust.beans.Email;
+import edu.ncsu.csc.itrust.beans.PatientBean;
+import edu.ncsu.csc.itrust.beans.PatientHistoryBean;
+import edu.ncsu.csc.itrust.dao.DAOFactory;
+import edu.ncsu.csc.itrust.dao.mysql.AuthDAO;
+import edu.ncsu.csc.itrust.dao.mysql.PatientDAO;
+import edu.ncsu.csc.itrust.dao.mysql.PersonnelDAO;
+import edu.ncsu.csc.itrust.exception.DBException;
+import edu.ncsu.csc.itrust.exception.FormValidationException;
+import edu.ncsu.csc.itrust.exception.ITrustException;
+import edu.ncsu.csc.itrust.validate.PatientValidator;
+
+
+/**
+ * Edits a patient Used by editPatient.jsp
+ * 
+ * 
+ */
+public class ActivateAndDeactivatePreRegi extends PatientBaseAction {
+	private PatientValidator validator = new PatientValidator();
+	private PatientDAO patientDAO;
+	private PersonnelDAO personnelDAO;
+	private AuthDAO authDAO;
+	private long loggedInMID;
+
+
+	/**
+	 * The super class validates the patient id
+	 * 
+	 * @param factory The DAOFactory used to create the DAOs for this action.
+	 * @param loggedInMID The MID of the user who is authorizing this action.
+	 * @param pidString The MID of the patient being edited.
+	 * @throws ITrustException
+	 */
+	public ActivateAndDeactivatePreRegi(DAOFactory factory, long loggedInMID, String pidString) throws ITrustException {
+		super(factory, pidString);
+		this.patientDAO = factory.getPatientDAO();
+		this.personnelDAO = factory.getPersonnelDAO();
+		this.authDAO = factory.getAuthDAO();
+		this.loggedInMID = loggedInMID;
+
+	}
+
+	/**
+	 * Takes the information out of the PatientBean param and updates the patient's information
+	 * 
+	 * @param p
+	 *            the new patient information
+	 * @throws ITrustException
+	 * @throws FormValidationException
+	 */
+	public void updateInformation(PatientBean p) throws ITrustException, FormValidationException {
+		p.setMID(pid); // for security reasons
+		validator.validate(p);
+		patientDAO.editPatient(p, loggedInMID);
+
+	}
+
+	/**
+	 * Returns a PatientBean for the patient
+	 * 
+	 * @return the PatientBean
+	 * @throws DBException
+	 */
+	public PatientBean getPatient() throws DBException {
+		return patientDAO.getPatient(this.getPid());
+	}
+
+
+	
+	/**
+	 * The DateOfDeactivationStr of the PatientBean when not null indicates that the user has been deactivated.  
+	 * @throws DBException
+	 */
+	public void deactivate() throws DBException{
+		PatientBean p=patientDAO.getPatient(this.getPid());
+		p.setMID(pid);
+		p.setDateOfDeactivationStr(new SimpleDateFormat("MM/dd/yyyy").format(Calendar.getInstance().getTime()));
+		patientDAO.editPatient(p, loggedInMID);
+		patientDAO.removeAllRepresented(pid);
+		patientDAO.removeAllRepresentee(pid);
+	}
+	
+	/**
+	 * The DateOfDeactivationStr of the PatientBean is null when the patient is activated
+	 * @throws DBException
+	 */
+	public long activate() throws DBException{
+		PatientBean p=patientDAO.getPatient(this.getPid());
+		p.setMID(pid);
+		p.setDateOfDeactivationStr(null);
+		//patientDAO.editPatient(p, loggedInMID);
+        patientDAO.ConvertPreRegisteredPatientsToPatient(this.getPid());//this.getPid());//411);    ////////////  this.getPid()
+	    
+        return this.getPid();
+    }
+
+	
+
+
+}
diff --git a/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java b/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java
index 135469b60b003d842137a314e88553fbba5ce5c4..74db4e462f9f6d94d011eb835772b7939ec36a00 100644
--- a/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java
+++ b/iTrust/src/edu/ncsu/csc/itrust/action/ViewPreRegisteredPatientListAction.java
@@ -4,7 +4,6 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Scanner;
 
-import edu.ncsu.csc.itrust.Messages;
 import edu.ncsu.csc.itrust.beans.OfficeVisitBean;
 import edu.ncsu.csc.itrust.beans.PatientBean;
 import edu.ncsu.csc.itrust.beans.PatientVisitBean;
@@ -22,38 +21,46 @@ import edu.ncsu.csc.itrust.exception.ITrustException;
  *
  */
 public class ViewPreRegisteredPatientListAction {
-	private long loggedInMID;
-	private PatientDAO patientDAO;
-	private List<PatientBean> PreRegisteredPatients;
+    private long loggedInMID;
+    private PatientDAO patientDAO;
+    private PersonnelDAO personnelDAO;
 
-	/**
-	 * Set up defaults
-	 * @param factory The DAOFactory used to create the DAOs used in this action.
-	 * @param loggedInMID The MID of the person viewing the office visits.
-	 */
-	public ViewPreRegisteredPatientListAction(DAOFactory factory) {
-	
-		this.patientDAO = factory.getPatientDAO();
-		
-	}
-	
-	/**
-	 * Identify all the PreRegistered Patients from Patients Table using  Users Table Role="PreRegistered", and add them to a list.
-	 * 
-	 * @throws ITrustException
-	 */
-	public List<PatientBean> getPreRegisteredPatients() throws ITrustException {
-		try {
+    private ArrayList<PatientBean> PreRegisteredPatients;
 
-			PreRegisteredPatients = patientDAO.getAllPreRegisteredPatients();
-			if (PreRegisteredPatients != null) {
-				return PreRegisteredPatients;
-			} else {
-				throw new ITrustException("getAllPreRegisteredPatients() has returned null");
-			}
+    /**
+     * Set up defaults
+     * @param factory The DAOFactory used to create the DAOs used in this action.
+     * @param loggedInMID The MID of the person viewing the office visits.
+     */
+    public ViewPreRegisteredPatientListAction(DAOFactory factory, long loggedInMID) {
+        this.loggedInMID = loggedInMID;
+        
+        this.personnelDAO = factory.getPersonnelDAO();
+        
+        this.patientDAO = factory.getPatientDAO(); 
+        
+        PreRegisteredPatients = new ArrayList<PatientBean>();
+    }
+    
+    /**
+     * Identify all the PreRegistered Patients from Patients Table using  Users Table Role="PreRegistered", and add them to a list.
+     * 
+     * @throws ITrustException
+     */
+    public List<PatientBean> getPreRegisteredPatients() throws ITrustException {
+        try {
+            
+            List<PatientBean> plist = patientDAO.getAllPreRegisteredPatients();
 
-		} catch (DBException dbe) {
-			throw new ITrustException(dbe.getMessage());
-		}
-	}
-}
+            for(PatientBean pb : plist) {
+                
+                PreRegisteredPatients.add(pb);
+            }
+            
+            return PreRegisteredPatients;
+        }
+        catch (DBException dbe) {
+            throw new ITrustException(dbe.getMessage());
+        }
+    }
+}
\ No newline at end of file
diff --git a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
index 6f189c3e91a97bbf974a86076a72f74228f39f8d..905f0247d81339e487d5bb54b7017e147ea08964 100644
--- a/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
+++ b/iTrust/src/edu/ncsu/csc/itrust/dao/mysql/PatientDAO.java
@@ -190,22 +190,6 @@ public class PatientDAO {
 		}
 	}
 
-	public void activatePatient(long mid) throws DBException {
-		Connection conn = null;
-		PreparedStatement ps = null;
-		try {
-			conn = factory.getConnection();
-			ps = conn.prepareStatement("UPDATE users SET role=? WHERE MID=?");
-			ps.setString(1, "patient");
-			ps.setLong(2, mid);
-
-		} catch (SQLException e) {
-			throw new DBException(e);
-		} finally {
-			DBUtil.closeConnection(conn, ps);
-		}
-	}
-
 	/**
 	 * Updates a patient's information for the given MID
 	 * 
@@ -240,7 +224,7 @@ public class PatientDAO {
 			DBUtil.closeConnection(conn, ps);
 		}
 	}
-	
+
     public boolean isEmailInUse(String email) throws DBException {
         Connection conn = null;
 		PreparedStatement ps = null;
@@ -938,7 +922,7 @@ public class PatientDAO {
 	}
 	
 	/**
-	 * Lists every patient in the database.
+	 * Lists every Approved patient in the database.
 	 * 
 	 * @return A java.util.List of PatientBeans representing the patients.
 	 * @throws DBException
@@ -988,6 +972,31 @@ public class PatientDAO {
 		}
 	}
 	
+	/**
+	 * Convert a Pre-Registered patient to a regular patient upon HCP approval.
+	 * by change "role" column in "users" table.
+	 * 
+	 * @return void
+	 * @throws DBException
+	 */
+	public void ConvertPreRegisteredPatientsToPatient(long mid) throws DBException {		
+		Connection conn = null;
+		PreparedStatement ps = null;
+		try {
+			conn = factory.getConnection();
+			ps = conn.prepareStatement("UPDATE users SET role=? WHERE MID=?");
+			ps.setString(1, "patient");
+			ps.setLong(2, mid);
+
+			ps.executeUpdate();
+			ps.close();
+
+		} catch (SQLException e) {
+			throw new DBException(e);
+		} finally {
+			DBUtil.closeConnection(conn, ps);
+		}
+	}
 	
 	/**
 	 * Return a list of patients with a special-diagnosis-history who
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPreRegisteredPatientListActionTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPreRegisteredPatientListActionTest.java
index 839bff1e0997563dfd777e59011179c22c0f8210..fec6e4229248fd258941d15c74dfb807b434c511 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPreRegisteredPatientListActionTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/action/ViewPreRegisteredPatientListActionTest.java
@@ -20,18 +20,23 @@ public class ViewPreRegisteredPatientListActionTest extends TestCase {
 	protected void setUp() throws Exception {
 		gen = new TestDataGenerator();
 		gen.clearAllTables();
-		gen.patient4();
-		gen.hcp3();
 	}
 
     public void testViewPatients() throws Exception {
-        action = new ViewPreRegisteredPatientListAction(factory);
+        long hcpMID = 900000000;
+        action = new ViewPreRegisteredPatientListAction(factory, hcpMID);
         List<PatientBean> pb = action.getPreRegisteredPatients();
-        assertEquals(pb.get(0).getMID(), 4);
+        assertEquals(0, pb.size());
+
+		pb = action.getPreRegisteredPatients();
+		assertEquals(0, pb.size());
     }
 
 	public void testNoPersonnel() throws Exception {
-		action = new ViewPreRegisteredPatientListAction(factory);
+
+        long hcpMID = 900000000;
+
+		action = new ViewPreRegisteredPatientListAction(factory, hcpMID);
         List<PatientBean> pb = action.getPreRegisteredPatients();
         for (PatientBean p : pb) {
             if (p.getMID() == 90000000) {
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/ActivatePatientTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/ActivatePatientTest.java
index 645511d18fe91b068e6a9386c3f41ee01c7ea09c..8f514418b6cedb54f27f11cb21ba84deb0e21c7b 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/ActivatePatientTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/ActivatePatientTest.java
@@ -14,17 +14,13 @@ public class ActivatePatientTest extends TestCase {
 	@Override
 	protected void setUp() throws Exception {
 		gen.clearAllTables();
-	}
-
-	public void testAddEmptyPatient() throws Exception {
-		long pid = patientDAO.addEmptyPatient();
-		assertEquals(" ", patientDAO.getName(pid));
+		gen.patient92();
 	}
 
 	public void testActivateNewPatient() throws Exception {
-		long pid = patientDAO.addEmptyPatient();
-		assertEquals("PreRegisteredPatient", patientDAO.getRole(pid));
-		patientDAO.activatePatient(pid);
+		long pid = 492;
+		assertEquals("preRegisteredPatient", patientDAO.getRole(pid));
+		patientDAO.ConvertPreRegisteredPatientsToPatient(pid);
 		assertEquals("patient", patientDAO.getRole(pid));
 	}
 }
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/GetRoleTest.java b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/GetRoleTest.java
index dab95e6491c75615b11a7595cc871817621f4b45..27760f099cf4c900dc333eb402d2abc7eb0cec0d 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/GetRoleTest.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/dao/patient/GetRoleTest.java
@@ -13,12 +13,12 @@ public class GetRoleTest extends TestCase {
 	protected void setUp() throws Exception {
 		gen = new TestDataGenerator();
 		gen.clearAllTables();
-		gen.patient2();
+		gen.patient92();
 	}
 
 	public void testGetRole() throws Exception {
-		String role = patientDAO.getRole(2);
-		assertEquals("PreRegisteredPatient", role);
+		String role = patientDAO.getRole(492);
+		assertEquals("preRegisteredPatient", role);
 	}
 	
 }
diff --git a/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java b/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
index 03037124a70bf63dceb07e8c4125466287497fdf..6d09790881787cb492052dd76f524ca4784e3367 100644
--- a/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
+++ b/iTrust/test/edu/ncsu/csc/itrust/unit/datagenerators/TestDataGenerator.java
@@ -650,6 +650,10 @@ public class TestDataGenerator {
 		new DBBuilder(factory).executeSQLFile(DIR + "/patient42.sql");
 	}
 
+	public void patient92() throws FileNotFoundException, SQLException, IOException {
+		new DBBuilder(factory).executeSQLFile(DIR + "/patient92.sql");
+	}
+
 	/**
 	 * Adds patient Anakin Skywalker for UC10 and UC37 testing purposes.
 	 *