Thnax Brian for your comment and appreciation.i really don't know how to call the class from my aspx file.Could you tell me how to do it.In addition to that i ahve improved this class to include SSN,Gender and salary.It is working perfectly
Please copy/paste the following and let me know how can make it more useful:
<%@ Page Language="
VB" %>
<script language="
vb" runat="server">
Public Class Employee
'PRIVATE INSTANCE DATA MEMBERS
Private _name as string
Private _onduty as String
Private _sal as Double
Private _ssn as String
Private _gender as String
private _vacates as String
Public Property Name() as String
'ACCESSOR METHODS
Get
return _name
End Get
Set(value as String)
_name=value
End Set
End Property
Public Property SSN() as String
Get
return _ssn
End Get
Set(value as String)
_ssn = value
End Set
End Property
Public Property Gender() as String
Get
return _gender
End Get
Set(value as String)
_gender = value
End Set
End Property
Public ReadOnly Property Status() as String
Get
return _onduty
End Get
End Property
Public Property Vacates() as String
Get
return _vacates
End Get
Set(value as String)
_vacates = value
End Set
End Property
Public ReadOnly Property Wage() as Double
Get
return _sal
End Get
End Property
Public Sub Working(CompanyTime as Integer)
If CompanyTime > 20 Then
_onduty = "Full Time"
_sal = CompanyTime * 5
Else If CompanyTime < 20 Then
_onduty = "Part Time"
_sal = CompanyTime * 3
End If
End Sub
End Class
Sub Report(Sender as Object,E as EventArgs)
Dim emp1 as New Employee
Dim emp2 as New Employee
Dim i as Integer
Dim j as integer
emp1.Name = txt1.Text
emp1.Working(Val(txt2.Text))
emp1.SSN= txt3.Text
For i = 0 to 1
if (lst3.Items(i).Selected) Then emp1.Vacates=lst3.Items(i).Text
if lst1.Items(i).Selected then emp1.Gender = lst1.Items(i).Text
Next
emp2.Name=txt4.Text
emp2.Working(Val(txt5.Text))
emp2.SSN= txt6.Text
For j = 0 to 1
if (lst4.Items(j).Selected) Then emp2.Vacates=lst4.Items(j).Text
if lst2.Items(j).Selected then emp2.Gender = lst2.Items(j).Text
Next
Response.Write(emp1.Name & " is a " & emp1.Gender & " " & emp1.Status & " employee with social security number " & emp1.SSN & ",wage is $ " & emp1.Wage & " and is " & emp1.Vacates & "</br>")
Response.Write(emp2.Name & " is a " & emp2.Gender & " " & emp2.Status & " employee with social security number " & emp2.SSN & " and her wage is $ " & emp2.Wage & " and is " & emp2.Vacates & "</br>")
End Sub
</script>
<html>
<body>
<form runat="server">
<table>
<TR><TD>Employee Name</TD><TD><asp:TextBox id="txt1" runat="server"/></TD></TR>
<TR><TD>No. Hours Working</TD><TD><asp:TextBox id="txt2" runat="server"/></TD></TR>
<TR><TD>Social Security Number</TD><TD><asp:TextBox id="txt3" runat="server"/></TD></TR>
</table>
Gender</b>
<asp:RadioButtonList id="lst1" runat="server">
<asp:listitem text="Male" id="opt1a" ruant="server"/>
<asp:listitem text="Female" id="opt1b" ruant="server"/>
</asp:RadioButtonList>
Status
<asp:RadioButtonList id="lst3" runat="server">
<asp:listitem text="On Job" id="opt3a" ruant="server"/>
<asp:listitem text="Off" id="opt3b" ruant="server"/>
</asp:RadioButtonList>
</br></br>
<table>
<TR><TD>Employee Name</TD><TD><asp:TextBox id="txt4" runat="server"/></TD></TR>
<TR><TD>No. Hours Working</TD><TD><asp:TextBox id="txt5" runat="server"/></TD></TR>
<TR><TD>Social Security Number</TD><TD><asp:TextBox id="txt6" runat="server"/></TD></TR>
</table>
Gender<asp:RadioButtonList id="lst2" runat="server">
<asp:listitem text="Male" id="opt2a" ruant="server"/>
<asp:listitem text="Female" id="opt2b" ruant="server"/>
</asp:RadioButtonList>
Status
<asp:RadioButtonList id="lst4" runat="server">
<asp:listitem text="On Job" id="opt4a" ruant="server"/>
<asp:listitem text="Off" id="opt4b" ruant="server"/>
</asp:RadioButtonList>
<asp:Button id="Eval" Text ="Tell me" onClick=Report runat="server"/>
</form>
</body>
</html>
CEO InteliSoft
Maqsood ur Rahman