home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
66.142.0.142
/
66.142.0.142.tar
/
66.142.0.142
/
tblEmployeeStatusview.aspx.vb
< prev
next >
Wrap
Text File
|
2010-08-24
|
10KB
|
388 lines
Imports System.Data
Imports System.Data.Common
Imports System.Xml
Imports System.IO
Imports System.Data.OleDb
'
' ASP.NET code-behind class (Page)
'
Partial Class tblEmployeeStatusview
Inherits AspNetMaker7_tfpssnet
' Page object
Public tblEmployeeStatus_view As ctblEmployeeStatus_view
'
' Page Class
'
Class ctblEmployeeStatus_view
Inherits AspNetMakerPage
Implements IDisposable
' Used by system generated functions
Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
Private arwrk As Object
Private armultiwrk() As String
' Page URL
Public ReadOnly Property PageUrl() As String
Get
Dim Url As String = ew_CurrentPage() & "?"
If tblEmployeeStatus.UseTokenInUrl Then Url = Url & "t=" & tblEmployeeStatus.TableVar & "&" ' Add page token
Return Url
End Get
End Property
' Validate page request
Public Function IsPageRequest() As Boolean
Dim Result As Boolean
If tblEmployeeStatus.UseTokenInUrl Then
Result = False
If ObjForm IsNot Nothing Then
Result = (tblEmployeeStatus.TableVar = ObjForm.GetValue("t"))
End If
If ew_Get("t") <> "" Then
Result = (tblEmployeeStatus.TableVar = ew_Get("t"))
End If
Return Result
End If
Return True
End Function
' tblEmployeeStatus
Public Property tblEmployeeStatus() As ctblEmployeeStatus
Get
Return ParentPage.tblEmployeeStatus
End Get
Set(ByVal v As ctblEmployeeStatus)
ParentPage.tblEmployeeStatus = v
End Set
End Property
' tblEmployeeStatus
Public Property tblEmployees() As ctblEmployees
Get
Return ParentPage.tblEmployees
End Get
Set(ByVal v As ctblEmployees)
ParentPage.tblEmployees = v
End Set
End Property
'
' Constructor
' - init objects
' - open connection
'
Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)
m_ParentPage = APage
m_Page = Me
m_PageID = "view"
m_PageObjName = "tblEmployeeStatus_view"
m_PageObjTypeName = "ctblEmployeeStatus_view"
' Table Name
m_TableName = "tblEmployeeStatus"
' Initialize table object
tblEmployeeStatus = New ctblEmployeeStatus(Me)
tblEmployees = New ctblEmployees(Me)
' Connect to database
Conn = New cConnection()
End Sub
'
' Subroutine Page_Init
' - called before page main
' - check Security
' - set up response header
' - call page load events
'
Public Sub Page_Init()
Security = New cAdvancedSecurity(Me)
If Not Security.IsLoggedIn() Then Security.AutoLogin()
If Not Security.IsLoggedIn() Then
Security.SaveLastUrl()
Page_Terminate("login.aspx")
End If
' Table Permission loading event
Security.TablePermission_Loading()
Security.LoadCurrentUserLevel(TableName)
' Table Permission loaded event
Security.TablePermission_Loaded()
If Not Security.CanView Then
Security.SaveLastUrl()
Page_Terminate("tblEmployeeStatuslist.aspx")
End If
' User ID loading event
Security.UserID_Loading()
If Security.IsLoggedIn() Then Call Security.LoadUserID()
' User ID loaded event
Security.UserID_Loaded()
' Global page loading event (in ewglobal*.vb)
ParentPage.Page_Loading()
' Page load event, used in current page
Page_Load()
End Sub
'
' Class terminate
' - clean up page object
'
Public Sub Dispose() Implements IDisposable.Dispose
Page_Terminate("")
End Sub
'
' Sub Page_Terminate
' - called when exit page
' - clean up connection and objects
' - if URL specified, redirect to URL
'
Sub Page_Terminate(url As String)
' Page unload event, used in current page
Page_Unload()
' Global page unloaded event (in ewglobal*.vb)
ParentPage.Page_Unloaded()
' Close connection
Conn.Dispose()
Security = Nothing
tblEmployeeStatus.Dispose()
tblEmployees.Dispose()
' Go to URL if specified
If url <> "" Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.Redirect(url)
End If
End Sub
Public lDisplayRecs As Integer ' Number of display records
Public lStartRec As Integer, lStopRec As Integer, lTotalRecs As Integer, lRecRange As Integer
Public lRecCnt As Integer
Public sSrchWhere As String
'
' Page main processing
'
Sub Page_Main()
Dim sReturnUrl As String = ""
Dim bMatchRecord As Boolean = False
If IsPageRequest Then ' Validate request
If ew_Get("ID") <> "" Then
tblEmployeeStatus.ID.QueryStringValue = ew_Get("ID")
Else
sReturnUrl = "tblEmployeeStatuslist.aspx" ' Return to list
End If
' Get action
tblEmployeeStatus.CurrentAction = "I" ' Display form
Select Case tblEmployeeStatus.CurrentAction
Case "I" ' Get a record to display
If Not LoadRow() Then ' Load record based on key
Message = "No records found" ' Set no record message
sReturnUrl = "tblEmployeeStatuslist.aspx" ' No matching record, return to list
End If
End Select
Else
sReturnUrl = "tblEmployeeStatuslist.aspx" ' Not page request, return to list
End If
If sReturnUrl <> "" Then Page_Terminate(sReturnUrl)
' Render row
tblEmployeeStatus.RowType = EW_ROWTYPE_VIEW
RenderRow()
End Sub
Public Pager As Object
'
' Set up Starting Record parameters
'
Sub SetUpStartRec()
Dim nPageNo As Integer
' Exit if lDisplayRecs = 0
If lDisplayRecs = 0 Then Exit Sub
If IsPageRequest Then ' Validate request
' Check for a "start" parameter
If ew_Get(EW_TABLE_START_REC) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_START_REC)) Then
lStartRec = ew_ConvertToInt(ew_Get(EW_TABLE_START_REC))
tblEmployeeStatus.StartRecordNumber = lStartRec
ElseIf ew_Get(EW_TABLE_PAGE_NO) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_PAGE_NO)) Then
nPageNo = ew_ConvertToInt(ew_Get(EW_TABLE_PAGE_NO))
lStartRec = (nPageNo-1)*lDisplayRecs+1
If lStartRec <= 0 Then
lStartRec = 1
ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
End If
tblEmployeeStatus.StartRecordNumber = lStartRec
End If
End If
lStartRec = tblEmployeeStatus.StartRecordNumber
' Check if correct start record counter
If lStartRec <= 0 Then ' Avoid invalid start record counter
lStartRec = 1 ' Reset start record counter
tblEmployeeStatus.StartRecordNumber = lStartRec
ElseIf lStartRec > lTotalRecs Then ' Avoid starting record > total records
lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
tblEmployeeStatus.StartRecordNumber = lStartRec
ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
tblEmployeeStatus.StartRecordNumber = lStartRec
End If
End Sub
'
' Load default values
'
Sub LoadDefaultValues()
End Sub
'
' Load row based on key values
'
Function LoadRow() As Boolean
Dim RsRow As OleDbDataReader
Dim sFilter As String = tblEmployeeStatus.KeyFilter
' Row Selecting event
tblEmployeeStatus.Row_Selecting(sFilter)
' Load SQL based on filter
tblEmployeeStatus.CurrentFilter = sFilter
Dim sSql As String = tblEmployeeStatus.SQL
' Write SQL for debug
If EW_DEBUG_ENABLED Then ew_Write(sSql)
Try
RsRow = Conn.GetTempDataReader(sSql)
If Not RsRow.Read() Then
Return False
Else
LoadRowValues(RsRow) ' Load row values
' Row Selected event
tblEmployeeStatus.Row_Selected(RsRow)
Return True
End If
Catch
If EW_DEBUG_ENABLED Then Throw
Return False
Finally
Conn.CloseTempDataReader()
End Try
End Function
'
' Load row values from recordset
'
Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
tblEmployeeStatus.ID.DbValue = RsRow("ID")
tblEmployeeStatus.tscStatus.DbValue = RsRow("tscStatus")
End Sub
'
' Render row values based on field settings
'
Sub RenderRow()
' Row Rendering event
tblEmployeeStatus.Row_Rendering()
'
' Common render codes for all row types
'
' tscStatus
tblEmployeeStatus.tscStatus.CellCssStyle = ""
tblEmployeeStatus.tscStatus.CellCssClass = ""
'
' View Row
'
If tblEmployeeStatus.RowType = EW_ROWTYPE_VIEW Then ' View row
' ID
tblEmployeeStatus.ID.ViewValue = tblEmployeeStatus.ID.CurrentValue
tblEmployeeStatus.ID.CssStyle = ""
tblEmployeeStatus.ID.CssClass = ""
tblEmployeeStatus.ID.ViewCustomAttributes = ""
' tscStatus
tblEmployeeStatus.tscStatus.ViewValue = tblEmployeeStatus.tscStatus.CurrentValue
tblEmployeeStatus.tscStatus.CssStyle = ""
tblEmployeeStatus.tscStatus.CssClass = ""
tblEmployeeStatus.tscStatus.ViewCustomAttributes = ""
' View refer script
' tscStatus
tblEmployeeStatus.tscStatus.HrefValue = ""
End If
' Row Rendered event
tblEmployeeStatus.Row_Rendered()
End Sub
' Page Load event
Public Sub Page_Load()
'HttpContext.Current.Response.Write("Page Load")
End Sub
' Page Unload event
Public Sub Page_Unload()
'HttpContext.Current.Response.Write("Page Unload")
End Sub
End Class
'
' ASP.NET Page_Load event
'
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Response.Buffer = EW_RESPONSE_BUFFER
Response.Cache.SetCacheability(HttpCacheability.NoCache)
' Page init
tblEmployeeStatus_view = New ctblEmployeeStatus_view(Me)
tblEmployeeStatus_view.Page_Init()
' Page main processing
tblEmployeeStatus_view.Page_Main()
End Sub
'
' ASP.NET Page_Unload event
'
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
' Dispose page object
If tblEmployeeStatus_view IsNot Nothing Then tblEmployeeStatus_view.Dispose()
End Sub
End Class