<%@ Language=VBScript %> IEEE Survey <% dim decision dim schoolName, email,calendar, coop dim userID dim user, fname,mname,lname, schoolID, workPhone,homephone, schoolName0 dim fullname dim conn dim RSbuffer dim sqlQuery dim validTill dim maxID dim trackPage, reportID dim goToPage on error resume next session.Timeout = 360 'get user id from the session object userID = cint(session("userID")) if userID = empty then userID = cint(Request.Form("userID")) end if 'if still cannot retrieve user id then automatically logged out if userID = "" or userID = 0 then Response.redirect("surveyLogin.asp?loginFail=yes") end if 'get the report id from the session object reportID =cint(session("reportID")) if reportID= empty then reportID= cint(Request.Form("reportID")) end if session("userID")=cint(userID) session("reportID")=cint(reportID) 'make connection set conn = server.CreateObject("ADODB.connection") conn.Open ConnectionString decision= trim(Request.Form("decision")) 'check if this is the viewable page, not the continue or exit script if decision <> "move" and decision <> "exit" then 'check if the user has fill out this page sqlQuery = "select * from tbl_IEEE_report where REID="&reportID set RSBuffer = conn.Execute(sqlQuery) if RSbuffer.eof = false then calendar = trim(RSbuffer("RECALENDAR")) coop = trim(RSBUFFER("RECOOP")) end if 'get user's data from database based on its user ID sqlQuery = "select * from tbl_IEEE_user where USID="&userID set RSbuffer = conn.Execute(sqlQuery) if RSbuffer.eof = false then fName = trim(RSbuffer("USFNAME")) mname= trim(RSbuffer("USMNAME")) lname= trim(RSBUFFER("USLNAME")) email = trim(RSbuffer("USEMAIL")) schoolID = RSBUFFER("USSCID") workPhone = trim(RSbuffer("USPHONEWORK")) homephone = trim(RSbuffer("USPHONEHOME")) else 'if no data found, return to login fail page Response.Redirect("surveyLogin.asp?loginFail=yes") end if 'fullname = fname&" "&mname&" "&lname %>
  ELECTRIC POWER ENGINEERING EDUCATIONAL RESOURCES SURVEY
 Power Engineering Education Committee of IEEE Power Engineering Society
 Reporting period: Fiscal or academic year 05-06
 
 




Page 1: General Information

Reporting period: Fiscal or academic year 05-06

<% 'get school name sqlQuery = "select * from tbl_IEEE_School where SCID="&schoolID set RSbuffer = conn.Execute(sqlQuery) schoolName0 = trim(RSbuffer("SCNAME")) %>
Name of school *
  
Contact Person first * m.i. last *
Email Address
Telephone Number home        work
  
University Calendar (check one) checked <% end if %> >Quarter checked <% end if %> >Semester checked <% end if %> >Other
Coop Program (check one) checked <% end if %> value="NotAvailable" >Not Available checked <% end if %> value="Optional">Available (optional) checked <% end if %> value="Mandatory">Available (mandatory)
 
* = required

<% else 'script part of the page to process the move or exit decision userID = cint(Request.Form("userID")) schoolID = cint(Request.Form("schoolID")) reportID = cint(Request.Form("reportID")) schoolName= trim(Request.Form("schoolName")) fname = trim(Request.Form("fname")) mname = trim(Request.Form("mname")) lname = trim(Request.Form("lname")) email= trim(Request.Form("email")) workPhone = trim(Request.Form("phoneNoWork")) homePhone = trim(Request.Form("phoneNoHome")) calendar = trim(Request.Form("calendar")) coop = trim(Request.Form("coop")) 'check if any field is empty if schoolName <> "" and fname <> "" and lname <>"" then 'get report valid date till sqlQuery = "select * from tbl_IEEE_REPORTCHOICE where RCID = (select max(RCID) as maxID from" sqlQuery = sqlQuery & " tbl_IEEE_REPORTCHOICE)" set RSbuffer = conn.Execute(sqlQuery) if RSBuffer.eof = false then validTill = cdate(RSBuffer("RCVALIDTILL")) else 'first valid date validTill = cdate("12/12/2002") end if 'update user data sqlQuery = "update tbl_IEEE_user set USFNAME ='"&fname&"',USMNAME='"&mname&"',USLNAME='"&lname&"'," sqlQuery = sqlQuery&" USEMAIL ='"&email&"',USPHONEWORK='"&workphone&"',USPHONEHOME='"&homephone sqlQuery = sqlQuery&"' where USID="&userID conn.Execute(sqlQuery) 'Response.Write sqlQuery 'update school name sqlQuery= "update tbl_IEEE_SCHOOL set SCNAME='"&schoolName&"' where SCID="&schoolID conn.Execute(sqlQuery) 'Response.Write sqlQuery 'insert reported data sqlQuery ="update tbl_IEEE_REPORT set RESCID="&schoolID&",REUSID="&userId sqlQuery=sqlQuery & ",REREPORTTO=convert(datetime,'"&validTill&"',103),RECALENDAR='"&calendar sqlQuery=sqlQuery & "',RECOOP='"&coop&"',REFINISH=0 where REID="&reportID conn.Execute(sqlQuery) 'Response.Write sqlQuery if decision = "move" then 'pass these vars to the processing part session("userID")=cint(userID) session("reportID")=cint(reportID) goToPage = cint(Request.Form("goToPage")) if goToPage = 1 then Response.Redirect("survey01.asp")'for saving and no exit else if goToPage =2 then 'update trackpage number sqlQuery = "update tbl_IEEE_report set RETRACK = 2 where REID="&reportID 'Response.Write sqlQuery conn.Execute(sqlQuery) Response.Redirect("survey02pre.asp") else if goToPage =3 then Response.Redirect("survey03.asp") else if goToPage=4 then Response.Redirect("survey04pre.asp") else if goToPage = 5 then Response.Redirect("survey05.asp") end if end if end if end if end if else if decision = "exit" then session("userID") = "" session("reportID") = "" response.redirect("surveyLogin.asp") end if end if else %>
Error(s) found

You have to fill out the following fields:

<% if fname = "" or lname ="" then Response.Write "Contact Person
" end if if schoolName = "" then Response.Write "School Name
" end if %>

Click here to return to the previous page

<% end if 'end of if schoolName <> "" and fname <> "" . . . end if ' end of if decision <> "continue" and decision <> "exit" set RSbuffer = nothing set conn = nothing %>