Vous êtes sur la page 1sur 63

<?page title="Add Question" contentType="text/html;charset=UTF-8"?

>
<zk>
<window title="Add Question" border="normal" apply="Admin.Admin_Main">
<include id="acceptFile" src=""/>
<tablelayout columns="2" width="100%">
<tablechildren width="40%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<caption label="Add Question" st
yle="font-weight:bold" />
<grid style="background-
color:WHITE; border:0px" >
<columns>
<column
width="30%"/>
<column
width="70%"/>
</columns>
<rows>
<row>
<label value="En
ter Question :"/> <textbox id="txtQue" width="100%" multiline="true"/>
</row>
<row >
<label value="Op
tion 1:"/> <textbox id="txtOp1" width="100%"/>
</row>
<row>
<label value="Op
tion 2:"/><textbox id="txtOp2" width="100%"/>
</row>
<row>
<label value="Op
tion 3:"/><textbox id="txtOp3" width="100%" />
</row>
<row>
<label value="Op
tion 4:"/><textbox id="txtOp4" width="100%" />
</row>
<row>
<label value="Is
Active:"/><checkbox id="chkIsactive" checked="true" />
</row>
<row>
<label v
alue="Answer:"/>
<combobo
x id="cmbAns" readonly="true" width="80%">
<comboit
em label="Option 1"/>
<comboit
em label="Option 2"/>
<comboit
em label="Option 3"/>
<comboit
em label="Option 4"/>

</combob
ox>
</row>
<row>
<button label="A
dd Question" id="btnAdd"/>
<grid>
<columns>
<column width="2
0%"/>
<column width="2
0%"/>
<column width="2
0%"/>
</columns>
<rows>
<row>
<hbox>
<button label="Updat
e" id="btnUpdate" visible="false"/>
<button label="Delet
e" id="btnDelete" visible="false"/>
<button label="C
ancel" id="btnCancel" href="index.zul"/>
</hbox>
</row>
</rows>
</grid>
</row>
</rows>
</grid>
</groupbox>
<hbox>
<label id="lblMsg"/>
</hbox>
</panelchildren>
</panel>
</tablechildren>
<tablechildren width="60%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<button label="Display Exist questions"
id="btnDisplay"/>
<listbox id="listQuest" fixedLayout="tru
e" mold="paging" pagingPosition="top" pageSize="10" >
<listhead>
<listheader label="Sr No" al
ign="center" width="10%" />
<listheader label="Quest
ion" align="left" width="30%"/>
<listheader label="Optio
n1" align="left" width="10%"/>
<listheader label="Optio
n2" align="left" width="10%"/>
<listheader label="Optio
n3" align="left" width="10%"/>
<listheader label="Optio
n4" align="left" width="10%"/>
</listhead>
</listbox>
</groupbox>
</panelchildren>
</panel>
</tablechildren>

<!--
<tablechildren>
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" he
ight="200px" width="200px" >
<image src="/img/images.jpeg" he
ight="200px" width="200px"/>
</groupbox>
</panelchildren>
</panel>
</tablechildren>
-->
</tablelayout>
</window>
</zk>
<?page title="Add User" contentType="text/html;charset=UTF-8"?>
<zk>
<window title="Add User" border="normal" apply="Admin.UserAdd">
<tablelayout columns="2" width="100%">
<tablechildren width="70%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<caption label="Add Question" st
yle="font-weight:bold" />
<grid style="background-
color:WHITE; border:0px" >
<columns>
<column
width="20%"/>
<column
width="80%"/>
</columns>
<rows>
<row>
<label value="Us
er Name :"/><textbox width="50%" id="txtUname"/>
</row>
<row>
<label value="Pa
ssword :"/><textbox type="password" width="50%" id="txtPass"/>
</row>
<row>
<label value="Re
Type Password:"/><textbox type="password" width="50%" id="txtRepass"/>
</row>
<row>
<label value="Us
er Role :"/>
<combobox width=
"50%" id="cmbRole" readonly="true">
<comboitem label
="Student"/>
<comboit
em label="Teacher"/>
</combobox>
</row>
<row>
<label value="Fi
rst Name :"/><textbox width="50%" id="txtFname"/>
</row>
<row>
<label value="La
st Name :"/><textbox width="50%" id="txtLname"/>
</row>
<row>
<label value="Em
ail id :"/><textbox width="50%" id="txtEmail"/>
</row>

<row>
<label value=""/
>
<grid>
<columns>
<column width="1
7%"/>
<column width="1
7%"/>
<column width="1
6%"/>
</columns>
<rows>
<row>
<hbox>
<button label="A
dd User" id="btnAddUser"/>
<button label="C
lear" id="btnClear"/>
<button label="C
ancel" id="btnCancel" href="index.zul"/>
</hbox>
</row>
</rows>
</grid>
</row>
</rows>
</grid>
</groupbox>
<hbox>
<label id="lblMsg"/>
</hbox>
</panelchildren>
</panel>
</tablechildren>
<tablechildren>
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<image src="/img/fuser.png"/>
</groupbox>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>
</window>
</zk>

<?page title="Delete User" contentType="text/html;charset=UTF-8"?>


<zk>
<window title="Delete User" border="normal" apply="Admin.DelUser">
<tablelayout columns="2" width="100%">
<tablechildren width="50%" >
<panel style="border:0px">
<panelchildren >
<box align="center">
<groupbox mold="3d" closable="false">
<caption label="Delete User" sty
le="font-weight:bold" />
<grid style="background-
color:RED; border:0px">
<columns>
<column
width="20%"/>
<column
width="80%"/>
</columns>
<rows>
<row>
<label value="De
lete Role:"/>
<combobox id="cm
bRole" readonly="true">
<comboitem label
="Student"/>
<comboitem label
="Teacher"/>
</combobox>
</row>
</rows>
</grid>
</groupbox>
</box>
</panelchildren>
</panel>
</tablechildren>

<tablechildren width="50%">
<panel >
<panelchildren>
<grid>
<columns>
<column />
</columns>
<rows>
<row align="left
">
<image s
rc="/img/deluser.jpeg" width="200px" height="200px"/>
</row>
</rows>
</grid>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>
<tablelayout columns="1" width="100%">
<tablechildren >
<panel >
<panelchildren>
<grid>
<columns></columns>
<rows>
<row spans="2" align="left" style="background-color: WHITE; bord
er:0px">
<hbox>
<button id="btnDelete" label="Delete" mold="os" width="60px" />
<button id="btnCancel" href="index.zul" label="Cancel" mold="os" width="60px"/>
</hbox>
</row>
</rows>
</grid>
</panelchildren>
</panel>
</tablechildren>
<tablechildren >
<panel >
<panelchildren>
<listbox id="listUser" fixedLayout="true
" mold="paging" pagingPosition="top" pageSize="25" >
<listhead>
<listheader label="Sr No" align=
"center" width="10%" />
<listheader label="User
Name" align="left" width="20%"/>
<listheader label="First
Name" align="left" width="20%"/>
<listheader label="Last
Name" align="left" width="20%"/>
<listheader label="Email
Id" align="left" width="20%"/>
</listhead>
</listbox>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>
</window>
</zk>
<?page id="edumain_page" title="Wel-come VTS Software System" contentType="text/
html;charset=UTF-8"?>
<window id="edumain_win" width="100%" height="100%" apply="Admin.Admin_Main" >
<borderlayout style="background-color:WHITE" >
<north id="northLayout">
<vbox width="100%">
<grid style="border:0px;background-color:WHITE">
<rows>
<row align="right" style="border:0px">
<div width="100%">
<div width="50%" style="
float:left;" align="left">
<hbox>
<image src="/img
/image_online_exam.gif" />
<label value="On
line Examination" style="color : RED; font-size :60px"/>
</hbox>
</div>
<div width="20%" style="
float:right; position:relative; padding-right:5px">
<hbox align="end
" height="12px">
<label v
alue="Welcome Administrator" style="font-size : 10px" ></label>
<label i
d="logName" value="to VTS Software System" style="color : DARKGREEN; font-size :
10px"></label>
<label i
d="lblBarSett" value="|" width="3px" visible="false" style="font-size : 10px"/>
<label i
d="lblSetting" value=" Setting" popup="msgPop" style="color : RED; font-size :1
0px ;text-decoration : underline;cursor:hand;cursor:pointer" visible="false"/>
<label i
d="lblBar" value="|" width="3px" visible="false" style="font-size : 10px"/>
<label i
d="Sign out" value=" Logout" style="color : RED; font-size :10px ;text-decoratio
n : underline;cursor:hand;cursor:pointer" visible="false"/>
</hbox>
</div>
</div>
</row>
</rows>
</grid>
</vbox>
</north>
<west id="west" width="20%">
<groupbox>
<caption label=""></caption>
<image id="logo" src="/img/Online_exam.png"></image>
<box width="100%">

<vbox>
<label id="lblHome" value="Home" style="color : BLUE; f
ont-size :20px ;text-decoration : underline;cursor:hand;cursor:pointer"/>
<label id="lblAddQue" value="Set Paper" style="color : BLUE;
font-size :20px ;text-decoration : underline;cursor:hand;cursor:pointer"/>
<label id="lblAddUser" value="Add User" style="color : BLUE;
font-size :20px ;text-decoration : underline;cursor:hand;cursor:pointer"/>
<label id="lblDelUser" value="Delete User" style="color
: BLUE; font-size :20px ;text-decoration : underline;cursor:hand;cursor:pointer
"/>
<label id="lblReport" value="Final Report" style="color : BL
UE; font-size :20px ;text-decoration : underline;cursor:hand;cursor:pointer"/>
</vbox>
</box>
</groupbox>
</west>

<south id="south" border="none" margins="1,0,0,0" height="20px"


splittable="false" flex="true">
<div id="divSouth">
<grid id="statusBarGrid" fixedLayout="true" heig
ht="20px" width="100%">
<columns sizable="false">
<column label="User:" width="10%
" style="background-color: #D6DCDE;" />
<column id="statusBarColUser" la
bel="" width="10%" style="background-color: #D6DCDE;" />
<column label="Office-No.:" widt
h="10%" style="background-color: #D6DCDE;" />
<column id="statusBarSelectedObj
ect" width="30%" style="color: blue; background-color: #D6DCDE;" />
<column id="statusBarAppVersion"
style="color: #FF0000; background-color: #D6DCDE;" width="20%" />
<column id="statusBarTableSchema
" width="20%" style="color: blue; background-color: #D6DCDE;" align="left" />
</columns>
</grid>
</div>
</south>
<center id="centerLayout" style="border:0px" autoscroll="true">
<div width="100%">
<include id="acceptFile" src=""/>
<!-- <iframe id="iframeReport" visible="false" w
idth="100%" height="700px"/> -->
</div>
</center>
</borderlayout>
</window>
</zk>
<?page title="Instructions" contentType="text/html;charset=UTF-8"?>
<zk>
<include id="acceptFile" src=""/>
<window id="wndInstru" title="Instructions" border="normal" width="50%" apply="
Student.Stud_Main" >
<vbox>
<label value="Please read the following instructions carefully..." style="font-w
eight:bold,font-size :30px"/>
<label value="1.There is no negative marking" style="font-weight:bold,font-size
:20px"/>
<label value="2.Students must not stop the session and then return to it." style
="font-weight:bold,font-size :20px"/>
<label value="3.For technical problem call administrator ." style="font-weight:b
old,font-size :20px"/>
<label value="4.Do not signout while all the questions are attempted." style="fo
nt-weight:bold,font-size :20px"/>
<label value="5.Every time you have to click Answer Button to Answer your questi
on." style="font-weight:bold,font-size :20px"/>
<label value="6. The student may not use their textbook, course notes, or receiv
e help from any source." style="font-weight:bold,font-size :20px"/>
<label value="7. Please Log out after finishing your Exam." style="font-weight:b
old,font-size :20px"/>
<hbox align="right">
<button label="Proceed...." id="btnProceed" />
</hbox>
</vbox>
</window>
</zk>

<?page id="login_page" title="Login to VTS Software System" contentType="text/ht


ml;charset=UTF-8"?>
<zk>
<include id="acceptFile" src=""/>
<window id="wndSignIn" width="100%" height="100%" apply="Student.Stud_Main">

<vbox >
<space height="40%"/>
<hbox>
<space></space>
<grid style="border:1px solid BLACK" wid
th="100%">
<columns>
<column width="20px"/>
<column width="80px"/>
<column />
<column width="20px"/>
</columns>
<rows>
<row spans="4" style="ba
ckground:#DEF6FF;border:0px">
<space></space>
</row>
<row style="background:#
D9F4FF;border:0px">
<space></space>
<label id="lblUs
ername" value="Username" />
<textbox id="txt
Username" tooltiptext="Enter Valid User Name" focus="true" width="98%"/>
<space></space>
</row>
<row spans="4" style="ba
ckground:#D4F2FF;border:0px">
<space></space>
</row>
<row style="background:#
CCF0FF;border:0px">
<space></space>
<label id="lblPa
ssword" value="Password" />
<textbox id="txt
Password" type="password" tooltiptext="Enter Valid Password" width="98%"/>
<space></space>
</row>
<row spans="2, 2" style=
"background:#C2EDFF;border:0px" >
<space></space>
<label id="lblAu
thorizedUser" style="color:RED" />
</row>
<row spans="4" style="ba
ckground:#BDECFF;border:0px" align="center">
<button id="btnS
ignIn" label="Sign In" width="70px" height="25px" />
</row>
<row spans="4" style="ba
ckground:#C2EDFF;border:0px">
<space></space>
</row>
</rows>
</grid>
<space></space>
</hbox>
</vbox>
</window>
</zk>

<?page title="Adding Questions" contentType="text/html;charset=UTF-8"?>


<zk>
<window title="Questions" border="normal" apply="Admin.Admin_Main">
<tablelayout columns="2" width="100%">
<tablechildren width="70%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<caption label="Language and Lev
el" style="font-weight:bold" />
<grid style="background-
color:WHITE; border:0px" >
<columns>
<column
width="10%"/>
<column
width="10%"/>
<column
width="30%"/>
<column
width="20%"/>

</columns>
<rows>
<row>
<label id="lblCh
sCourse" value="Choose Course :"/><label id="lblCourse" visible="false"/>
<combobo
x id="cmbCourse" width="50%" readonly="true">
<comboit
em label="MCA"/>
<comboit
em label="BCA"/>
<comboit
em label="MCS"/>
<comboit
em label="BCS"/>
</combob
ox>
<label i
d="lblNofQuest" value="No. Of Question :"/> <label id="lblNQuest" visible="false
"/>
<textbox
id="txtNofQuest" width="50%"/>

</row>

<row>
<label id="lblCh
sSub" value="Choose Subject :"/><label id="lblSub" visible="false"/>
<combobo
x id="cmbSub" width="50%" readonly="true">
<comboit
em label="C"/>
<comboit
em label="CPP"/>
<comboit
em label=".Net"/>
<comboit
em label="Java"/>
<comboit
em label="General"/>
</combob
ox>
<label i
d="lblMarks" value="Marks for each Question :"/> <label id="lblVal" visible="fa
lse"/>
<textbox
id="txtMarks" width="50%"/>

</row>

<row>
<label id="lblEx
amType" value="Exam Type :"/><label id="lblExType" visible="false"/>
<textbox
id="txtExamType"/>

<label id="lb
lPasingMrk" value="Marks for Passing :"/> <label id="lblPassMarks" visible="fals
e"/>
<textbox
id="txtPassingMrk" width="50%"/>
<label id="lb
lTotalMarks" value="Total Marks:" visible="false"/>
<label id="l
blMarksVal" visible="false"/>

</row>
<row>
<label id="lb
lTimeLim" value="Time Limit(in Min.) :"/> <label id="lblTimVal" visible="false"/
>
<textbox
id="txtTimVal" width="50%"/>
<label value
=""/>
<button
label="Proceed...." id="proceed" />
</row>
</rows>
</grid>
</groupbox>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>
<include id="acceptFile" src=""/>

</window>
</zk>

<?page title="Student Report" contentType="text/html;charset=UTF-8"?>


<zk>
<window title="Student Report" border="normal" apply="Admin.StudReport">
<tablelayout columns="3" width="100%">
<tablechildren width="70%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<caption label="Select Criteria"
style="font-weight:bold" />
<grid style="background-
color:WHITE; border:0px" >
<columns>
<column
width="33%"/>
<column
width="33%"/>
<column
width="34%"/>
</columns>
<rows>
<row>
<label id="lblCr
iteria" value="Choose Criteria :"/>
<label value="Co
ndition" id="lblCondition" />
<label value="Ch
oose Value" id="lblVal" />
</row>
<row>
<combobo
x id="cmbCriteria" width="70%">
<comboit
em label="Subject"/>
<comboit
em label="Level"/>
<comboit
em label="Score"/>
<comboit
em label="Exam Date"/>
</combob
ox>
<combobo
x id="cmbCondition" visible="false" width="70%" />
<hbox>
<combobo
x id="cmbValue" width="50%" visible="false"/>
<textbox
id="txtScore" width="50%" visible="false"/>
<datebox
id="dtExam" width="50%" visible="false"/>
</hbox>
</row>
<row ali
gn="right">
<label v
alue=""/>
<button
label="Display Results" id="btnDisplay" visible="false" />
</row>
</rows>
</grid>
</groupbox>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>
<tablelayout>
<tablechildren >
<panel >
<panelchildren>
<groupbox>
<button label="P
rint"/>
<button label="
Cancel" id="btnCancel" href="index.zul"/>
</groupbox>
<listbox id="listResult" fixedLayout="tr
ue" mold="paging" pagingPosition="top" pageSize="25" >
<listhead>
<listheader label="Sr No" alig
n="center" width="10%" />
<listheader label="Name"
align="left" width="30%"/>
<listheader label="Subje
ct" align="left" width="10%"/>
<listheader label="Level" align=
"left" width="10%"/>
<listheader label="Scor
e" align="left" width="10%"/>
<listheader label="Resul
t" align="left" width="10%"/>
<listheader label="Exam
Date" align="left" width="10%"/>
</listhead>
</listbox>
</panelchildren>
</panel>
</tablechildren>
</tablelayout>

</window>
</zk>
<?page title=" Student's Registration" contentType="text/html;charset=UTF-8"?>
<zk>
<include id="acceptFile" src=""/>
<window title=" Student's Registration" width="70%" id="wndStud" border="normal"
apply="Student.StudInfo">
<tablelayout columns="2" width="100%">
<tablechildren width="70%">
<panel style="border:0px">
<panelchildren>
<groupbox mold="3d" closable="false" >
<caption label="Fill up informat
ion" style="font-weight:bold" />
<grid style="background-
color:WHITE; border:0px" >
<columns>
<column
width="20%"/>
<column
width="80%"/>
</columns>
<rows>
<row>
<label value="St
udents Full Name :"/><textbox width="50%" id="txtFname"/>
</row>
<row>
<label value="Ro
ll No :"/><textbox width="50%" id="txtRno"/>
</row>
<row>
<label value="Ex
am Date"/><datebox id="examDate" width="50%" constraint="no empty, no past: now
"/>
</row>
<row>
<label value="Co
urse"/>
<combobox id="cm
bCourse" width="50%" readonly="true">
<comboitem labe
l="MCA"/>
<comboitem labe
l="BCA"/>
<comboitem labe
l="MCS"/>
<comboitem labe
l="BCS"/>
</combobox>
</row>
<row>
<label value="Ex
am Type :" style="font-weight:bold,font-size :30px"/>
<textbox id="txt
ExamType" width="50%"/>
</row>
<row>
<label value="Su
bject :" style="font-weight:bold,font-size :30px" />
<combobox id="cm
bSub" width="50%" readonly="true">
<comboitem labe
l="C"/>
<comboitem labe
l="CPP"/>
<comboitem labe
l=".Net"/>
<comboitem labe
l="Java"/>
<comboitem label
="General"/>
</combobox>
</row>
<row>
<label value=""/
>
<button label="S
tart..." id="btnStart"/>
</row>

</rows>
</grid>
</groupbox>
<hbox>
<label id="lblMsg"/>
</hbox>
</panelchildren>
</panel>
</tablechildren>

</tablelayout>
</window>
</zk>

<?page title="Online Examination" contentType="text/html;charset=UTF-8"?>


<zk>
<window title="Online Examination" border="normal" width="100%" height="100%" a
pply="Student.Stud_Main">
<borderlayout style="background-color:WHITE" >
<north id="northLayout">
<vbox width="100%" height="50%">
<grid style="border:0px;background-color:WHITE">
<rows>
<row align="right" style="border:0px">
<div width="100%">
<div width="50%" style="
float:left;" align="left">
<hbox>
<image src="/img
/image_online_exam.gif" />
<label value="On
line Examination" style="color : RED; font-size :60px"/>
</hbox>
</div>
<div width="20%" style="
float:right; position:relative; padding-right:5px">
<hbox align="end
" height="12px">
<label v
alue="Welcome " style="font-size : 20px" />
<label v
alue="Student" id="lblSname" style="font-size : 20px"/>
<label i
d="logName" value="to VTS Software System" style="color : DARKGREEN; font-size :
10px"></label>
<label i
d="lblBarSett" value="|" width="3px" visible="false" style="font-size : 10px"/>
<label i
d="lblSetting" value=" Setting" popup="msgPop" style="color : RED; font-size :1
0px ;text-decoration : underline;cursor:hand;cursor:pointer" visible="false"/>
<label i
d="lblBar" value="|" width="3px" visible="false" style="font-size : 10px"/>
<label i
d="Signout" value=" Logout" style="color : RED; font-size :10px ;text-decoration
: underline;cursor:hand;cursor:pointer" visible="false"/>
</hbox>
</div>
</div>
</row>
</rows>
</grid>
</vbox>
</north>
<west id="west" width="20%">
<groupbox>
<caption label=""></caption>
<image id="logo" src="/img/Online_exam.png"></image>
<box width="100%">

<vbox>
<label value="Sign in..." id="lblSignin" style="color
: BLUE; font-size :40px ;text-decoration : underline;cursor:hand;cursor:pointer
" />
<label value="" />
<label value="" />
<label value="" />
<label value="" />
</vbox>
</box>
</groupbox>
</west>

<south id="south" border="none" margins="1,0,0,0" height="20px"


splittable="false" flex="true">
<div id="divSouth">
<grid id="statusBarGrid" fixedLayout="true" heig
ht="20px" width="100%">
<columns sizable="false">
<column label="User:" width="10%
" style="background-color: #D6DCDE;" />
<column id="statusBarColUser" la
bel="" width="10%" style="background-color: #D6DCDE;" />
<column label="Office-No.:" widt
h="10%" style="background-color: #D6DCDE;" />
<column id="statusBarSelectedObj
ect" width="30%" style="color: blue; background-color: #D6DCDE;" />
<column id="statusBarAppVersion"
style="color: #FF0000; background-color: #D6DCDE;" width="20%" />
<column id="statusBarTableSchema
" width="20%" style="color: blue; background-color: #D6DCDE;" align="left" />
</columns>
</grid>
</div>
</south>
<center id="centerLayout" autoscroll="true">
<div width="100%">
<box width="100%" height="100%">
<include id="acceptFile" src=""/>
<!-- <iframe id="iframeReport" visible="false"
width="100%" height="700px"/> -->
</box>
</div>
</center>
</borderlayout>
</window>
</zk>

<?page title="Student's Result" contentType="text/html;charset=UTF-8"?>


<zk>
<window title="Student's Result" width="50%" border="normal" apply="Student.Resu
lt">
<vbox>
<label id="lblWish" style="color: black; font-size : 30px"/>
<label id="lblStudname" style="color: black; font-size : 20px"/>
<label id="lblRno" style="color: black; font-size : 20px"/>
<label id="lblTotalQue" style="color: black; font-size : 20px"/>
<label id="lblAttempt" style="color: black; font-size : 20px"/>
<label id="lblMarks" style="color: black; font-size : 20px"/>
<label id="lblResult" style="color: black; font-size : 20px"/>

<label value="Please Sign out before closing browser" style="color: RED;font-siz


e :10px"/>
</vbox>
</window>
</zk>

<?page title="T
est" contentType="text/html;charset=UTF-8"?>
<zk>
<include id="acceptFile" src=""/>
<window id="wndTest" width="50%" border="0px" apply="Student.Ans" >
<hbox align="right" >
<label id="now" style="color: blue; font-size : 40px"/>
<timer id="timer" delay="60000" repeats="true" />
</hbox>

<label id="lblQuest" style="color: black; font-size : 20px"/><label value="?" st


yle="color: black; font-size : 20px"/>
<radiogroup id="rdbOption">
<vbox>
<radio id="rdbOpt1" style="color: black; font-size : 20px"/>
<radio id="rdbOpt2" style="color: black; font-size : 20px"/>
<radio id="rdbOpt3" style="color: black; font-size : 20px"/>
<radio id="rdbOpt4" style="color: black; font-size : 20px"/>
</vbox>
</radiogroup>
<hbox>
<button label="Answer" id="btnAns" style="color: black; font-size : 15px"/>
<button label="Next" id="btnNext" style="color: black; font-size : 15px"/>
<button label="Finish" id="btnFinish" visible="false" style="color: black; font-
size : 15px"/>
</hbox>
</window>
</zk>
/*******************************************************************************
********************************************/

package Admin;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Include;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Button;
import org.zkoss.zul.Label;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Checkbox;
import java.sql.PreparedStatement;
import org.zkoss.zul.Messagebox;
import java.sql.Connection;
import java.sql.ResultSet;
import java.lang.String;
import org.zkoss.zk.ui.event.Event;

public class Admin_Main extends GenericForwardComposer


{
private static final long serialVersionUID = 1L;
private Include acceptFile ;
private Combobox cmbSub,cmbCourse,cmbAns;
private Button proceed,btnProceed,btnUpdate,btnDelete;
private Label lblSub,lblChsSub,lblAddUser,lblDelUser,lblReport,lblHome,l
blAddQue,lblTimVal;
private Label lblTotalMarks,lblMarksVal,lblNQuest,lblVal,lblCourse,lblEx
Type,lblPassingMrk,lblPassMarks;
private Textbox txtOp1,txtOp2,txtOp3,txtOp4,txtQue,txtNofQuest,txtMarks,
txtTimVal,txtExamType,txtPassingMrk;
private Listbox listQuest;
private Checkbox chkIsactive;
PreparedStatement ps;
Connection conn=null;
private Admin.DbConn db=new Admin.DbConn();
private Admin.AdminBean ad=new Admin.AdminBean();
private Admin.TestInfoBean t1 = new Admin.TestInfoBean();
public int cnt=0,qno=0;
static int v;

public static String sub,level,test_sub_id,course,type,exam_type="",cour


se_id="";
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
conn = db.getConn();
// loadListQuest();
}
/***********************************************************************
***********************/
public void onClick$lblHome()
{
lblHome.setStyle("color : GREEN; font-size :20px ;text-decoratio
n : underline;cursor:hand;cursor:pointer");
lblAddQue.setStyle("color : BLUE; font-size :20px ;text-decoration : und
erline;cursor:hand;cursor:pointer");
lblAddUser.setStyle("color : BLUE; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblDelUser.setStyle("color : BLUE; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblReport.setStyle("color : BLUE; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");
acceptFile.setVisible(true);
acceptFile.setSrc("");
}
/***********************************************************************
***********************/
public void onClick$lblAddQue()
{
lblAddQue.setStyle("color : GREEN; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblHome.setStyle("color : BLUE; font-size :20px ;text-decoration
: underline;cursor:hand;cursor:pointer");
lblAddUser.setStyle("color : BLUE; fprivate int sr_no,ont-size :
20px ;text-decoration : underline;cursor:hand;cursor:pointer");
lblDelUser.setStyle("color : BLUE; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblReport.setStyle("color : BLUE; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");

acceptFile.setVisible(true);
acceptFile.setSrc("QuestLang.zul");

}
/***********************************************************************
***********************/
public void onClick$lblAddUser()
{
lblAddUser.setStyle("color : GREEN; font-size :20px ;text-decora
tion : underline;cursor:hand;cursor:pointer");

lblAddQue.setStyle("color : Blue; font-size :20px ;text-decoration : und


erline;cursor:hand;cursor:pointer");
lblHome.setStyle("color : BLUE; font-size :20px ;text-decoration
: underline;cursor:hand;cursor:pointer");
lblDelUser.setStyle("color : BLUE; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblReport.setStyle("color : BLUE; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");
acceptFile.setVisible(true);
acceptFile.setSrc("AddUser.zul");
}
/***********************************************************************
***********************/
public void onClick$lblDelUser()
{
lblDelUser.setStyle("color : GREEN; font-size :20px ;text-decora
tion : underline;cursor:hand;cursor:pointer");
lblAddUser.setStyle("color : BLUE; font-size :20px ;text-decoration : u
nderline;cursor:hand;cursor:pointer");
lblAddQue.setStyle("color : Blue; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");
lblHome.setStyle("color : BLUE; font-size :20px ;text-decoration
: underline;cursor:hand;cursor:pointer");
lblReport.setStyle("color : BLUE; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");
acceptFile.setVisible(true);
acceptFile.setSrc("DeleteUser.zul");

}
/***********************************************************************
***********************/
public void onClick$lblReport()
{
lblReport.setStyle("color : GREEN; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblDelUser.setStyle("color : BLUE; font-size :20px ;text-decorat
ion : underline;cursor:hand;cursor:pointer");
lblAddUser.setStyle("color : BLUE; font-size :20px ;text-decoration : un
derline;cursor:hand;cursor:pointer");
lblAddQue.setStyle("color : Blue; font-size :20px ;text-decorati
on : underline;cursor:hand;cursor:pointer");
lblHome.setStyle("color : BLUE; font-size :20px ;text-decoration
: underline;cursor:hand;cursor:pointer");
acceptFile.setVisible(true);
acceptFile.setSrc("Report.zul");

}
//Setting Sessions Variables
//Exam type
public void setExamtype()throws Exception
{
Sessions.getCurrent().setAttribute("examtype",t1.getExamType());
System.out.println("exam type of Admin_main is set ");
}
//Sub
public void setSub() throws Exception
{
course_id=Sessions.getCurrent().getAttribute("course_id").toStri
ng();
System.out.println( "in set sub...."+exam_type+"...."+course_id
);

//exam_type=Sessions.getCurrent().getAttribute("examtype").toStr
ing();
System.out.println( "in set sub...."+exam_type+"...."+course_id
);
String subject=Sessions.getCurrent().getAttribute("Sub").toStrin
g();
System.out.println(subject+"in set sub...."+exam_type+"...."+cou
rse_id);
conn=db.getConn();
Messagebox.show("Connected");
String q= "select test_sub_id from test_sub where course_id='"+cou
rse_id+"' and exam_type='"+exam_type+"' and sub_name='"+subject+"'";
System.out.println("Admin_main..."+q);
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
test_sub_id=rs.getString("test_sub_id");
}
Sessions.getCurrent().setAttribute("test_sub_id",test_sub_id);
System.out.println("Test_sub_Id of Admin_main is set ");
}
//To get course_id
public void setCourse() throws Exception
{
//***********************************GetCourse_id from Course Ta
ble************************
conn=db.getConn();
// Messagebox.show("Connected");
String Q="select course_id from course1 where course_nam
e = '"+cmbCourse.getText()+"'";
ps=conn.prepareStatement(Q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
course=rs.getString("course_id");
}
rs.close();
ps.close();
conn.close();
Sessions.getCurrent().setAttribute("course_id",course);
System.out.println("course_Id of Admin_main is set ");
}

/***********************************************************************
***********************/
public void onClick$proceed() throws Exception
{
String coursename="",type1="",sub1="",course_id1="";
setCourse();
setExamtype();

//*******************set attributes****************************
******
type=txtExamType.getText();
t1.setExamType(type);
t1.setCourse(course);
t1.setMarks(txtMarks.getText());
t1.setSub(cmbSub.getText());
t1.setNoofquest(txtNofQuest.getText());
t1.setTime(txtTimVal.getText());
t1.setPassingMrk(Integer.parseInt(txtPassingMrk.getText()));
Sessions.getCurrent().setAttribute("Sub",t1.getSub());

//To avoid repetition in test_sub


conn=db.getConn();
String q= "select * from test_sub";
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
course_id1=rs.getString("course_id");
type1=rs.getString("exam_type");
sub1=rs.getString("sub_name");
}
q="select course_name from course1 where course_id='"+co
urse_id1+"'";
ps=conn.prepareStatement(q);
rs=ps.executeQuery();
if(rs.next())
{
coursename=rs.getString("course_name");
}
if(coursename.equals(cmbCourse.getText()) && sub
1.equals(cmbSub.getText()) && type1.equals(txtExamType.getText()))
{
System.out.println("....course="+coursename+"...
sub="+sub1+"..... type ="+type1);
}
else
{
String Query="insert into test_sub(test_sub_id, sub_name, no_of_ques
t, marks_each, time_lim, course_id,exam_type,passmrk) values(get_uuid(),?,?,?,?,
?,?,?)";
ps=conn.prepareStatement(Query);
ps.setString(1,t1.getSub());
ps.setString(2,t1.getNoofquest());
ps.setString(3,t1.getMarks());
ps.setString(4,t1.getTime());
ps.setString(5,t1.getCourse());
ps.setString(6,t1.getExamType());
ps.setInt(7,t1.getPassingMrk());
ps.executeUpdate();
ps.close();
conn.close();
}
sub=cmbSub.getText();
exam_type=txtExamType.getText();
cmbSub.setVisible(false);

proceed.setVisible(false);
lblChsSub.setValue("Subject");
lblSub.setVisible(true);
lblSub.setValue(cmbSub.getValue());
lblExType.setVisible(true);
lblExType.setValue(txtExamType.getText());
lblTotalMarks.setVisible(true);
lblMarksVal.setVisible(true);
lblNQuest.setVisible(true);
lblNQuest.setValue(txtNofQuest.getText());
lblVal.setVisible(true);
lblVal.setValue(txtMarks.getText());
txtMarks.setVisible(false);
txtNofQuest.setVisible(false);
txtExamType.setVisible(false);
txtPassingMrk.setVisible(false);
lblPassMarks.setValue(String.valueOf(t1.getPassingMrk()));
lblPassMarks.setVisible(true);
v=Integer.parseInt(txtNofQuest.getText());
int mrks=Integer.parseInt(txtMarks.getText())*Integer.parseInt(txtNofQ
uest.getText());
lblMarksVal.setValue(Integer.toString(mrks));
txtTimVal.setVisible(false);
lblTimVal.setVisible(true);
lblTimVal.setValue(txtTimVal.getText()+"Min");
lblCourse.setVisible(true);
lblCourse.setValue(cmbCourse.getValue());
cmbCourse.setVisible(false);
setSub();
acceptFile.setVisible(true);
acceptFile.setSrc("AddQuest.zul");

}
/***********************************************************************
***********************/

public void onClick$btnDisplay()throws Exception


{
loadListQuest();
System.out.println("Load Question.............");
}
public void onClick$btnAdd() throws Exception
{
test_sub_id=Sessions.getCurrent().getAttribute("test_sub_id").to
String();
cnt++;
String ans;
if(cmbAns.getText().equals("Option 1"))
ans=txtOp1.getText();
else if(cmbAns.getText().equals("Option 2"))
ans=txtOp2.getText();
else if(cmbAns.getText().equals("Option 3"))
ans=txtOp3.getText();
else
ans=txtOp4.getText();

if(txtQue.getText()==""||txtOp1.getText()==""||txtOp2.getText()=
=""||txtOp3.getText()==""||txtOp4.getText()=="")
{
Messagebox.show("All fields are mandetory!");
}
else
{
ad.setQuestion(txtQue.getText());
ad.setOption1(txtOp1.getText());
ad.setOption2(txtOp2.getText());
ad.setOption3(txtOp3.getText());
ad.setOption4(txtOp4.getText());
ad.setAns(ans);
ad.setActive(chkIsactive.isChecked()==true?"Y":"N");
if(cnt>v)
{
if(Messagebox.show("Number of Questions are finished","Sorry!!",
Messagebox.OK,null)==Messagebox.OK)
{
acceptFile.setVisible(true);
acceptFile.setSrc("index.zul");
}
}
else
{
//test_sub_id=Sessions.getCurrent().getAttribute("course
_id").toString();
conn=db.getConn();
String Query="insert into question(quest_id,opt1,opt2,op
t3,opt4,ans,quest,isactive,test_sub_id,quest_no,exam_type) values(get_uuid(),?,?
,?,?,?,?,?,?,?,?)";
ps=conn.prepareStatement(Query);
ps.setString(1,ad.getOption1());
ps.setString(2,ad.getOption2());
ps.setString(3,ad.getOption3());
ps.setString(4,ad.getOption4());
ps.setString(5,ad.getAns());
ps.setString(6,ad.getQuestion());
ps.setString(7,ad.getActive());
ps.setString(8,test_sub_id);
ps.setInt(9,cnt);
ps.setString(10,type);
System.out.println(Query);
ps.executeUpdate();
ps.close();
conn.close();
Messagebox.show("Question inserted succesfully");
txtQue.setText("");
txtOp1.setText("");
txtOp2.setText("");
txtOp3.setText("");
txtOp4.setText("");
cmbAns.setText("");
}//else
loadListQuest();
}//outer else

}
public void loadListQuest() throws Exception
{
test_sub_id=Sessions.getCurrent().getAttribute("test_sub_id").to
String();
System.out.println("Load Question.............");
int i=1;
txtQue.setText("");
txtOp1.setText("");
txtOp2.setText("");
txtOp3.setText("");
txtOp4.setText("");
cmbAns.setText("");
listQuest.getItems().clear();

conn=db.getConn();
String q="select * from question where test_sub_id='"+test_sub_i
d+"'";
System.out.println(q);
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
final Listitem lt=new Listitem();

lt.setId(rs.getString("quest_id"));
lt.addEventListener("onClick",new org.zkoss.zk.ui.even
t.EventListener()
{
public void onEvent(Event e) throws Exception
{
onClickListrow(lt);
}
});

Listcell lc1=new Listcell(""+i);


Listcell lc2=new Listcell(rs.getString("quest"));
Listcell lc3=new Listcell(rs.getString("opt1"));
Listcell lc4=new Listcell(rs.getString("opt2"));
Listcell lc5=new Listcell(rs.getString("opt3"));
Listcell lc6=new Listcell(rs.getString("opt4"));
lt.appendChild(lc1);
lt.appendChild(lc2);
lt.appendChild(lc3);
lt.appendChild(lc4);
lt.appendChild(lc5);
lt.appendChild(lc6);
listQuest.appendChild(lt);
i++;

}//while

ps.close();
conn.close();
System.out.println("Load Question.............");
}
/****************************n*************************************Butto
n*****************************/
public String id;
public void onClickListrow(Listitem lt) throws Exception
{
id= lt.getId().toString();

conn=db.getConn();
btnUpdate.setVisible(true);
btnDelete.setVisible(true);
String Q="select quest,opt1,opt2,opt3,opt4,ans,quest_id from que
stion where quest_id= "+"'"+id+"'";
ps=conn.prepareStatement(Q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
ad.setQuestion(rs.getString("quest"));
ad.setOption1(rs.getString("opt1"));
ad.setOption2(rs.getString("opt2"));
ad.setOption3(rs.getString("opt3"));
ad.setOption4(rs.getString("opt4"));
ad.setAns(rs.getString("ans"));
txtQue.setText(ad.getQuestion());
txtOp1.setText(ad.getOption1());
txtOp2.setText(ad.getOption2());
txtOp3.setText(ad.getOption3());
txtOp4.setText(ad.getOption4());
cmbAns.setText(ad.getAns());

}
ps.close();
rs.close();
conn.close();
}
/***********************************************************************
***********************/
public void onClick$btnUpdate()throws Exception
{
if(txtQue.getText()==""||txtOp1.getText()==""||txtOp2.getText()=
=""||txtOp3.getText()==""||txtOp4.getText()=="")
{
Messagebox.show("Click on Question which you want to update!");
}
else
{
conn=db.getConn();
String Q ="update question set quest=?, opt1=?, opt2=?, opt3=?,
opt4=? where quest_id="+"'"+id+"'";
ps=conn.prepareStatement(Q);
ps.setString(1,txtQue.getText());
ps.setString(2,txtOp1.getText());
ps.setString(3,txtOp2.getText());
ps.setString(4,txtOp3.getText());
ps.setString(5,txtOp4.getText());
ps.executeUpdate();
ps.close();
conn.close();
Messagebox.show("Updated Successfully!!!!");
loadListQuest();
}
}
/****************************Delete Question****************************
*************************/
public void onClick$btnDelete()throws Exception
{
if(txtQue.getText()==""||txtOp1.getText()==""||txtOp2.getText()=
=""||txtOp3.getText()==""||txtOp4.getText()=="")
{
Messagebox.show("Click on Question which you want to del
ete!!");
}
else
{
conn=db.getConn();
String Q ="delete from question where quest_id='"+id+"'";
ps=conn.prepareStatement(Q);
ps.executeUpdate();
ps.close();
Messagebox.show("Deleted Successfully!!!!");
cnt--;
loadListQuest();
}
}

package Admin;

public class AdminBean


{
String Quest,op1,op2,op3,op4,ans,isactive;
public void setActive(String isactive)
{
this.isactive=isactive;
}
public String getActive()
{
return isactive;
}
public void setAns(String ans)
{
this.ans=ans;
}
public String getAns()
{
return ans;
}
public void setQuestion(String Quest)
{
this.Quest=Quest;
}
public String getQuestion()
{
return Quest;
}
public void setOption1(String op1)
{
this.op1=op1;
}
public String getOption1()
{
return op1;
}
public void setOption2(String op2)
{
this.op2=op2;
}
public String getOption2()
{
return op2;
}
public void setOption3(String op3)
{
this.op3=op3;
}
public String getOption3()
{
return op3;
}
public void setOption4(String op4)
{
this.op4=op4;
}
public String getOption4()
{
return op4;
}

package Admin;
import java.sql.Connection;
import java.sql.DriverManager;
import org.zkoss.zk.ui.util.GenericForwardComposer;

public class DbConn extends GenericForwardComposer


{
private static final long serialVersionUID = 1L;
public Connection getConn()
{
Connection conn=null;
try
{
if(conn == null || conn.isClosed())
{
Class.forName("org.postgresql.Driver");
conn=DriverManager.getConnection("jdbc:postgresql://localhost:54
32/OnlineExam","vtserpadmin","v1rtue");
//databaseurl+"//"+addre
ss+":"+portconn+"/"+database, username, password);
//"jdbc:postgresql://loc
alhost:5432/vtsscheme","vtserpadmin","v1rtue"
}
}
catch(Exception ae)
{
System.out.println(ae);
}
return conn;
}
}

package Admin;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Messagebox;
import java.sql.PreparedStatement;
import org.zkoss.zul.Listbox;
import java.sql.Connection;
import java.sql.ResultSet;
import org.zkoss.zul.Listitem;
public class DelUser extends GenericForwardComposer
{
/**
*
*/
private static final long serialVersionUID = 1L;
private Combobox cmbRole;
private Admin.DbConn db=new DbConn();
private Connection conn=null;
private PreparedStatement ps;
private Listbox listUser;
int i=1;
public void onChange$cmbRole() throws Exception
{
listUser.getItems().clear();
String role=cmbRole.getText();
String role_id;
i=1;
if(role.equals("Student"))
role_id="1";
else
role_id="2";
conn=db.getConn();
String Query="select user_id,uname,fname,lname,email,role_id fro
m user1 where user1.role_id = "+"'"+role_id+"'";
ps=conn.prepareStatement(Query);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
final Listitem lt=new Listitem();
lt.setId(rs.getString("user_id"));

lt.addEventListener("onClick",new org.zkoss.zk.ui.event.
EventListener()
{
public void onEvent(Event e) throws Exception
{
onClickListrow(lt);
}
});
Listcell lc1=new Listcell(""+i);
Listcell lc2=new Listcell(rs.getString("uname"));
Listcell lc3=new Listcell(rs.getString("fname"));
Listcell lc4=new Listcell(rs.getString("lname"));
Listcell lc5=new Listcell(rs.getString("email"));
lt.appendChild(lc1);
lt.appendChild(lc2);
lt.appendChild(lc3);
lt.appendChild(lc4);
lt.appendChild(lc5);
i++;
listUser.appendChild(lt);

}//while

ps.close();
conn.close();
}
public void loadList() throws Exception
{
listUser.getItems().clear();
String role_id;
if(cmbRole.getText().equals("Student"))
role_id="1";
else
role_id="2";
String Query="select *from user1 where role_id="+"'"+role_id+"'"
;
conn=db.getConn();
ps=conn.prepareStatement(Query);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
final Listitem lt=new Listitem();
lt.setId(rs.getString("user_id"));

lt.addEventListener("onClick",new org.zkoss.zk.ui.event.
EventListener()
{
public void onEvent(Event e) throws Exception
{
onClickListrow(lt);
}
});
Listcell lc1=new Listcell(""+i);
Listcell lc2=new Listcell(rs.getString("uname"));
Listcell lc3=new Listcell(rs.getString("fname"));
Listcell lc4=new Listcell(rs.getString("lname"));
Listcell lc5=new Listcell(rs.getString("email"));
lt.appendChild(lc1);
lt.appendChild(lc2);
lt.appendChild(lc3);
lt.appendChild(lc4);
lt.appendChild(lc5);
i++;
listUser.appendChild(lt);

}//while

String id;
public void onClickListrow(Listitem lt) throws Exception
{
id =lt.getId().toString();
}
public void onClick$btnDelete() throws Exception
{
conn=db.getConn();
String Q="delete from user1 where user_id="+"'"+id+"'";
ps=conn.prepareStatement(Q);
ps.executeUpdate();
conn.close();
ps.close();
Messagebox.show("Deleted successfully");
loadList();
}

}
package Admin;

import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Include;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Button;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Datebox;
import Database.DbConn;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class StudReport extends GenericForwardComposer
{

/**
*
*/
private static final long serialVersionUID = 1L;
private Include acceptFile;
private Combobox cmbCriteria,cmbValue,cmbCondition;
//private Label lblCondition,lblVal;
private Textbox txtScore;
private Button btnDisplay;
private Datebox dtExam;
String criteria,cond,value,test_sub_id,level_id;
private Connection conn=null;
private Listbox listResult;
private Database.DbConn db=new DbConn();
private PreparedStatement ps;
public static int i=1;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
conn = db.getConn();
//loadSubjectList();
}
// public void getLevelSub() throws Exception
// {
//
// if(level.equals("Level 1"))
// level_id="1";
// else if(level.equals("Level 2"))
// level_id="2";
// else
// level_id="3";
// //to get Sub id
// conn=db.getConn();
// Messagebox.show("Connected");
// String q= "select * from test_sub";
// ps=conn.prepareStatement(q);
// ResultSet rs=ps.executeQuery();
// while(rs.next())
// {
// id=rs.getString("test_sub_id");
// subnm=rs.getString("sub_name");
// if(subnm.equals(sub))
// {
// test_sub_id=id;
// break;
// }
//
// }
//
// }
public void onChange$cmbCriteria()
{
criteria= cmbCriteria.getValue();
if(criteria.equals("Subject"))
{

cmbValue.getItems().clear();
cmbValue.appendItem("C");
cmbValue.appendItem("CPP");
cmbValue.appendItem("Java");
cmbValue.appendItem(".NET");
cmbCondition.setValue("");
cmbCondition.appendItem("Equal to");
cmbCondition.setVisible(true);
cmbValue.setVisible(true);
cmbValue.setReadonly(true);
btnDisplay.setVisible(true);
txtScore.setVisible(false);
dtExam.setVisible(false);
}
else if(criteria.equals("Level"))
{
//cmbValue.setValue("");
cmbValue.getItems().clear();
cmbValue.appendItem("Level1");
cmbValue.appendItem("Level2");
cmbValue.appendItem("Level3");
cmbCondition.getItems().clear();
cmbCondition.appendItem("Equal to");
cmbCondition.setVisible(true);
cmbValue.setVisible(true);
cmbValue.setReadonly(true);
btnDisplay.setVisible(true);
txtScore.setVisible(false);
dtExam.setVisible(false);
}
else if(criteria.equals("Score"))
{
cmbCondition.getItems().clear();
cmbCondition.appendItem("Equal to");
cmbCondition.appendItem("Greater than");
cmbCondition.appendItem("Less Than");
cmbCondition.setVisible(true);
cmbValue.setVisible(false);
txtScore.setVisible(true);
dtExam.setVisible(false);
btnDisplay.setVisible(true);
}
else if(criteria.equals("Exam Date"))
{
cmbCondition.getItems().clear();
cmbCondition.appendItem("Equal to");
cmbCondition.setVisible(true);
cmbValue.setVisible(false);
dtExam.setVisible(true);
btnDisplay.setVisible(true);
txtScore.setVisible(false);
}
}
public void onClick$btnDisplay()throws Exception
{
loadList();
}

public void loadList() throws Exception


{
listResult.getItems().clear();
int i=1;
String query="",id="",level="";
conn=db.getConn();
criteria=cmbCriteria.getValue();
cond=cmbCondition.getValue();
value=cmbValue.getValue();
/*************************If criteria = Subject*********/
if(criteria.equals("Subject"))
{
String q= "select test_sub_id from test_sub where sub_name='"
+value+"'";
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
if(rs.next())
{
id=rs.getString("test_sub_id");
}
System.out.println(id+".............");
query="select * from examresult where test_sub_id='"+id+"'";
ps=conn.prepareStatement(query);
rs=ps.executeQuery();
while(rs.next())
{
final Listitem lt=new Listitem();
lt.setId(rs.getString("examresult_id")
);
level_id= rs.getString("level_id");
if(level_id.equals("1"))
level="Level 1";
else if(level_id.equals("2"))
level="Level 2";
else
level="Level 3";
Listcell lc1=new Listcell(""+i);
Listcell lc2=new Listcell(rs.getString("sname"))
;
Listcell lc3=new Listcell(value);
Listcell lc4=new Listcell(level);
Listcell lc5=new Listcell(String.valueOf(rs.getI
nt("totalmarks")));
Listcell lc6=new Listcell("Pass");
Listcell lc7=new Listcell(rs.getDate("examdate")
.toString());
lt.appendChild(lc1);
lt.appendChild(lc2);
lt.appendChild(lc3);
lt.appendChild(lc4);
lt.appendChild(lc5);
lt.appendChild(lc6);
lt.appendChild(lc7);

listResult.appendChild(lt);
i++;
}

}
}

package Admin;
public class TestInfoBean
{
String course,type,no_of_quest,marks_each,time,sub;
int passing_mrk;
public void setCourse(String course)
{
this.course=course;
}
public String getCourse()
{
return course;
}
public void setExamType(String type)
{
this.type=type;
}
public String getExamType()
{
return type;
}
public void setNoofquest(String no_of_quest)
{
this.no_of_quest=no_of_quest;
}
public String getNoofquest()
{
return no_of_quest;
}
public void setMarks(String marks_each)
{
this.marks_each=marks_each;
}
public String getMarks()
{
return marks_each;
}
public void setTime(String time)
{
this.time=time;
}
public String getTime()
{
return time;
}
public void setSub(String sub)
{
this.sub=sub;
}
public String getSub()
{
return sub;
}
public void setPassingMrk(int passing_mrk)
{
this.passing_mrk=passing_mrk;
}
public int getPassingMrk()
{
return passing_mrk;
}
}
package Admin;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Combobox;
import java.sql.PreparedStatement;
import java.sql.Connection;
import org.zkoss.zk.ui.util.GenericForwardComposer;
public class UserAdd extends GenericForwardComposer
{
/**
*
*/
private static final long serialVersionUID = 1L;
private Textbox txtFname,txtLname,txtUname,txtPass,txtRepass,txtEmail;
private Combobox cmbRole;
private Admin.UserBean u=new UserBean();
private Admin.DbConn db=new DbConn();
private Connection conn=null;
private PreparedStatement ps;
static int i;

public void onClick$btnAddUser() throws Exception


{
if(txtUname.getText()==""||txtFname.getText()==""||txtLname.getT
ext()==""||txtPass.getText()==""||txtRepass.getText()==""||txtEmail.getText()=="
")
{
Messagebox.show("All fields are mandetory!");
}
else
{
if(txtPass.getText().equals(txtRepass.getText()))
{
u.setUname(txtUname.getText());
u.setPass(txtPass.getText());
u.setFname(txtFname.getText());
u.setLname(txtLname.getText());
u.setRole(cmbRole.getText());
u.setEmail(txtEmail.getText());
if(cmbRole.getText().equals("Student"))
u.setUsertype("1");
else
u.setUsertype("2");

conn=db.getConn();
Messagebox.show("connected");
/* get_uuid problem*/

String Query="insert into user1(user_id,uname,fname,lname,email,


password,role_id) values(get_uuid(),?,?,?,?,?,?)";
ps=conn.prepareStatement(Query);

// ps.setInt(1,4);
ps.setString(1,u.getUname());
ps.setString(2,u.getFname());
ps.setString(3,u.getLname());
ps.setString(4,u.getEmail());
ps.setString(5,u.getPass());
ps.setString(6,u.getUsertype());
ps.executeUpdate();
Messagebox.show("User Created succesfully");
ps.close();
conn.close();
Messagebox.show("User Created succesfully");
}
else
{
Messagebox.show("Retype Password mismatc
h!!");
}
}
txtUname.setText("");
txtPass.setText("");
txtRepass.setText("");
txtFname.setText("");
txtLname.setText("");
cmbRole.setText("");
txtEmail.setText("");
}
public void onClick$btnClear() throws Exception
{
txtUname.setText("");
txtPass.setText("");
txtRepass.setText("");
txtFname.setText("");
txtLname.setText("");
cmbRole.setText("");
txtEmail.setText("");

}
}

package Admin;
public class UserBean
{
String uname,pass,role,fname,lname,emailid,usertype;
public void setUname(String uname)
{
this.uname=uname;
}
public String getUname()
{
return(uname);
}
public void setPass(String pass)
{
this.pass=pass;
}
public String getPass()
{
return(pass);
}
public void setFname(String fname)
{
this.fname=fname;
}
public String getFname()
{
return(fname);
}
public void setLname(String lname)
{
this.lname=lname;
}
public String getLname()
{
return(lname);
}
public void setRole(String role)
{
this.role=role;
}
public String getRole()
{
return(role);
}
public void setEmail(String emailid)
{
this.emailid=emailid;
}
public String getEmail()
{
return(emailid);
}
public void setUsertype(String usertype)
{
this.usertype=usertype;
}
public String getUsertype()
{
return(usertype);
}
}
package Database;
import java.sql.Connection;
import java.sql.DriverManager;
import org.zkoss.zk.ui.util.GenericForwardComposer;

public class DbConn extends GenericForwardComposer


{
private static final long serialVersionUID = 1L;
public Connection getConn()
{
Connection conn=null;
try
{
if(conn == null || conn.isClosed())
{
Class.forName("org.postgresql.Driver");
conn=DriverManager.getConnection("jdbc:postgresql://localhost:54
32/OnlineExam","vtserpadmin","v1rtue");
//databaseurl+"//"+addre
ss+":"+portconn+"/"+database, username, password);
//"jdbc:postgresql://loc
alhost:5432/vtsscheme","vtserpadmin","v1rtue"
}
}
catch(Exception ae)
{
System.out.println(ae);
}
return conn;
}
}
package Database;
import java.util.Date;
import Student.StudBean;
import org.zkoss.zk.ui.Sessions;
/**
* @author userver
*
*/
public class ErpSessions {

/**
* @param username the username to set
*/
public static void setUsername(String username) {
Sessions.getCurrent().setAttribute("username", username);
}
/**
* @return the username
*/
public static Object getUsername() {
return Sessions.getCurrent().getAttribute("username");
}
/**
* @param loggedinuserid the loggedinuserid to set
*/
public static void setLoggedinuserid(String loggedinuserid) {
Sessions.getCurrent().setAttribute("loggedinuserid", loggedinuse
rid);
}
/**
* @return the loggedinuserid
*/
public static Object getLoggedinuserid() {
return Sessions.getCurrent().getAttribute("loggedinuserid");
}
/**
* @param userid the userid to set
*/
public static void setUserid(String userid) {
Sessions.getCurrent().setAttribute("userid", userid);
}
/**
* @return the userid
*/
public static Object getUserid() {
return Sessions.getCurrent().getAttribute("userid");
}
/**
* @param roleid the roleid to set
*/
public static void setRoleid(String roleid)
{
Sessions.getCurrent().setAttribute("roleid", roleid);
}
/**
* @return the roleid
*/
public static Object getRoleid() {
return Sessions.getCurrent().getAttribute("roleid");
}
}

package Student;
import org.zkoss.zk.ui.util.GenericForwardComposer;
// import org.zkoss.zul.Button;
import org.zkoss.zul.Include;
import org.zkoss.zul.Label;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Radio;
import org.zkoss.zul.Window;
import org.zkoss.zul.Grid;
import java.sql.PreparedStatement;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Radiogroup;
import org.zkoss.zul.Timer;
import org.zkoss.zul.Button;
import java.sql.Connection;
import java.sql.ResultSet;
import java.lang.String;
import Database.*;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
public class Ans extends GenericForwardComposer
{
/**
*
*/
private static final long serialVersionUID = 1L;
private Include acceptFile ;
private Button btnNext,btnAns,btnFinish;
private Database.DbConn db=new DbConn();
private Label lblQuest,now ;
private Radio rdbOpt1,rdbOpt2,rdbOpt3,rdbOpt4 ;
private Radiogroup rdbOption;
PreparedStatement ps;
Connection conn=null;
public static String test_sub_id = "",sub="",course="",id_course="",cou
rse_id;;
public String subnm = "" ,id = "",examtype="",stud_exam_id="",questid =
"",quest = "",opt1 = "",opt2 = "",opt3 = "",opt4 = "",correctans = "",time_limit
= "";
static int marks=0;
public static int total_time,attempted=0;
private Timer timer;
public static int qno = 1,total_quest;
public String nm,rno,res;
private Student.AnsBean ab=new AnsBean();
private Window wndTest;
String mrk_each = "";
int passmrk=0;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
conn = db.getConn();
getSub();
getCourse();
getExamtype();
//To Get First Question
getQuestion();

}
//To get Test_sub_id
public void getSub() throws Exception
{
test_sub_id=Sessions.getCurrent().getAttribute("test_sub_id").to
String();
System.out.println("test sub of ans.java..."+test_sub_id);
}
//To get course_id
public void getCourse() throws Exception
{
id_course=Sessions.getCurrent().getAttribute("course_id").toStri
ng();
System.out.println("course id of ans.java..."+id_course);
}
//To get Time Limit
public void getTime()throws Exception
{
conn=db.getConn();
String q= "select time_lim,no_of_quest,passmrk from test_sub where
test_sub_id='"+test_sub_id+"' and course_id='"+id_course+"'";
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
if(rs.next())
{
time_limit=rs.getString("time_lim");
total_quest=Integer.parseInt(rs.getString("no_of_quest")
);
passmrk=rs.getInt("passmrk");
System.out.println("Time_limit ="+time_limit+".......Tot
al_Quest="+total_quest );
}
total_time=Integer.parseInt(time_limit);
System.out.println(total_time+"...");
//setting sessions attribute
Sessions.getCurrent().setAttribute("noq",total_quest);

}
//to get exam type
public void getExamtype()throws Exception
{
examtype=Sessions.getCurrent().getAttribute("examtype").toString
();
System.out.println("Exam type of ans.java..."+examtype);
getTime();
}
//Get Question
public void getQuestion()throws Exception
{
conn=db.getConn();
String query = "select quest_id,quest,opt1,opt2,opt3,opt4,ans fr
om question where test_sub_id='"+test_sub_id+"' and quest_no="+qno+" and exam_ty
pe='"+examtype+"'";
System.out.println(query);
ps=conn.prepareStatement(query);
ResultSet rs=ps.executeQuery();

while(rs.next())
{
questid=rs.getString("quest_id");
quest=rs.getString("quest") ;
opt1=rs.getString("opt1");
opt2=rs.getString("opt2");
opt3=rs.getString("opt3");
opt4=rs.getString("opt4");
correctans=rs.getString("ans");
lblQuest.setValue(quest);

rdbOpt1.setLabel(opt1);
rdbOpt2.setLabel(opt2);
rdbOpt3.setLabel(opt3);
rdbOpt4.setLabel(opt4);

}
rs.close();
ps.close();
conn.close();
qno++;
}
public void onClick$btnNext() throws Exception
{
if(qno<=total_quest)
{
getQuestion();
rdbOption.getSelectedItem().setSelected(false);
}
else if(rdbOption.getSelectedItem()==null)
{
Messagebox.show("Please select correct answer");
}
else
{
Messagebox.show("U have Finished with the test Click on Finish B
utton to view your score");
btnNext.setVisible(false);
btnAns.setVisible(false);
btnFinish.setVisible(true);
}
}
public void onClick$btnAns() throws Exception
{
if(rdbOption.getSelectedItem()==null)
{
Messagebox.show("Please select correct answer");
}
else
{
conn=db.getConn();
Messagebox.show("Connected");
String q= "select marks_each from test_sub where test_sub_id='"+test_sub_id
+"'";
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
if(rs.next())
{
mrk_each=rs.getString("marks_each");
}
String clickAns;
clickAns=rdbOption.getSelectedItem().getLabel();
if(clickAns.equals(correctans))
marks=marks+Integer.parseInt(mrk_each);

Sessions.getCurrent().setAttribute("marks",marks);
System.out.println("score : "+marks);
ab.setMarks(marks);
}
attempted++;
}
public void onTimer$timer()throws Exception
{

now.setValue(String.valueOf(total_time));
total_time=total_time-1;

if(now.getValue().equals("0"))
{
timer.stop();
Messagebox.show("Sorry The Time Limit is Finished.... ");
btnNext.setVisible(false);
btnAns.setVisible(false);
btnFinish.setVisible(true);
now.setValue("");
}
//now.setValue(String.valueOf(total_time));
}

public void onClick$btnFinish() throws Exception


{
timer.stop();
//int total_marks=Integer.parseInt(mrk_each)*total_quest;
Sessions.getCurrent().setAttribute("attempted",attempted);
wndTest.setVisible(false);
// a.getSub();
marks=ab.getMarks();
//to get Stud_exam_id
conn=db.getConn();
Messagebox.show("Connected");
String q="select stud_exam_id from studexam where rno="+Sessions.getCurrent
().getAttribute("rno");
System.out.println(q);
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
if(rs.next())
{
stud_exam_id=rs.getString("stud_exam_id");
}
String query="insert into examresult(examresult_id,totalmarks,stud_exam_id,
examdate,result) values(get_uuid(),?,?,?,?)";
ps=conn.prepareStatement(query);
ps.setInt(1,marks);
ps.setString(2,stud_exam_id);
ps.setString(3,Sessions.getCurrent().getAttribute("examdate").toString());
if(marks>=passmrk && marks>0)
ps.setString(4,"Pass");
else
ps.setString(4,"Fail");
ps.executeUpdate();
ps.close();

acceptFile.setVisible(true);
acceptFile.setSrc("studresult.zul");

}
package Student;
public class AnsBean
{
int marks;
public void setMarks(int marks)
{
this.marks=marks;
}
public int getMarks()
{
return marks;
}
}
package Student;
import org.zkoss.zk.ui.Sessions;
public class ErpSessions
{

public static void setExamId(String stud_exam_id)


{
Sessions.getCurrent().setAttribute("stud_exam_id", stud_exam_id)
;
}
public static Object getExamId()
{
return Sessions.getCurrent().getAttribute("stud_exam_id");
}

public static void setExamresultId(String examresult_id)


{
Sessions.getCurrent().setAttribute("examresult_id", examresult_id);
}
public static Object getExamresultId()
{
return Sessions.getCurrent().getAttribute("examresult_id");
}
public static void setLoginUserId(String loginuser_id)
{
Sessions.getCurrent().setAttribute("loginuser_id", loginuser_id);
}
public static Object getLoginUserId()
{
return Sessions.getCurrent().getAttribute("loginuser_id");
}
public static void setCourseId(String course_id)
{
Sessions.getCurrent().setAttribute("course_id", course_id);
}
public static Object getCourseId()
{
return Sessions.getCurrent().getAttribute("course_id");
}
public static void setQuestionId(String quest_id)
{
Sessions.getCurrent().setAttribute("quest_id", quest_id);
}
public static Object getQuestionId()
{
return Sessions.getCurrent().getAttribute("quest_id");
}
public static void setRoleId(String role_id)
{
Sessions.getCurrent().setAttribute("role_id", role_id);
}
public static Object getRoleId()
{
return Sessions.getCurrent().getAttribute("role_id");
}
public static void setRno(String rno)
{
Sessions.getCurrent().setAttribute("rno", rno);
}
public static Object getRno()
{
return Sessions.getCurrent().getAttribute("rno");
}
public static void setSubId(String test_sub_id)
{
Sessions.getCurrent().setAttribute("test_sub_id", test_sub_id);
}
public static Object getSubId()
{
return Sessions.getCurrent().getAttribute("test_sub_id");
}
public static void setUserId(String user_id)
{
Sessions.getCurrent().setAttribute("user_id", user_id);
}
public static Object getUserId()
{
return Sessions.getCurrent().getAttribute("user_id");
}
public static void setCurDate(String examdate)
{
Sessions.getCurrent().setAttribute("examdate", examdate);
}
public static Object getCurDate()
{
return Sessions.getCurrent().getAttribute("examdate");
}
public static void setExamtype(String examtype)
{
Sessions.getCurrent().setAttribute("examtype", examtype);
}
public static Object getExamtype()
{
return Sessions.getCurrent().getAttribute("examtype");
}
public static void setMarks(int Marks)
{
Sessions.getCurrent().setAttribute("Marks", Marks);
}
public static Object getMarks()
{
return Sessions.getCurrent().getAttribute("Marks");
}
public static void setSName(String Sname)
{
Sessions.getCurrent().setAttribute("Sname", Sname);
}
public static Object getSName()
{
return Sessions.getCurrent().getAttribute("Sname");
}
public static void setTotalQuest(int noq)
{
Sessions.getCurrent().setAttribute("noq", noq);
}
public static Object getTotalQuest()
{
return Sessions.getCurrent().getAttribute("noq");
}
public static void setAttempted(int attempted)
{
Sessions.getCurrent().setAttribute("attempted", attempted);
}
public static Object getAttempted()
{
return Sessions.getCurrent().getAttribute("attempted");
}
public static void setSub(String Sub)
{
Sessions.getCurrent().setAttribute("Sub", Sub);
}
public static Object getSub()
{
return Sessions.getCurrent().getAttribute("Sub");
}
}
package Student;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Label;
import org.zkoss.zul.Include;
import org.zkoss.zul.Messagebox;
import Database.DbConn;

public class Result extends GenericForwardComposer


{
/**
*
*/
private static final long serialVersionUID = 1L;
private Label lblRno,lblStudname,lblResult,lblMarks,lblWish,lblTotalQue,
lblAttempt;
private Include acceptFile;
private Connection conn=null;
private PreparedStatement ps=null;
public static String test_sub_id = "",sub,nm,subnm,id;
static int marks=0;
private Database.DbConn db=new DbConn();
private Student.StudBean sb=new StudBean();
private Student.AnsBean ab=new AnsBean();
//private Student.Ans a=new Ans();
private Student.Stud_Main sm=new Stud_Main();
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
conn = db.getConn();
getResult();
}
public void getResult()throws Exception
{
int rno=1,mrk=0;
String result="";
conn=db.getConn();
String Query="select sname,rno,totalmarks,result from studexam,exam
result where studexam.stud_exam_id=examresult.stud_exam_id and studexam.stud_exa
m_id='"+Sessions.getCurrent().getAttribute("stud_exam_id").toString()+"'";
System.out.println(Query);
ps=conn.prepareStatement(Query);
ResultSet rs=ps.executeQuery();
if(rs.next())
{
nm=rs.getString("sname");
rno=rs.getInt("rno");
mrk=rs.getInt("totalmarks");
result=rs.getString("result");
}
if(result.equals("Pass"))
{
lblWish.setValue("Congratulations !!!!!");
lblWish.setStyle("color: GREEN; font-size : 30px");
}
else
{
lblWish.setValue("Sorry......");
lblWish.setStyle("color: RED; font-size : 30px");
}
lblStudname.setValue("Name : "+nm);
lblRno.setValue("Roll No : "+String.valueOf(rno));
lblTotalQue.setValue("Total Questions : "+ Sessions.getCurrent().ge
tAttribute("noq").toString());
lblAttempt.setValue("Attempted Questions : "+ Sessions.getCurrent()
.getAttribute("attempted").toString());
lblMarks.setValue("Score : "+String.valueOf(mrk));
lblResult.setValue("Result : "+result);
}
}

package Student;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Include;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Label;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Window;
import java.sql.PreparedStatement;
import org.zkoss.zul.Messagebox;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Date;
import java.lang.String;
import Database.*;

public class Stud_Main extends GenericForwardComposer


{
/**
*
*/
private static final long serialVersionUID = 1L;
private Include acceptFile ;
private Database.DbConn db=new DbConn();
private Textbox txtUsername,txtPassword;
private Label lblAuthorizedUser,lblSignin,lblSname,Signout;
private Window wndInstru,wndSignIn;
private Student.StudBean sb=new StudBean();
PreparedStatement ps;
Connection conn=null;
public String passwd,sname;
public int rno;

public void doAfterCompose(Component comp) throws Exception


{
super.doAfterCompose(comp);
conn = db.getConn();
}
/*********************************Sign In Label*************************
*****************/
public void onClick$lblSignin()
{
lblSignin.setVisible(false);

acceptFile.setVisible(true);
acceptFile.setSrc("Loginstud.zul");
}
public void onChange$txtUsername()throws Exception
{
conn=db.getConn();
String q="select username from loginuser";
ps=conn.prepareStatement(q);
ResultSet rs=ps.executeQuery();
while(rs.next())
{
if(rs.getString("username").equals(txtUsername.getText()
))
{
break;
}
else
{
Messagebox.show("Sorry Username does not exist!!
");
txtUsername.setText("");
txtPassword.setText("");
}
}
}

public void onChange$txtPassword()throws Exception


{
conn=db.getConn();
String sql="select passwd from loginuser where username='"+txtUs
ername.getText()+"'";
ps=conn.prepareStatement(sql);
ResultSet rs=ps.executeQuery();
//Messagebox.show("Connected");
if(rs.next())
{
passwd=rs.getString("passwd");
}
if(passwd.equals(txtPassword.getText()))
{
lblAuthorizedUser.setVisible(true);
lblAuthorizedUser.setValue("Authorized User...");
}
else
{
lblAuthorizedUser.setVisible(true);
lblAuthorizedUser.setValue("Unauthorized User...");
}
if(lblAuthorizedUser.getValue().equals("Unauthorized User..."))
{
Messagebox.show("Sorry !! U r unauthorized User");
txtUsername.setText("");
txtPassword.setText("");
/*acceptFile.setVisible(true);
acceptFile.setSrc("Loginstud.zul");*/
}
}
/*********************************Sign In Button************************
******************/

public void onClick$btnSignIn() throws Exception


{
if(txtUsername.getText()==""|| txtPassword.getText()=="")
{
Messagebox.show("Please enter valid Username and Password!!");
}

else if(lblAuthorizedUser.getValue().equals("Authorized User..."))


{
/*Set value for label Welcome student student name....
sname=Sessions.getCurrent().getAttribute("Sname").toString();
lblSname.setValue(sname);
Signout.setVisible(true);
*/
wndSignIn.setVisible(false);
acceptFile.setVisible(true);
acceptFile.setSrc("instructions.zul");
}
else
{
Messagebox.show("Sorry !! U r unauthorized User");
acceptFile.setVisible(true);
acceptFile.setSrc("Loginstud.zul");
}

}
/*********************************On click button proceed***************
***************************/
public void onClick$btnProceed() throws Exception
{
wndInstru.setVisible(false);
acceptFile.setVisible(true);
acceptFile.setSrc("Student.zul");

}
package Student;

public class StudBean


{
String sname,type;
String exdate,course,sub;
int rno;
public void setName(String sname)
{
this.sname=sname;
}
public String getName()
{
return sname;
}
public void setRno(int rno)
{
this.rno=rno;
}
public int getRno()
{
return rno;
}
public void setDate(String exdate)
{
this.exdate=exdate;
}
public String getDate()
{
return exdate;
}
public void setCourse(String course)
{
this.course=course;
}
public String getCourse()
{
return course;
}
public void setSub(String sub)
{
this.sub=sub;
}
public String getSub()
{
return sub;
}
public void setExamType(String type)
{
this.type=type;
}
public String getExamType()
{
return type;
}
}
package Student;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Sessions;
import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Datebox;
import org.zkoss.zul.Label;
import org.zkoss.zul.Include;
import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Window;
import Database.DbConn;
import java.util.*;

public class StudInfo extends GenericForwardComposer


{
/**
*
*/
private static final long serialVersionUID = 1L;
private Include acceptFile;
private Connection conn=null;
private PreparedStatement ps=null;
public static String test_sub_id = "",sub,nm,subnm,id;
static int marks=0;
private Database.DbConn db=new DbConn();
private Textbox txtFname,txtRno,txtExamType;
private Datebox examDate;
private Combobox cmbCourse,cmbSub;
private Student.StudBean sb=new StudBean();
private Window wndStud;
public String examType;
public void doAfterCompose(Component comp) throws Exception
{
super.doAfterCompose(comp);
conn = db.getConn();
// now();
// getInfo();
}
public void setInfo()
{
sb.setName(txtFname.getText());
sb.setRno(Integer.parseInt(txtRno.getText()));
Sessions.getCurrent().setAttribute("rno",Integer.parseInt(txtRno
.getText()));
System.out.println( "sb.setRno"+Integer.parseInt(txtRno.getT
ext()));
sb.setDate(examDate.getValue().toString());
Sessions.getCurrent().setAttribute("examdate",examDate.getValue(
).toString());
System.out.println("Exam date ......."+examDate.getValue().toStr
ing());
sb.setExamType(txtExamType.getText());
sb.setCourse(cmbCourse.getText());
sb.setSub(cmbSub.getText());
examType=txtExamType.getText();
}

public void getInfo() throws Exception


{
setInfo();

//insert into stud exam


conn=db.getConn();
String q="insert into studexam(stud_exam_id,sname,examdate,cours
e,sub,examtype,rno) values(get_uuid(),?,?,?,?,?,?) ";
ps=conn.prepareStatement(q);
ps.setString(1, sb.getName());
ps.setString(2, sb.getDate());
ps.setString(3, sb.getCourse());
ps.setString(4,sb.getSub());
ps.setString(5,sb.getExamType());
ps.setInt(6,sb.getRno());
System.out.println("Exam type...."+examType);
ps.executeUpdate();
Sessions.getCurrent().setAttribute("Sname",sb.getName())
;
System.out.println("Student Info Saved");
Messagebox.show("Saved Successfully");
//set sessions course_id
String query2="select course_id from course1 where course_name='
"+sb.getCourse()+"'";
ps=conn.prepareStatement(query2);
ResultSet rs = ps.executeQuery();
if(rs.next())
{
Sessions.getCurrent().setAttribute("course_id",rs.getStr
ing("course_id"));
}
//set sessions Examtype
Sessions.getCurrent().setAttribute("examtype",sb.getExamType());
//set sessions stud_exam_id
String query="select stud_exam_id from studexam where rno="+sb.g
etRno();
ps=conn.prepareStatement(query);
rs = ps.executeQuery();
if(rs.next())
{
Sessions.getCurrent().setAttribute("stud_exam_id",rs.get
String("stud_exam_id"));
}
//set test_sub_id
String query1="select test_sub_id from test_sub where sub_name='
"+sb.getSub()+"' and course_id='"+Sessions.getCurrent().getAttribute("course_id"
).toString()+"' and exam_type='"+sb.getExamType()+"'";
ps=conn.prepareStatement(query1);
rs = ps.executeQuery();
if(rs.next())
{
Sessions.getCurrent().setAttribute("test_sub_id",rs.getS
tring("test_sub_id"));
}
conn.close();
ps.close();

}
public void onClick$btnStart() throws Exception
{
getInfo();
wndStud.setVisible(false);
acceptFile.setVisible(true);
acceptFile.setSrc("test.zul");
}
}
-- Table: studexam
-- DROP TABLE studexam;
CREATE TABLE studexam
(
stud_exam_id character varying(32) NOT NULL,
sname character varying(100) NOT NULL,
examdate character varying(32) NOT NULL,
course character varying(100) NOT NULL,
sub character varying(100) NOT NULL,
examtype character varying(32),
rno integer,
CONSTRAINT pk_stud_exam PRIMARY KEY (stud_exam_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE studexam OWNER TO vtserpadmin;
-- Table: course1
-- DROP TABLE course1;
CREATE TABLE course1
(
course_id character varying(32) NOT NULL,
course_name character varying(200) NOT NULL,
isactive character varying(1) NOT NULL DEFAULT 'Y'::character varying,
created timestamp without time zone NOT NULL DEFAULT now(),
created_by character varying(32) NOT NULL DEFAULT 1,
updated timestamp without time zone NOT NULL DEFAULT now(),
updated_by character varying(32) NOT NULL DEFAULT 1,
descp character varying(200),
CONSTRAINT pk_course PRIMARY KEY (course_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE course1 OWNER TO vtserpadmin;

-- Table: course1
-- DROP TABLE course1;
CREATE TABLE course1
(
course_id character varying(32) NOT NULL,
course_name character varying(200) NOT NULL,
isactive character varying(1) NOT NULL DEFAULT 'Y'::character varying,
created timestamp without time zone NOT NULL DEFAULT now(),
created_by character varying(32) NOT NULL DEFAULT 1,
updated timestamp without time zone NOT NULL DEFAULT now(),
updated_by character varying(32) NOT NULL DEFAULT 1,
descp character varying(200),
CONSTRAINT pk_course PRIMARY KEY (course_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE course1 OWNER TO vtserpadmin;

-- Table: question
-- DROP TABLE question;
CREATE TABLE question
(
quest_id character varying(32) NOT NULL,
opt1 character varying(100) NOT NULL,
opt2 character varying(100) NOT NULL,
opt3 character varying(100) NOT NULL,
opt4 character varying(100) NOT NULL,
ans character varying(100) NOT NULL,
created_by character varying(100) NOT NULL DEFAULT 1,
updated timestamp without time zone NOT NULL DEFAULT now(),
updated_by character varying(32) NOT NULL DEFAULT 1,
created timestamp without time zone NOT NULL DEFAULT now(),
quest character varying(200) NOT NULL,
isactive character varying(1) NOT NULL DEFAULT 'Y'::character varying,
test_sub_id character varying(32) NOT NULL,
quest_no integer NOT NULL DEFAULT 1,
exam_type character varying(100),
CONSTRAINT pk_question PRIMARY KEY (quest_id),
CONSTRAINT fk_testsub FOREIGN KEY (test_sub_id)
REFERENCES test_sub (test_sub_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
ALTER TABLE question OWNER TO vtserpadmin;

-- Table: test_sub
-- DROP TABLE test_sub;
CREATE TABLE test_sub
(
test_sub_id character varying(32) NOT NULL,
sub_name character varying NOT NULL,
created timestamp without time zone NOT NULL DEFAULT now(),
created_by character varying(1) NOT NULL DEFAULT 1,
no_of_quest character varying(32) NOT NULL,
marks_each character varying(32) NOT NULL,
time_lim character varying(200) NOT NULL,
course_id character varying(32) NOT NULL,
exam_type character varying(100),
passmrk integer,
CONSTRAINT pk_testsub2 PRIMARY KEY (test_sub_id),
CONSTRAINT kf_course FOREIGN KEY (course_id)
REFERENCES course1 (course_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT "Uk_test" UNIQUE (test_sub_id)
)
WITH (
OIDS=FALSE
);
ALTER TABLE test_sub OWNER TO vtserpadmin;
-- Index: fki_kf_course
-- DROP INDEX fki_kf_course;
CREATE INDEX fki_kf_course
ON test_sub
USING btree
(course_id);

Vous aimerez peut-être aussi