home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
66.142.0.142
/
66.142.0.142.tar
/
66.142.0.142
/
tblFixtureMasterview.aspx.vb
< prev
next >
Wrap
Text File
|
2010-08-24
|
14KB
|
493 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 tblFixtureMasterview
Inherits AspNetMaker7_tfpssnet
' Page object
Public tblFixtureMaster_view As ctblFixtureMaster_view
'
' Page Class
'
Class ctblFixtureMaster_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 tblFixtureMaster.UseTokenInUrl Then Url = Url & "t=" & tblFixtureMaster.TableVar & "&" ' Add page token
Return Url
End Get
End Property
' Validate page request
Public Function IsPageRequest() As Boolean
Dim Result As Boolean
If tblFixtureMaster.UseTokenInUrl Then
Result = False
If ObjForm IsNot Nothing Then
Result = (tblFixtureMaster.TableVar = ObjForm.GetValue("t"))
End If
If ew_Get("t") <> "" Then
Result = (tblFixtureMaster.TableVar = ew_Get("t"))
End If
Return Result
End If
Return True
End Function
' tblFixtureMaster
Public Property tblFixtureMaster() As ctblFixtureMaster
Get
Return ParentPage.tblFixtureMaster
End Get
Set(ByVal v As ctblFixtureMaster)
ParentPage.tblFixtureMaster = v
End Set
End Property
' tblFixtureMaster
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 = "tblFixtureMaster_view"
m_PageObjTypeName = "ctblFixtureMaster_view"
' Table Name
m_TableName = "tblFixtureMaster"
' Initialize table object
tblFixtureMaster = New ctblFixtureMaster(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("tblFixtureMasterlist.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
tblFixtureMaster.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("lfxID") <> "" Then
tblFixtureMaster.lfxID.QueryStringValue = ew_Get("lfxID")
Else
sReturnUrl = "tblFixtureMasterlist.aspx" ' Return to list
End If
' Get action
tblFixtureMaster.CurrentAction = "I" ' Display form
Select Case tblFixtureMaster.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 = "tblFixtureMasterlist.aspx" ' No matching record, return to list
End If
End Select
Else
sReturnUrl = "tblFixtureMasterlist.aspx" ' Not page request, return to list
End If
If sReturnUrl <> "" Then Page_Terminate(sReturnUrl)
' Render row
tblFixtureMaster.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))
tblFixtureMaster.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
tblFixtureMaster.StartRecordNumber = lStartRec
End If
End If
lStartRec = tblFixtureMaster.StartRecordNumber
' Check if correct start record counter
If lStartRec <= 0 Then ' Avoid invalid start record counter
lStartRec = 1 ' Reset start record counter
tblFixtureMaster.StartRecordNumber = lStartRec
ElseIf lStartRec > lTotalRecs Then ' Avoid starting record > total records
lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
tblFixtureMaster.StartRecordNumber = lStartRec
ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
tblFixtureMaster.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 = tblFixtureMaster.KeyFilter
' Row Selecting event
tblFixtureMaster.Row_Selecting(sFilter)
' Load SQL based on filter
tblFixtureMaster.CurrentFilter = sFilter
Dim sSql As String = tblFixtureMaster.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
tblFixtureMaster.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)
tblFixtureMaster.lfxID.DbValue = RsRow("lfxID")
tblFixtureMaster.lfxMFG.DbValue = RsRow("lfxMFG")
tblFixtureMaster.lfxModelType.DbValue = RsRow("lfxModelType")
tblFixtureMaster.lfxSerialNumber.DbValue = RsRow("lfxSerialNumber")
tblFixtureMaster.lfxLamp.DbValue = RsRow("lfxLamp")
tblFixtureMaster.lfxLocationID.DbValue = RsRow("lfxLocationID")
tblFixtureMaster.lfxHangPos.DbValue = RsRow("lfxHangPos")
tblFixtureMaster.lfxChannel.DbValue = RsRow("lfxChannel")
tblFixtureMaster.lfxNotes.DbValue = RsRow("lfxNotes")
End Sub
'
' Render row values based on field settings
'
Sub RenderRow()
' Row Rendering event
tblFixtureMaster.Row_Rendering()
'
' Common render codes for all row types
'
' lfxMFG
tblFixtureMaster.lfxMFG.CellCssStyle = ""
tblFixtureMaster.lfxMFG.CellCssClass = ""
' lfxModelType
tblFixtureMaster.lfxModelType.CellCssStyle = ""
tblFixtureMaster.lfxModelType.CellCssClass = ""
' lfxSerialNumber
tblFixtureMaster.lfxSerialNumber.CellCssStyle = ""
tblFixtureMaster.lfxSerialNumber.CellCssClass = ""
' lfxLamp
tblFixtureMaster.lfxLamp.CellCssStyle = ""
tblFixtureMaster.lfxLamp.CellCssClass = ""
' lfxLocationID
tblFixtureMaster.lfxLocationID.CellCssStyle = ""
tblFixtureMaster.lfxLocationID.CellCssClass = ""
' lfxHangPos
tblFixtureMaster.lfxHangPos.CellCssStyle = ""
tblFixtureMaster.lfxHangPos.CellCssClass = ""
' lfxChannel
tblFixtureMaster.lfxChannel.CellCssStyle = ""
tblFixtureMaster.lfxChannel.CellCssClass = ""
' lfxNotes
tblFixtureMaster.lfxNotes.CellCssStyle = ""
tblFixtureMaster.lfxNotes.CellCssClass = ""
'
' View Row
'
If tblFixtureMaster.RowType = EW_ROWTYPE_VIEW Then ' View row
' lfxMFG
tblFixtureMaster.lfxMFG.ViewValue = tblFixtureMaster.lfxMFG.CurrentValue
tblFixtureMaster.lfxMFG.CssStyle = ""
tblFixtureMaster.lfxMFG.CssClass = ""
tblFixtureMaster.lfxMFG.ViewCustomAttributes = ""
' lfxModelType
tblFixtureMaster.lfxModelType.ViewValue = tblFixtureMaster.lfxModelType.CurrentValue
tblFixtureMaster.lfxModelType.CssStyle = ""
tblFixtureMaster.lfxModelType.CssClass = ""
tblFixtureMaster.lfxModelType.ViewCustomAttributes = ""
' lfxSerialNumber
tblFixtureMaster.lfxSerialNumber.ViewValue = tblFixtureMaster.lfxSerialNumber.CurrentValue
tblFixtureMaster.lfxSerialNumber.CssStyle = ""
tblFixtureMaster.lfxSerialNumber.CssClass = ""
tblFixtureMaster.lfxSerialNumber.ViewCustomAttributes = ""
' lfxLamp
tblFixtureMaster.lfxLamp.ViewValue = tblFixtureMaster.lfxLamp.CurrentValue
tblFixtureMaster.lfxLamp.CssStyle = ""
tblFixtureMaster.lfxLamp.CssClass = ""
tblFixtureMaster.lfxLamp.ViewCustomAttributes = ""
' lfxLocationID
If ew_NotEmpty(tblFixtureMaster.lfxLocationID.CurrentValue) Then
sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(tblFixtureMaster.lfxLocationID.CurrentValue) & ""
sSqlWrk = sSqlWrk & " AND (" & "[locLighting]=True" & ")"
sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
RsWrk = Conn.GetTempDataReader(sSqlWrk)
If RsWrk.Read() Then
tblFixtureMaster.lfxLocationID.ViewValue = RsWrk("locDescription")
Else
tblFixtureMaster.lfxLocationID.ViewValue = tblFixtureMaster.lfxLocationID.CurrentValue
End If
Conn.CloseTempDataReader()
Else
tblFixtureMaster.lfxLocationID.ViewValue = System.DBNull.Value
End If
tblFixtureMaster.lfxLocationID.CssStyle = ""
tblFixtureMaster.lfxLocationID.CssClass = ""
tblFixtureMaster.lfxLocationID.ViewCustomAttributes = ""
' lfxHangPos
tblFixtureMaster.lfxHangPos.ViewValue = tblFixtureMaster.lfxHangPos.CurrentValue
tblFixtureMaster.lfxHangPos.CssStyle = ""
tblFixtureMaster.lfxHangPos.CssClass = ""
tblFixtureMaster.lfxHangPos.ViewCustomAttributes = ""
' lfxChannel
tblFixtureMaster.lfxChannel.ViewValue = tblFixtureMaster.lfxChannel.CurrentValue
tblFixtureMaster.lfxChannel.CssStyle = ""
tblFixtureMaster.lfxChannel.CssClass = ""
tblFixtureMaster.lfxChannel.ViewCustomAttributes = ""
' lfxNotes
tblFixtureMaster.lfxNotes.ViewValue = tblFixtureMaster.lfxNotes.CurrentValue
tblFixtureMaster.lfxNotes.CssStyle = ""
tblFixtureMaster.lfxNotes.CssClass = ""
tblFixtureMaster.lfxNotes.ViewCustomAttributes = ""
' View refer script
' lfxMFG
tblFixtureMaster.lfxMFG.HrefValue = ""
' lfxModelType
tblFixtureMaster.lfxModelType.HrefValue = ""
' lfxSerialNumber
tblFixtureMaster.lfxSerialNumber.HrefValue = ""
' lfxLamp
tblFixtureMaster.lfxLamp.HrefValue = ""
' lfxLocationID
tblFixtureMaster.lfxLocationID.HrefValue = ""
' lfxHangPos
tblFixtureMaster.lfxHangPos.HrefValue = ""
' lfxChannel
tblFixtureMaster.lfxChannel.HrefValue = ""
' lfxNotes
tblFixtureMaster.lfxNotes.HrefValue = ""
End If
' Row Rendered event
tblFixtureMaster.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
tblFixtureMaster_view = New ctblFixtureMaster_view(Me)
tblFixtureMaster_view.Page_Init()
' Page main processing
tblFixtureMaster_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 tblFixtureMaster_view IsNot Nothing Then tblFixtureMaster_view.Dispose()
End Sub
End Class