home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
66.142.0.142
/
66.142.0.142.tar
/
66.142.0.142
/
ltgFixtureNoteview.aspx.vb
< prev
next >
Wrap
Text File
|
2014-01-25
|
18KB
|
600 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 ltgFixtureNoteview
Inherits AspNetMaker7_tfpssnet
' Page object
Public ltgFixtureNote_view As cltgFixtureNote_view
'
' Page Class
'
Class cltgFixtureNote_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 ltgFixtureNote.UseTokenInUrl Then Url = Url & "t=" & ltgFixtureNote.TableVar & "&" ' Add page token
Return Url
End Get
End Property
' Validate page request
Public Function IsPageRequest() As Boolean
Dim Result As Boolean
If ltgFixtureNote.UseTokenInUrl Then
Result = False
If ObjForm IsNot Nothing Then
Result = (ltgFixtureNote.TableVar = ObjForm.GetValue("t"))
End If
If ew_Get("t") <> "" Then
Result = (ltgFixtureNote.TableVar = ew_Get("t"))
End If
Return Result
End If
Return True
End Function
' ltgFixtureNote
Public Property ltgFixtureNote() As cltgFixtureNote
Get
Return ParentPage.ltgFixtureNote
End Get
Set(ByVal v As cltgFixtureNote)
ParentPage.ltgFixtureNote = v
End Set
End Property
' ltgFixtureNote
Public Property tblEmployees() As ctblEmployees
Get
Return ParentPage.tblEmployees
End Get
Set(ByVal v As ctblEmployees)
ParentPage.tblEmployees = v
End Set
End Property
' ltgFixtureNote
Public Property ltgFixtureMaster() As cltgFixtureMaster
Get
Return ParentPage.ltgFixtureMaster
End Get
Set(ByVal v As cltgFixtureMaster)
ParentPage.ltgFixtureMaster = 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 = "ltgFixtureNote_view"
m_PageObjTypeName = "cltgFixtureNote_view"
' Table Name
m_TableName = "ltgFixtureNote"
' Initialize table object
ltgFixtureNote = New cltgFixtureNote(Me)
tblEmployees = New ctblEmployees(Me)
ltgFixtureMaster = New cltgFixtureMaster(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("ltgFixtureNotelist.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
ltgFixtureNote.Dispose()
tblEmployees.Dispose()
ltgFixtureMaster.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("notID") <> "" Then
ltgFixtureNote.notID.QueryStringValue = ew_Get("notID")
Else
sReturnUrl = "ltgFixtureNotelist.aspx" ' Return to list
End If
' Get action
ltgFixtureNote.CurrentAction = "I" ' Display form
Select Case ltgFixtureNote.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 = "ltgFixtureNotelist.aspx" ' No matching record, return to list
End If
End Select
Else
sReturnUrl = "ltgFixtureNotelist.aspx" ' Not page request, return to list
End If
If sReturnUrl <> "" Then Page_Terminate(sReturnUrl)
' Render row
ltgFixtureNote.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))
ltgFixtureNote.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
ltgFixtureNote.StartRecordNumber = lStartRec
End If
End If
lStartRec = ltgFixtureNote.StartRecordNumber
' Check if correct start record counter
If lStartRec <= 0 Then ' Avoid invalid start record counter
lStartRec = 1 ' Reset start record counter
ltgFixtureNote.StartRecordNumber = lStartRec
ElseIf lStartRec > lTotalRecs Then ' Avoid starting record > total records
lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
ltgFixtureNote.StartRecordNumber = lStartRec
ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
ltgFixtureNote.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 = ltgFixtureNote.KeyFilter
' Row Selecting event
ltgFixtureNote.Row_Selecting(sFilter)
' Load SQL based on filter
ltgFixtureNote.CurrentFilter = sFilter
Dim sSql As String = ltgFixtureNote.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
ltgFixtureNote.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)
ltgFixtureNote.notID.DbValue = RsRow("notID")
ltgFixtureNote.notFixID.DbValue = RsRow("notFixID")
ltgFixtureNote.notTypeID.DbValue = RsRow("notTypeID")
ltgFixtureNote.notDate.DbValue = RsRow("notDate")
ltgFixtureNote.notShortDesc.DbValue = RsRow("notShortDesc")
ltgFixtureNote.notNote.DbValue = RsRow("notNote")
ltgFixtureNote.notLPRStatusID.DbValue = RsRow("notLPRStatusID")
ltgFixtureNote.notPriority.DbValue = RsRow("notPriority")
ltgFixtureNote.notIsActive.DbValue = IIf(ew_ConvertToBool(RsRow("notIsActive")), "1", "0")
ltgFixtureNote.notCreatedBy.DbValue = RsRow("notCreatedBy")
ltgFixtureNote.notCreatedOn.DbValue = RsRow("notCreatedOn")
ltgFixtureNote.notModifiedBy.DbValue = RsRow("notModifiedBy")
ltgFixtureNote.notModifiedOn.DbValue = RsRow("notModifiedOn")
End Sub
'
' Render row values based on field settings
'
Sub RenderRow()
' Row Rendering event
ltgFixtureNote.Row_Rendering()
'
' Common render codes for all row types
'
' notFixID
ltgFixtureNote.notFixID.CellCssStyle = ""
ltgFixtureNote.notFixID.CellCssClass = ""
' notTypeID
ltgFixtureNote.notTypeID.CellCssStyle = ""
ltgFixtureNote.notTypeID.CellCssClass = ""
' notDate
ltgFixtureNote.notDate.CellCssStyle = ""
ltgFixtureNote.notDate.CellCssClass = ""
' notShortDesc
ltgFixtureNote.notShortDesc.CellCssStyle = ""
ltgFixtureNote.notShortDesc.CellCssClass = ""
' notNote
ltgFixtureNote.notNote.CellCssStyle = ""
ltgFixtureNote.notNote.CellCssClass = ""
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.CellCssStyle = ""
ltgFixtureNote.notLPRStatusID.CellCssClass = ""
' notPriority
ltgFixtureNote.notPriority.CellCssStyle = ""
ltgFixtureNote.notPriority.CellCssClass = ""
' notIsActive
ltgFixtureNote.notIsActive.CellCssStyle = ""
ltgFixtureNote.notIsActive.CellCssClass = ""
' notCreatedBy
ltgFixtureNote.notCreatedBy.CellCssStyle = ""
ltgFixtureNote.notCreatedBy.CellCssClass = ""
' notCreatedOn
ltgFixtureNote.notCreatedOn.CellCssStyle = ""
ltgFixtureNote.notCreatedOn.CellCssClass = ""
' notModifiedBy
ltgFixtureNote.notModifiedBy.CellCssStyle = ""
ltgFixtureNote.notModifiedBy.CellCssClass = ""
' notModifiedOn
ltgFixtureNote.notModifiedOn.CellCssStyle = ""
ltgFixtureNote.notModifiedOn.CellCssClass = ""
'
' View Row
'
If ltgFixtureNote.RowType = EW_ROWTYPE_VIEW Then ' View row
' notID
ltgFixtureNote.notID.ViewValue = ltgFixtureNote.notID.CurrentValue
ltgFixtureNote.notID.CssStyle = ""
ltgFixtureNote.notID.CssClass = ""
ltgFixtureNote.notID.ViewCustomAttributes = ""
' notFixID
ltgFixtureNote.notFixID.ViewValue = ltgFixtureNote.notFixID.CurrentValue
ltgFixtureNote.notFixID.CssStyle = ""
ltgFixtureNote.notFixID.CssClass = ""
ltgFixtureNote.notFixID.ViewCustomAttributes = ""
' notTypeID
If ew_NotEmpty(ltgFixtureNote.notTypeID.CurrentValue) Then
sSqlWrk = "SELECT [ntyDescription] FROM [ltgFixtureNoteType] WHERE [ntyID] = " & ew_AdjustSql(ltgFixtureNote.notTypeID.CurrentValue) & ""
sSqlWrk = sSqlWrk & " AND (" & "[ntyIsActive]=True" & ")"
sSqlWrk = sSqlWrk & " ORDER BY [ntyDescription] "
RsWrk = Conn.GetTempDataReader(sSqlWrk)
If RsWrk.Read() Then
ltgFixtureNote.notTypeID.ViewValue = RsWrk("ntyDescription")
Else
ltgFixtureNote.notTypeID.ViewValue = ltgFixtureNote.notTypeID.CurrentValue
End If
Conn.CloseTempDataReader()
Else
ltgFixtureNote.notTypeID.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notTypeID.CssStyle = ""
ltgFixtureNote.notTypeID.CssClass = ""
ltgFixtureNote.notTypeID.ViewCustomAttributes = ""
' notDate
ltgFixtureNote.notDate.ViewValue = ltgFixtureNote.notDate.CurrentValue
ltgFixtureNote.notDate.ViewValue = ew_FormatDateTime(ltgFixtureNote.notDate.ViewValue, 6)
ltgFixtureNote.notDate.CssStyle = ""
ltgFixtureNote.notDate.CssClass = ""
ltgFixtureNote.notDate.ViewCustomAttributes = ""
' notShortDesc
ltgFixtureNote.notShortDesc.ViewValue = ltgFixtureNote.notShortDesc.CurrentValue
ltgFixtureNote.notShortDesc.CssStyle = ""
ltgFixtureNote.notShortDesc.CssClass = ""
ltgFixtureNote.notShortDesc.ViewCustomAttributes = ""
' notNote
ltgFixtureNote.notNote.ViewValue = ltgFixtureNote.notNote.CurrentValue
ltgFixtureNote.notNote.CssStyle = ""
ltgFixtureNote.notNote.CssClass = ""
ltgFixtureNote.notNote.ViewCustomAttributes = ""
' notLPRStatusID
If ew_NotEmpty(ltgFixtureNote.notLPRStatusID.CurrentValue) Then
sSqlWrk = "SELECT [lstDescription] FROM [tblLPRStatus] WHERE [lstID] = " & ew_AdjustSql(ltgFixtureNote.notLPRStatusID.CurrentValue) & ""
sSqlWrk = sSqlWrk & " AND (" & "[lstIsActive]=True" & ")"
sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
RsWrk = Conn.GetTempDataReader(sSqlWrk)
If RsWrk.Read() Then
ltgFixtureNote.notLPRStatusID.ViewValue = RsWrk("lstDescription")
Else
ltgFixtureNote.notLPRStatusID.ViewValue = ltgFixtureNote.notLPRStatusID.CurrentValue
End If
Conn.CloseTempDataReader()
Else
ltgFixtureNote.notLPRStatusID.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notLPRStatusID.CssStyle = ""
ltgFixtureNote.notLPRStatusID.CssClass = ""
ltgFixtureNote.notLPRStatusID.ViewCustomAttributes = ""
' notPriority
If Not IsDBNull(ltgFixtureNote.notPriority.CurrentValue) Then
Select Case ltgFixtureNote.notPriority.CurrentValue
Case "1"
ltgFixtureNote.notPriority.ViewValue = "High"
Case "2"
ltgFixtureNote.notPriority.ViewValue = "Medium"
Case "3"
ltgFixtureNote.notPriority.ViewValue = "Low"
Case Else
ltgFixtureNote.notPriority.ViewValue = ltgFixtureNote.notPriority.CurrentValue
End Select
Else
ltgFixtureNote.notPriority.ViewValue = System.DBNull.Value
End If
ltgFixtureNote.notPriority.CssStyle = ""
ltgFixtureNote.notPriority.CssClass = ""
ltgFixtureNote.notPriority.ViewCustomAttributes = ""
' notIsActive
If Convert.ToString(ltgFixtureNote.notIsActive.CurrentValue) = "1" Then
ltgFixtureNote.notIsActive.ViewValue = "Yes"
Else
ltgFixtureNote.notIsActive.ViewValue = "No"
End If
ltgFixtureNote.notIsActive.CssStyle = ""
ltgFixtureNote.notIsActive.CssClass = ""
ltgFixtureNote.notIsActive.ViewCustomAttributes = ""
' notCreatedBy
ltgFixtureNote.notCreatedBy.ViewValue = ltgFixtureNote.notCreatedBy.CurrentValue
ltgFixtureNote.notCreatedBy.CssStyle = ""
ltgFixtureNote.notCreatedBy.CssClass = ""
ltgFixtureNote.notCreatedBy.ViewCustomAttributes = ""
' notCreatedOn
ltgFixtureNote.notCreatedOn.ViewValue = ltgFixtureNote.notCreatedOn.CurrentValue
ltgFixtureNote.notCreatedOn.ViewValue = ew_FormatDateTime(ltgFixtureNote.notCreatedOn.ViewValue, 6)
ltgFixtureNote.notCreatedOn.CssStyle = ""
ltgFixtureNote.notCreatedOn.CssClass = ""
ltgFixtureNote.notCreatedOn.ViewCustomAttributes = ""
' notModifiedBy
ltgFixtureNote.notModifiedBy.ViewValue = ltgFixtureNote.notModifiedBy.CurrentValue
ltgFixtureNote.notModifiedBy.CssStyle = ""
ltgFixtureNote.notModifiedBy.CssClass = ""
ltgFixtureNote.notModifiedBy.ViewCustomAttributes = ""
' notModifiedOn
ltgFixtureNote.notModifiedOn.ViewValue = ltgFixtureNote.notModifiedOn.CurrentValue
ltgFixtureNote.notModifiedOn.ViewValue = ew_FormatDateTime(ltgFixtureNote.notModifiedOn.ViewValue, 6)
ltgFixtureNote.notModifiedOn.CssStyle = ""
ltgFixtureNote.notModifiedOn.CssClass = ""
ltgFixtureNote.notModifiedOn.ViewCustomAttributes = ""
' View refer script
' notFixID
ltgFixtureNote.notFixID.HrefValue = ""
' notTypeID
ltgFixtureNote.notTypeID.HrefValue = ""
' notDate
ltgFixtureNote.notDate.HrefValue = ""
' notShortDesc
ltgFixtureNote.notShortDesc.HrefValue = ""
' notNote
ltgFixtureNote.notNote.HrefValue = ""
' notLPRStatusID
ltgFixtureNote.notLPRStatusID.HrefValue = ""
' notPriority
ltgFixtureNote.notPriority.HrefValue = ""
' notIsActive
ltgFixtureNote.notIsActive.HrefValue = ""
' notCreatedBy
ltgFixtureNote.notCreatedBy.HrefValue = ""
' notCreatedOn
ltgFixtureNote.notCreatedOn.HrefValue = ""
' notModifiedBy
ltgFixtureNote.notModifiedBy.HrefValue = ""
' notModifiedOn
ltgFixtureNote.notModifiedOn.HrefValue = ""
End If
' Row Rendered event
ltgFixtureNote.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
ltgFixtureNote_view = New cltgFixtureNote_view(Me)
ltgFixtureNote_view.Page_Init()
' Page main processing
ltgFixtureNote_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 ltgFixtureNote_view IsNot Nothing Then ltgFixtureNote_view.Dispose()
End Sub
End Class