/* Check to make sure we are connected to the database before
allowing access to the home page. If not connected, go connect
and initialize; otherwise, welcome the user.\
*/
if(!database.connected())
redirect("init.htm");
namecursor = database.cursor("select name from employee where ssn = " + client.ssn + "", true);
namecursor.next();
Current Enrollee:
write(namecursor.name);
Additional employee information is requested in this form, such as
primary coverage information. Furthermore, secondary coverage and previous
coverage sections are available for completion - in the event that either
one of them applies to you.
primary_cursor = database.cursor("select * from primary_coverage where employee_ssn = " + client.ssn + "", true);
secondary_cursor = database.cursor("select * from secondary_coverage where employee_ssn = " + client.ssn + "", true);
previous_cursor = database.cursor("select * from previous_coverage where employee_ssn = " + client.ssn + "", true);
primary_cursor.next();
secondary_cursor.next();
previous_cursor.next();
if (primary_cursor.employee_ssn != 0 && primary_cursor.medicare_elig != null) {
client.primary_action = "update";
} else {
client.primary_action = "insert";
}
if (secondary_cursor.employee_ssn != 0) {
client.secondary_action = "update";
} else {
client.secondary_action = "insert";
}
if (previous_cursor.employee_ssn != 0) {
client.previous_action = "update";
} else {
client.previous_action = "insert";
}