M
Michael Albanese
I am building an ASP.Net web application that records
employee incident data over several screens. I have built
custom classes to hold this information as the user enters
data. In order to persist the data, i am trying to use
session memory. The problem is that when i try to cast the
class that is in session memory into a class on my page
and i get NOTHING! Actually, my watch window tells me that
the class equals nothing......
Where am I going wrong?
+++++++
My IncidentDetails Class
Public Class IncidentDetailsClass
Private m_DeptID As Integer
Private m_EmployeeID As Integer
Private m_IncidentID As Integer
Private m_treatmentID As Integer
Private m_IncidentDetailID As Integer
Private m_InjuryTime As Date
Private m_BeganWorkTime As Date
Private m_InjuryType As String
Private m_EmpDescription As String
Private m_BodyPart As String
Private m_bodypartDesc As String
Private m_Equipment As String
Private m_newIncident As Boolean
Private m_WorkRelated As Boolean
Private m_OshaGeneral As String
Private m_OshaAdditional As String
Private m_Privacy As String
Private m_SafetyProvided As Boolean
Private m_SafetyinUse As Boolean
Private m_Witness1 As String
Private m_Witness2 As String
Private m_ActionTaken As String
Private m_ReviewerName As String
Private m_ReviewerDate As Date
Private m_reviewerPhone As String
Private m_OshaFlag As Boolean
Private m_OshaReporter As String
Private m_OshaReportDate As Date
Private m_OshaCaseNumber As Integer
Public Property DeptID() As Integer
Get
Return m_DeptID
End Get
Set(ByVal Value As Integer)
m_DeptID = Value
End Set
End Property
Public Property EmployeeID() As Integer
Get
Return m_EmployeeID
End Get
Set(ByVal Value As Integer)
m_EmployeeID = Value
End Set
End Property
Public Property IncidentID() As Integer
Get
Return m_IncidentID
End Get
Set(ByVal Value As Integer)
m_IncidentID = Value
End Set
End Property
Public Property treatmentID() As Integer
Get
Return m_treatmentID
End Get
Set(ByVal Value As Integer)
m_treatmentID = Value
End Set
End Property
Public Property IncidentDetailID() As Integer
Get
Return m_IncidentDetailID
End Get
Set(ByVal Value As Integer)
m_IncidentDetailID = Value
End Set
End Property
Public Property InjuryTime() As Date
Get
Return m_InjuryTime
End Get
Set(ByVal Value As Date)
m_InjuryTime = Value
End Set
End Property
Public Property BeganWorkTime() As Date
Get
Return m_BeganWorkTime
End Get
Set(ByVal Value As Date)
m_BeganWorkTime = Value
End Set
End Property
Public Property InjuryType() As String
Get
Return m_InjuryType
End Get
Set(ByVal Value As String)
m_InjuryType = Value
End Set
End Property
Public Property EmpDescription() As String
Get
Return m_EmpDescription
End Get
Set(ByVal Value As String)
m_EmpDescription = Value
End Set
End Property
Public Property BodyPart() As String
Get
Return m_BodyPart
End Get
Set(ByVal Value As String)
m_BodyPart = Value
End Set
End Property
Public Property BodypartDesc() As String
Get
Return m_bodypartDesc
End Get
Set(ByVal Value As String)
m_bodypartDesc = Value
End Set
End Property
Public Property Equipment() As String
Get
Return m_Equipment
End Get
Set(ByVal Value As String)
m_Equipment = Value
End Set
End Property
Public Property newIncident() As Boolean
Get
Return m_newIncident
End Get
Set(ByVal Value As Boolean)
m_newIncident = Value
End Set
End Property
Public Property WorkRelated() As Boolean
Get
Return m_WorkRelated
End Get
Set(ByVal Value As Boolean)
m_WorkRelated = Value
End Set
End Property
Public Property OshaGeneral() As String
Get
Return m_OshaGeneral
End Get
Set(ByVal Value As String)
m_OshaGeneral = Value
End Set
End Property
Public Property OshaAdditional() As String
Get
Return m_OshaAdditional
End Get
Set(ByVal Value As String)
m_OshaAdditional = Value
End Set
End Property
Public Property Privacy() As String
Get
Return m_Privacy
End Get
Set(ByVal Value As String)
m_Privacy = Value
End Set
End Property
Public Property SafetyProvided() As Boolean
Get
Return m_SafetyProvided
End Get
Set(ByVal Value As Boolean)
m_SafetyProvided = Value
End Set
End Property
Public Property SafetyinUse() As Boolean
Get
Return m_SafetyinUse
End Get
Set(ByVal Value As Boolean)
m_SafetyinUse = Value
End Set
End Property
Public Property Witness1() As String
Get
Return m_Witness1
End Get
Set(ByVal Value As String)
m_Witness1 = Value
End Set
End Property
Public Property Witness2() As String
Get
Return m_Witness2
End Get
Set(ByVal Value As String)
m_Witness2 = Value
End Set
End Property
Public Property ActionTaken() As String
Get
Return m_ActionTaken
End Get
Set(ByVal Value As String)
m_ActionTaken = Value
End Set
End Property
Public Property ReviewerName() As String
Get
Return m_ReviewerName
End Get
Set(ByVal Value As String)
m_ReviewerName = Value
End Set
End Property
Public Property ReviewerDate() As Date
Get
Return m_ReviewerDate
End Get
Set(ByVal Value As Date)
m_ReviewerDate = Value
End Set
End Property
Public Property reviewerPhone() As String
Get
Return m_reviewerPhone
End Get
Set(ByVal Value As String)
m_reviewerPhone = Value
End Set
End Property
Public Property OshaFlag() As Boolean
Get
Return m_OshaFlag
End Get
Set(ByVal Value As Boolean)
m_OshaFlag = Value
End Set
End Property
Public Property OshaReporter() As String
Get
Return m_OshaReporter
End Get
Set(ByVal Value As String)
m_OshaReporter = Value
End Set
End Property
Public Property OshaReportDate() As Date
Get
Return m_OshaReportDate
End Get
Set(ByVal Value As Date)
m_OshaReportDate = Value
End Set
End Property
Public Property OshaCaseNumber() As String
Get
Return m_OshaCaseNumber
End Get
Set(ByVal Value As String)
m_OshaCaseNumber = Value
End Set
End Property
End Class
+++++++++++++++++++++++
A section of the codebehind where the problem is
Private Sub reportingCriteriaContinue_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
reportingCriteriaContinue.Click
If Page.IsValid Then
Dim myReportingCriteria As New
IncidentDetailsClass
myReportingCriteria = CType(Session
("clIncidentDetails"), IncidentDetailsClass)
myReportingCriteria.newIncident =
criteriaNew.SelectedValue
myReportingCriteria.WorkRelated =
criteriaWorkRelated.SelectedValue
myReportingCriteria.OshaGeneral =
ddlOshaGeneral.SelectedValue
myReportingCriteria.OshaAdditional =
ddlOshaAdditional.SelectedValue
Session("clIncidentDetails") =
myReportingCriteria ' save data back into session
If rePost Then
'add page name to session arraylist
Dim newIncident As New ArrayList
newIncident = Session("newIncident")
newIncident.Add("reportingCriteria")
Session("newIncident") = newIncident
Response.Redirect("MedicalTreatment.aspx")
Else
'When a user re-enters data within a
session
'we do not need to enter anything in the
arraylist again.
Response.Redirect("MedicalTreatment.aspx")
End If
End If
End Sub
employee incident data over several screens. I have built
custom classes to hold this information as the user enters
data. In order to persist the data, i am trying to use
session memory. The problem is that when i try to cast the
class that is in session memory into a class on my page
and i get NOTHING! Actually, my watch window tells me that
the class equals nothing......
Where am I going wrong?
+++++++
My IncidentDetails Class
Public Class IncidentDetailsClass
Private m_DeptID As Integer
Private m_EmployeeID As Integer
Private m_IncidentID As Integer
Private m_treatmentID As Integer
Private m_IncidentDetailID As Integer
Private m_InjuryTime As Date
Private m_BeganWorkTime As Date
Private m_InjuryType As String
Private m_EmpDescription As String
Private m_BodyPart As String
Private m_bodypartDesc As String
Private m_Equipment As String
Private m_newIncident As Boolean
Private m_WorkRelated As Boolean
Private m_OshaGeneral As String
Private m_OshaAdditional As String
Private m_Privacy As String
Private m_SafetyProvided As Boolean
Private m_SafetyinUse As Boolean
Private m_Witness1 As String
Private m_Witness2 As String
Private m_ActionTaken As String
Private m_ReviewerName As String
Private m_ReviewerDate As Date
Private m_reviewerPhone As String
Private m_OshaFlag As Boolean
Private m_OshaReporter As String
Private m_OshaReportDate As Date
Private m_OshaCaseNumber As Integer
Public Property DeptID() As Integer
Get
Return m_DeptID
End Get
Set(ByVal Value As Integer)
m_DeptID = Value
End Set
End Property
Public Property EmployeeID() As Integer
Get
Return m_EmployeeID
End Get
Set(ByVal Value As Integer)
m_EmployeeID = Value
End Set
End Property
Public Property IncidentID() As Integer
Get
Return m_IncidentID
End Get
Set(ByVal Value As Integer)
m_IncidentID = Value
End Set
End Property
Public Property treatmentID() As Integer
Get
Return m_treatmentID
End Get
Set(ByVal Value As Integer)
m_treatmentID = Value
End Set
End Property
Public Property IncidentDetailID() As Integer
Get
Return m_IncidentDetailID
End Get
Set(ByVal Value As Integer)
m_IncidentDetailID = Value
End Set
End Property
Public Property InjuryTime() As Date
Get
Return m_InjuryTime
End Get
Set(ByVal Value As Date)
m_InjuryTime = Value
End Set
End Property
Public Property BeganWorkTime() As Date
Get
Return m_BeganWorkTime
End Get
Set(ByVal Value As Date)
m_BeganWorkTime = Value
End Set
End Property
Public Property InjuryType() As String
Get
Return m_InjuryType
End Get
Set(ByVal Value As String)
m_InjuryType = Value
End Set
End Property
Public Property EmpDescription() As String
Get
Return m_EmpDescription
End Get
Set(ByVal Value As String)
m_EmpDescription = Value
End Set
End Property
Public Property BodyPart() As String
Get
Return m_BodyPart
End Get
Set(ByVal Value As String)
m_BodyPart = Value
End Set
End Property
Public Property BodypartDesc() As String
Get
Return m_bodypartDesc
End Get
Set(ByVal Value As String)
m_bodypartDesc = Value
End Set
End Property
Public Property Equipment() As String
Get
Return m_Equipment
End Get
Set(ByVal Value As String)
m_Equipment = Value
End Set
End Property
Public Property newIncident() As Boolean
Get
Return m_newIncident
End Get
Set(ByVal Value As Boolean)
m_newIncident = Value
End Set
End Property
Public Property WorkRelated() As Boolean
Get
Return m_WorkRelated
End Get
Set(ByVal Value As Boolean)
m_WorkRelated = Value
End Set
End Property
Public Property OshaGeneral() As String
Get
Return m_OshaGeneral
End Get
Set(ByVal Value As String)
m_OshaGeneral = Value
End Set
End Property
Public Property OshaAdditional() As String
Get
Return m_OshaAdditional
End Get
Set(ByVal Value As String)
m_OshaAdditional = Value
End Set
End Property
Public Property Privacy() As String
Get
Return m_Privacy
End Get
Set(ByVal Value As String)
m_Privacy = Value
End Set
End Property
Public Property SafetyProvided() As Boolean
Get
Return m_SafetyProvided
End Get
Set(ByVal Value As Boolean)
m_SafetyProvided = Value
End Set
End Property
Public Property SafetyinUse() As Boolean
Get
Return m_SafetyinUse
End Get
Set(ByVal Value As Boolean)
m_SafetyinUse = Value
End Set
End Property
Public Property Witness1() As String
Get
Return m_Witness1
End Get
Set(ByVal Value As String)
m_Witness1 = Value
End Set
End Property
Public Property Witness2() As String
Get
Return m_Witness2
End Get
Set(ByVal Value As String)
m_Witness2 = Value
End Set
End Property
Public Property ActionTaken() As String
Get
Return m_ActionTaken
End Get
Set(ByVal Value As String)
m_ActionTaken = Value
End Set
End Property
Public Property ReviewerName() As String
Get
Return m_ReviewerName
End Get
Set(ByVal Value As String)
m_ReviewerName = Value
End Set
End Property
Public Property ReviewerDate() As Date
Get
Return m_ReviewerDate
End Get
Set(ByVal Value As Date)
m_ReviewerDate = Value
End Set
End Property
Public Property reviewerPhone() As String
Get
Return m_reviewerPhone
End Get
Set(ByVal Value As String)
m_reviewerPhone = Value
End Set
End Property
Public Property OshaFlag() As Boolean
Get
Return m_OshaFlag
End Get
Set(ByVal Value As Boolean)
m_OshaFlag = Value
End Set
End Property
Public Property OshaReporter() As String
Get
Return m_OshaReporter
End Get
Set(ByVal Value As String)
m_OshaReporter = Value
End Set
End Property
Public Property OshaReportDate() As Date
Get
Return m_OshaReportDate
End Get
Set(ByVal Value As Date)
m_OshaReportDate = Value
End Set
End Property
Public Property OshaCaseNumber() As String
Get
Return m_OshaCaseNumber
End Get
Set(ByVal Value As String)
m_OshaCaseNumber = Value
End Set
End Property
End Class
+++++++++++++++++++++++
A section of the codebehind where the problem is
Private Sub reportingCriteriaContinue_Click(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles
reportingCriteriaContinue.Click
If Page.IsValid Then
Dim myReportingCriteria As New
IncidentDetailsClass
myReportingCriteria = CType(Session
("clIncidentDetails"), IncidentDetailsClass)
myReportingCriteria.newIncident =
criteriaNew.SelectedValue
myReportingCriteria.WorkRelated =
criteriaWorkRelated.SelectedValue
myReportingCriteria.OshaGeneral =
ddlOshaGeneral.SelectedValue
myReportingCriteria.OshaAdditional =
ddlOshaAdditional.SelectedValue
Session("clIncidentDetails") =
myReportingCriteria ' save data back into session
If rePost Then
'add page name to session arraylist
Dim newIncident As New ArrayList
newIncident = Session("newIncident")
newIncident.Add("reportingCriteria")
Session("newIncident") = newIncident
Response.Redirect("MedicalTreatment.aspx")
Else
'When a user re-enters data within a
session
'we do not need to enter anything in the
arraylist again.
Response.Redirect("MedicalTreatment.aspx")
End If
End If
End Sub