home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblLPRlist.aspx.vb < prev    next >
Text File  |  2010-09-12  |  48KB  |  1,365 lines

  1. Imports System.Data
  2. Imports System.Data.Common
  3. Imports System.Xml
  4. Imports System.IO
  5. Imports System.Data.OleDb
  6.  
  7. '
  8. ' ASP.NET code-behind class (Page)
  9. '
  10.  
  11. Partial Class tblLPRlist
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblLPR_list As ctblLPR_list
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblLPR_list
  21.         Inherits AspNetMakerPage
  22.         Implements IDisposable        
  23.  
  24.         ' Used by system generated functions
  25.         Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
  26.  
  27.         Private arwrk As Object
  28.  
  29.         Private armultiwrk() As String        
  30.  
  31.         ' Page URL
  32.         Public ReadOnly Property PageUrl() As String
  33.             Get
  34.                 Dim Url As String = ew_CurrentPage() & "?"
  35.                 If tblLPR.UseTokenInUrl Then Url = Url & "t=" & tblLPR.TableVar & "&" ' Add page token
  36.                 Return Url    
  37.             End Get
  38.         End Property
  39.  
  40.         ' Validate page request
  41.         Public Function IsPageRequest() As Boolean
  42.             Dim Result As Boolean
  43.             If tblLPR.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (tblLPR.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (tblLPR.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' tblLPR
  57.         Public Property tblLPR() As ctblLPR
  58.             Get                
  59.                 Return ParentPage.tblLPR
  60.             End Get
  61.             Set(ByVal v As ctblLPR)
  62.                 ParentPage.tblLPR = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' tblLPR
  67.         Public Property tblEmployees() As ctblEmployees
  68.             Get                
  69.                 Return ParentPage.tblEmployees
  70.             End Get
  71.             Set(ByVal v As ctblEmployees)
  72.                 ParentPage.tblEmployees = v    
  73.             End Set    
  74.         End Property
  75.  
  76.         '
  77.         '  Constructor
  78.         '  - init objects
  79.         '  - open connection
  80.         '
  81.         Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)                
  82.             m_ParentPage = APage
  83.             m_Page = Me    
  84.             m_PageID = "list"
  85.             m_PageObjName = "tblLPR_list"
  86.             m_PageObjTypeName = "ctblLPR_list"
  87.  
  88.             ' Table Name
  89.             m_TableName = "tblLPR"
  90.  
  91.             ' Initialize table object
  92.             tblLPR = New ctblLPR(Me)
  93.             tblEmployees = New ctblEmployees(Me)
  94.  
  95.             ' Connect to database
  96.             Conn = New cConnection()
  97.  
  98.             ' Initialize list options
  99.             ListOptions = New cListOptions
  100.         End Sub
  101.  
  102.         '
  103.         '  Subroutine Page_Init
  104.         '  - called before page main
  105.         '  - check Security
  106.         '  - set up response header
  107.         '  - call page load events
  108.         '
  109.         Public Sub Page_Init()
  110.             Security = New cAdvancedSecurity(Me)
  111.             If Not Security.IsLoggedIn() Then Security.AutoLogin()
  112.             If Not Security.IsLoggedIn() Then
  113.                 Security.SaveLastUrl()
  114.                 Page_Terminate("login.aspx")
  115.             End If
  116.  
  117.             ' Table Permission loading event
  118.             Security.TablePermission_Loading()
  119.             Security.LoadCurrentUserLevel(TableName)
  120.  
  121.             ' Table Permission loaded event
  122.             Security.TablePermission_Loaded()
  123.             If Not Security.CanList Then
  124.                 Security.SaveLastUrl()
  125.                 Page_Terminate("login.aspx")
  126.             End If
  127.  
  128.             ' User ID loading event
  129.             Security.UserID_Loading()
  130.             If Security.IsLoggedIn() Then Call Security.LoadUserID()
  131.  
  132.             ' User ID loaded event
  133.             Security.UserID_Loaded()
  134.             If Security.IsLoggedIn() And ew_Empty(Security.CurrentUserID) Then
  135.                 Message = "You do not have the right permission to view the page"
  136.                 Page_Terminate("")
  137.             End If
  138.             tblLPR.Export = ew_Get("export") ' Get export parameter
  139.             ParentPage.gsExport = tblLPR.Export ' Get export parameter, used in header
  140.             ParentPage.gsExportFile = tblLPR.TableVar ' Get export file, used in header
  141.  
  142.             ' Global page loading event (in ewglobal*.vb)
  143.             ParentPage.Page_Loading()
  144.  
  145.             ' Page load event, used in current page
  146.             Page_Load()
  147.         End Sub
  148.  
  149.         '
  150.         '  Class terminate
  151.         '  - clean up page object
  152.         '
  153.         Public Sub Dispose() Implements IDisposable.Dispose
  154.             Page_Terminate("")
  155.         End Sub
  156.  
  157.         '
  158.         '  Sub Page_Terminate
  159.         '  - called when exit page
  160.         '  - clean up connection and objects
  161.         '  - if URL specified, redirect to URL
  162.         '
  163.         Sub Page_Terminate(url As String)
  164.  
  165.             ' Page unload event, used in current page
  166.             Page_Unload()
  167.  
  168.             ' Global page unloaded event (in ewglobal*.vb)
  169.             ParentPage.Page_Unloaded()
  170.  
  171.             ' Close connection
  172.             Conn.Dispose()
  173.             Security = Nothing
  174.             tblLPR.Dispose()
  175.             tblEmployees.Dispose()
  176.             ListOptions = Nothing
  177.  
  178.             ' Go to URL if specified
  179.             If url <> "" Then
  180.                 HttpContext.Current.Response.Clear()
  181.                 HttpContext.Current.Response.Redirect(url)
  182.             End If
  183.         End Sub
  184.  
  185.     Public lDisplayRecs As Integer ' Number of display records
  186.  
  187.     Public lStartRec As Integer, lStopRec As Integer, lTotalRecs As Integer, lRecRange As Integer
  188.  
  189.     Public sSrchWhere As String
  190.  
  191.     Public lRecCnt As Integer
  192.  
  193.     Public lEditRowCnt As Integer
  194.  
  195.     Public lRowCnt As Integer, lRowIndex As Integer
  196.  
  197.     Public lOptionCnt As Integer
  198.  
  199.     Public lRecPerRow As Integer, lColCnt As Integer
  200.  
  201.     Public sDeleteConfirmMsg As String ' Delete confirm message
  202.  
  203.     Public sDbMasterFilter As String, sDbDetailFilter As String
  204.  
  205.     Public bMasterRecordExists As Boolean
  206.  
  207.     Public ListOptions As Object
  208.  
  209.     Public sMultiSelectKey As String
  210.  
  211.     Public x_ewPriv As Integer
  212.  
  213.     '
  214.     ' Page main processing
  215.     '
  216.     Public Sub Page_Main()
  217.         lDisplayRecs = 20
  218.         lRecRange = EW_PAGER_RANGE
  219.         lRecCnt = 0 ' Record count
  220.  
  221.         ' Search filters        
  222.         Dim sSrchAdvanced As String = "" ' Advanced search filter
  223.         Dim sSrchBasic As String = "" ' Basic search filter
  224.         Dim sFilter As String = ""
  225.         sSrchWhere = "" ' Search WHERE clause        
  226.  
  227.         ' Master/Detail
  228.         sDbMasterFilter = "" ' Master filter
  229.         sDbDetailFilter = "" ' Detail filter
  230.         If IsPageRequest Then ' Validate request
  231.  
  232.             ' Set up records per page dynamically
  233.             SetUpDisplayRecs()
  234.  
  235.             ' Handle reset command
  236.             ResetCmd()
  237.  
  238.             ' Get advanced search criteria
  239.             LoadSearchValues()
  240.             If ValidateSearch() Then
  241.                     sSrchAdvanced = AdvancedSearchWhere()
  242.                 Else
  243.                     Message = ParentPage.gsSearchError
  244.                 End If
  245.  
  246.                 ' Get basic search criteria
  247.                 If ParentPage.gsSearchError = "" Then
  248.                     sSrchBasic = BasicSearchWhere()
  249.                 End If
  250.  
  251.                 ' Set Up Sorting Order
  252.                 SetUpSortOrder()
  253.             End If
  254.  
  255.             ' Restore display records
  256.             If (tblLPR.RecordsPerPage = -1 OrElse tblLPR.RecordsPerPage > 0) Then
  257.                 lDisplayRecs = tblLPR.RecordsPerPage ' Restore from Session
  258.             Else
  259.                 lDisplayRecs = 20 ' Load default
  260.             End If
  261.  
  262.             ' Load Sorting Order
  263.             LoadSortOrder()
  264.  
  265.             ' Build search criteria
  266.             If sSrchAdvanced <> "" Then
  267.                 If sSrchWhere <> "" Then
  268.                     sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchAdvanced & ")"
  269.                 Else
  270.                     sSrchWhere = sSrchAdvanced
  271.                 End If
  272.             End If
  273.             If sSrchBasic <> "" Then
  274.                 If sSrchWhere <> "" Then
  275.                     sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchBasic & ")"
  276.                 Else
  277.                     sSrchWhere = sSrchBasic
  278.                 End If
  279.             End If
  280.  
  281.             ' Recordset Searching event
  282.             tblLPR.Recordset_Searching(sSrchWhere)
  283.  
  284.             ' Save search criteria
  285.             If sSrchWhere <> "" Then
  286.                 If sSrchBasic = "" Then ResetBasicSearchParms()
  287.                 If sSrchAdvanced = "" Then ResetAdvancedSearchParms()
  288.                 tblLPR.SearchWhere = sSrchWhere ' Save to Session
  289.                 lStartRec = 1 ' Reset start record counter
  290.                 tblLPR.StartRecordNumber = lStartRec
  291.             Else
  292.                 RestoreSearchParms()
  293.             End If
  294.  
  295.             ' Build filter
  296.             sFilter = ""
  297.             If Not Security.CanList Then
  298.                 sFilter = "(0=1)" ' Filter all records
  299.             End If
  300.             If sDbDetailFilter <> "" Then
  301.                 If sFilter <> "" Then
  302.                     sFilter = "(" & sFilter & ") AND (" & sDbDetailFilter & ")"
  303.                 Else
  304.                     sFilter = sDbDetailFilter
  305.                 End If
  306.             End If
  307.             If sSrchWhere <> "" Then
  308.                 If sFilter <> "" Then
  309.                     sFilter = "(" & sFilter & ") AND (" & sSrchWhere & ")"
  310.                 Else
  311.                     sFilter = sSrchWhere
  312.                 End If
  313.             End If
  314.  
  315.             ' Set up filter in Session
  316.             tblLPR.SessionWhere = sFilter
  317.             tblLPR.CurrentFilter = ""
  318.     End Sub
  319.  
  320.     '
  321.     ' Set up number of records displayed per page
  322.     '
  323.     Sub SetUpDisplayRecs()
  324.         Dim sWrk As String
  325.         sWrk = ew_Get(EW_TABLE_REC_PER_PAGE)
  326.         If sWrk <> "" Then
  327.             If IsNumeric(sWrk) Then
  328.                 lDisplayRecs = ew_ConvertToInt(sWrk)
  329.             Else
  330.                 If ew_SameText(sWrk, "all") Then ' Display all records
  331.                     lDisplayRecs = -1
  332.                 Else
  333.                     lDisplayRecs = 20 ' Non-numeric, load default
  334.                 End If
  335.             End If
  336.             tblLPR.RecordsPerPage = lDisplayRecs ' Save to Session
  337.  
  338.             ' Reset start position
  339.             lStartRec = 1
  340.             tblLPR.StartRecordNumber = lStartRec
  341.         End If
  342.     End Sub
  343.  
  344.     '
  345.     ' Return Advanced Search WHERE based on QueryString parameters
  346.     '
  347.     Function AdvancedSearchWhere() As String        
  348.         If Not Security.CanSearch Then Return ""
  349.         Dim sWhere As String = ""
  350.             If ew_Session("tfpssnet_Status_UserLevel") <> 3 Then
  351.                 BuildSearchSql(sWhere, tblLPR.lprEmpID, False) ' lprEmpID
  352.             End If
  353.             BuildSearchSql(sWhere, tblLPR.lprDate, False) ' lprDate
  354.             BuildSearchSql(sWhere, tblLPR.lprLocationID, False) ' lprLocationID
  355.             BuildSearchSql(sWhere, tblLPR.lprFixtureLocationID, False) ' lprFixtureLocationID
  356.             BuildSearchSql(sWhere, tblLPR.lprFixtureTypeID, False) ' lprFixtureTypeID
  357.             BuildSearchSql(sWhere, tblLPR.lprFixtureNumber, False) ' lprFixtureNumber
  358.             BuildSearchSql(sWhere, tblLPR.lprChannelNumber, False) ' lprChannelNumber
  359.             BuildSearchSql(sWhere, tblLPR.lprPriority, False) ' lprPriority
  360.             BuildSearchSql(sWhere, tblLPR.lprShortDesc, False) ' lprShortDesc
  361.             BuildSearchSql(sWhere, tblLPR.lprSTID, False) ' lprSTID
  362.             BuildSearchSql(sWhere, tblLPR.lprSTChangedBy, False) ' lprSTChangedBy
  363.             BuildSearchSql(sWhere, tblLPR.lprDesc, False) ' lprDesc
  364.             BuildSearchSql(sWhere, tblLPR.lprCreatedBy, False) ' lprCreatedBy
  365.             BuildSearchSql(sWhere, tblLPR.lprCreatedOn, False) ' lprCreatedOn
  366.             BuildSearchSql(sWhere, tblLPR.lprModifiedBy, False) ' lprModifiedBy
  367.             BuildSearchSql(sWhere, tblLPR.lprModifiedOn, False) ' lprModifiedOn
  368.  
  369.             ' Set up search parm
  370.             If sWhere <> "" Then
  371.                 SetSearchParm(tblLPR.lprEmpID) ' lprEmpID
  372.                 SetSearchParm(tblLPR.lprDate) ' lprDate
  373.                 SetSearchParm(tblLPR.lprLocationID) ' lprLocationID
  374.                 SetSearchParm(tblLPR.lprFixtureLocationID) ' lprFixtureLocationID
  375.                 SetSearchParm(tblLPR.lprFixtureTypeID) ' lprFixtureTypeID
  376.                 SetSearchParm(tblLPR.lprFixtureNumber) ' lprFixtureNumber
  377.                 SetSearchParm(tblLPR.lprChannelNumber) ' lprChannelNumber
  378.                 SetSearchParm(tblLPR.lprPriority) ' lprPriority
  379.                 SetSearchParm(tblLPR.lprShortDesc) ' lprShortDesc
  380.                 SetSearchParm(tblLPR.lprSTID) ' lprSTID
  381.                 SetSearchParm(tblLPR.lprSTChangedBy) ' lprSTChangedBy
  382.                 SetSearchParm(tblLPR.lprDesc) ' lprDesc
  383.                 SetSearchParm(tblLPR.lprCreatedBy) ' lprCreatedBy
  384.                 SetSearchParm(tblLPR.lprCreatedOn) ' lprCreatedOn
  385.                 SetSearchParm(tblLPR.lprModifiedBy) ' lprModifiedBy
  386.                 SetSearchParm(tblLPR.lprModifiedOn) ' lprModifiedOn
  387.             End If
  388.             Return sWhere
  389.         End Function
  390.  
  391.     '
  392.     ' Build search SQL
  393.     '
  394.     Sub BuildSearchSql(ByRef Where As String, ByRef Fld As Object, MultiValue As Boolean)
  395.         Dim FldParm As String = Fld.FldVar.Substring(2)
  396.         Dim FldVal As String = Fld.AdvancedSearch.SearchValue
  397.         Dim FldOpr As String = Fld.AdvancedSearch.SearchOperator
  398.         Dim FldCond As String = Fld.AdvancedSearch.SearchCondition
  399.         Dim FldVal2 As String = Fld.AdvancedSearch.SearchValue2
  400.         Dim FldOpr2 As String = Fld.AdvancedSearch.SearchOperator2
  401.         Dim sWrk As String = ""
  402.         FldOpr = FldOpr.Trim().ToUpper()
  403.         If (FldOpr = "") Then FldOpr = "="
  404.         FldOpr2 = FldOpr2.Trim().ToUpper()
  405.         If FldOpr2 = "" Then FldOpr2 = "="
  406.         If EW_SEARCH_MULTI_VALUE_OPTION = 1 Then MultiValue = False
  407.         If FldOpr <> "LIKE" Then MultiValue = False
  408.         If FldOpr2 <> "LIKE" AndAlso FldVal2 <> "" Then MultiValue = False
  409.         If MultiValue Then
  410.             Dim sWrk1 As String, sWrk2 As String
  411.  
  412.             ' Field value 1
  413.             If FldVal <> "" Then
  414.                 sWrk1 = ew_GetMultiSearchSql(Fld, FldVal)
  415.             Else
  416.                 sWrk1 = ""
  417.             End If
  418.  
  419.             ' Field value 2
  420.             If FldVal2 <> "" AndAlso FldCond <> "" Then
  421.                 sWrk2 = ew_GetMultiSearchSql(Fld, FldVal2)
  422.             Else
  423.                 sWrk2 = ""
  424.             End If
  425.  
  426.             ' Build final SQL
  427.             sWrk = sWrk1
  428.             If sWrk2 <> "" Then
  429.                 If sWrk <> "" Then
  430.                     sWrk = "(" & sWrk & ") " & FldCond & " (" & sWrk2 & ")"
  431.                 Else
  432.                     sWrk = sWrk2
  433.                 End If
  434.             End If
  435.         Else
  436.             FldVal = ConvertSearchValue(Fld, FldVal)
  437.             FldVal2 = ConvertSearchValue(Fld, FldVal2)
  438.             sWrk = ew_GetSearchSql(Fld, FldVal, FldOpr, FldCond, FldVal2, FldOpr2)
  439.         End If
  440.         If sWrk <> "" Then
  441.             If Where <> "" Then Where = Where & " AND "
  442.             Where = Where & "(" & sWrk & ")"
  443.         End If
  444.     End Sub
  445.  
  446.     '
  447.     ' Set search parm
  448.     '
  449.     Sub SetSearchParm(ByRef Fld As Object)
  450.         Dim FldParm As String = Fld.FldVar.Substring(2)
  451.         tblLPR.SetAdvancedSearch("x_" & FldParm, Fld.AdvancedSearch.SearchValue)
  452.         tblLPR.SetAdvancedSearch("z_" & FldParm, Fld.AdvancedSearch.SearchOperator)
  453.         tblLPR.SetAdvancedSearch("v_" & FldParm, Fld.AdvancedSearch.SearchCondition)
  454.         tblLPR.SetAdvancedSearch("y_" & FldParm, Fld.AdvancedSearch.SearchValue2)
  455.         tblLPR.SetAdvancedSearch("w_" & FldParm, Fld.AdvancedSearch.SearchOperator2)
  456.     End Sub
  457.  
  458.     '
  459.     ' Convert search value
  460.     '
  461.     Function ConvertSearchValue(ByRef Fld As cField, FldVal As Object) As Object
  462.         If Fld.FldDataType = EW_DATATYPE_BOOLEAN Then
  463.             If ew_NotEmpty(FldVal) Then Return IIf(FldVal="1", "True", "False")
  464.         ElseIf Fld.FldDataType = EW_DATATYPE_DATE Then
  465.             If ew_NotEmpty(FldVal) Then Return ew_UnFormatDateTime(FldVal, Fld.FldDateTimeFormat)
  466.         End If
  467.         Return FldVal
  468.     End Function
  469.  
  470.     '
  471.     ' Return Basic Search SQL
  472.     '
  473.     Function BasicSearchSQL(Keyword As String) As String
  474.         Dim sKeyword As String, sSql As String = ""
  475.         sKeyword = ew_AdjustSql(Keyword)        
  476.         sSql = sSql & "[lprFixtureNumber] LIKE '%" & sKeyword & "%' OR "
  477.         If IsNumeric(sKeyword) Then sSql = sSql & "[lprChannelNumber] = " & sKeyword & " OR "
  478.         sSql = sSql & "[lprShortDesc] LIKE '%" & sKeyword & "%' OR "
  479.         sSql = sSql & "[lprDesc] LIKE '%" & sKeyword & "%' OR "
  480.         If sSql.EndsWith(" OR ") Then sSql = sSql.SubString(0, sSql.Length-4)
  481.         Return sSql
  482.     End Function
  483.  
  484.     '
  485.     ' Return Basic Search WHERE based on search keyword and type
  486.     '
  487.     Function BasicSearchWhere() As String
  488.         Dim sSearchStr As String = "", sSearchKeyword As String, sSearchType As String
  489.         Dim sSearch As String, arKeyword() As String, sKeyword As String
  490.         If Not Security.CanSearch Then Return ""
  491.         sSearchKeyword = ew_Get(EW_TABLE_BASIC_SEARCH)
  492.         sSearchType = ew_Get(EW_TABLE_BASIC_SEARCH_TYPE)
  493.         If sSearchKeyword <> "" Then
  494.             sSearch = sSearchKeyword.Trim()
  495.             If sSearchType <> "" Then
  496.                 While InStr(sSearch, "  ") > 0
  497.                     sSearch = sSearch.Replace("  ", " ")
  498.                 End While
  499.                 arKeyword = sSearch.Trim().Split(New Char() {" "c})
  500.                 For Each sKeyword In arKeyword
  501.                     If sSearchStr <> "" Then sSearchStr = sSearchStr & " " & sSearchType & " "
  502.                     sSearchStr = sSearchStr & "(" & BasicSearchSQL(sKeyword) & ")"
  503.                 Next
  504.             Else
  505.                 sSearchStr = BasicSearchSQL(sSearch)
  506.             End If
  507.         End If
  508.         If sSearchKeyword <> "" then
  509.             tblLPR.BasicSearchKeyword = sSearchKeyword
  510.             tblLPR.BasicSearchType = sSearchType
  511.         End If
  512.         Return sSearchStr
  513.     End Function
  514.  
  515.     '
  516.     ' Clear all search parameters
  517.     '
  518.     Sub ResetSearchParms()
  519.  
  520.         ' Clear search where
  521.         sSrchWhere = ""
  522.         tblLPR.SearchWhere = sSrchWhere
  523.  
  524.         ' Clear basic search parameters
  525.         ResetBasicSearchParms()
  526.  
  527.         ' Clear advanced search parameters
  528.         ResetAdvancedSearchParms()
  529.     End Sub
  530.  
  531.     '
  532.     ' Clear all basic search parameters
  533.     '
  534.     Sub ResetBasicSearchParms()
  535.  
  536.         ' Clear basic search parameters
  537.         tblLPR.BasicSearchKeyword = ""
  538.         tblLPR.BasicSearchType = ""
  539.     End Sub
  540.  
  541.     '
  542.     ' Clear all advanced search parameters
  543.     '
  544.     Sub ResetAdvancedSearchParms()
  545.         tblLPR.SetAdvancedSearch("x_lprEmpID", "")
  546.         tblLPR.SetAdvancedSearch("x_lprDate", "")
  547.         tblLPR.SetAdvancedSearch("v_lprDate", "AND")
  548.         tblLPR.SetAdvancedSearch("y_lprDate", "")
  549.         tblLPR.SetAdvancedSearch("x_lprLocationID", "")
  550.         tblLPR.SetAdvancedSearch("x_lprFixtureLocationID", "")
  551.         tblLPR.SetAdvancedSearch("x_lprFixtureTypeID", "")
  552.         tblLPR.SetAdvancedSearch("x_lprFixtureNumber", "")
  553.         tblLPR.SetAdvancedSearch("x_lprChannelNumber", "")
  554.         tblLPR.SetAdvancedSearch("x_lprPriority", "")
  555.         tblLPR.SetAdvancedSearch("x_lprShortDesc", "")
  556.         tblLPR.SetAdvancedSearch("x_lprSTID", "")
  557.         tblLPR.SetAdvancedSearch("x_lprSTChangedBy", "")
  558.         tblLPR.SetAdvancedSearch("x_lprDesc", "")
  559.         tblLPR.SetAdvancedSearch("x_lprCreatedBy", "")
  560.         tblLPR.SetAdvancedSearch("x_lprCreatedOn", "")
  561.         tblLPR.SetAdvancedSearch("x_lprModifiedBy", "")
  562.         tblLPR.SetAdvancedSearch("x_lprModifiedOn", "")
  563.     End Sub
  564.  
  565.     '
  566.     ' Restore all search parameters
  567.     '
  568.     Sub RestoreSearchParms()
  569.         sSrchWhere = tblLPR.SearchWhere
  570.  
  571.         ' Restore advanced search settings
  572.         If ParentPage.gsSearchError = "" Then
  573.             RestoreAdvancedSearchParms()
  574.         End If
  575.     End Sub
  576.  
  577.     '
  578.     ' Restore all advanced search parameters
  579.     '
  580.     Sub RestoreAdvancedSearchParms()
  581.         tblLPR.lprEmpID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprEmpID")
  582.         tblLPR.lprDate.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprDate")
  583.         tblLPR.lprDate.AdvancedSearch.SearchCondition = tblLPR.GetAdvancedSearch("v_lprDate")
  584.         tblLPR.lprDate.AdvancedSearch.SearchValue2 = tblLPR.GetAdvancedSearch("y_lprDate")
  585.         tblLPR.lprLocationID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprLocationID")
  586.         tblLPR.lprFixtureLocationID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureLocationID")
  587.         tblLPR.lprFixtureTypeID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureTypeID")
  588.         tblLPR.lprFixtureNumber.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureNumber")
  589.         tblLPR.lprChannelNumber.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprChannelNumber")
  590.         tblLPR.lprPriority.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprPriority")
  591.         tblLPR.lprShortDesc.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprShortDesc")
  592.         tblLPR.lprSTID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprSTID")
  593.         tblLPR.lprSTChangedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprSTChangedBy")
  594.         tblLPR.lprDesc.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprDesc")
  595.         tblLPR.lprCreatedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprCreatedBy")
  596.         tblLPR.lprCreatedOn.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprCreatedOn")
  597.         tblLPR.lprModifiedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprModifiedBy")
  598.         tblLPR.lprModifiedOn.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprModifiedOn")
  599.     End Sub
  600.  
  601.     '
  602.     ' Set up Sort parameters based on Sort Links clicked
  603.     '
  604.     Sub SetUpSortOrder()
  605.         Dim sOrderBy As String
  606.         Dim sSortField As String, sLastSort As String, sThisSort As String
  607.         Dim bCtrl As Boolean
  608.  
  609.         ' Check for Ctrl pressed
  610.         bCtrl = (ew_Get("ctrl") <> "")
  611.  
  612.         ' Check for an Order parameter
  613.         If ew_Get("order") <> "" Then
  614.             tblLPR.CurrentOrder = ew_Get("order")
  615.             tblLPR.CurrentOrderType = ew_Get("ordertype")
  616.             tblLPR.UpdateSort(tblLPR.lprEmpID, bCtrl) ' lprEmpID
  617.             tblLPR.UpdateSort(tblLPR.lprDate, bCtrl) ' lprDate
  618.             tblLPR.UpdateSort(tblLPR.lprLocationID, bCtrl) ' lprLocationID
  619.             tblLPR.UpdateSort(tblLPR.lprFixtureLocationID, bCtrl) ' lprFixtureLocationID
  620.             tblLPR.UpdateSort(tblLPR.lprFixtureTypeID, bCtrl) ' lprFixtureTypeID
  621.             tblLPR.UpdateSort(tblLPR.lprFixtureNumber, bCtrl) ' lprFixtureNumber
  622.             tblLPR.UpdateSort(tblLPR.lprChannelNumber, bCtrl) ' lprChannelNumber
  623.             tblLPR.UpdateSort(tblLPR.lprPriority, bCtrl) ' lprPriority
  624.             tblLPR.UpdateSort(tblLPR.lprShortDesc, bCtrl) ' lprShortDesc
  625.             tblLPR.UpdateSort(tblLPR.lprSTID, bCtrl) ' lprSTID
  626.             tblLPR.UpdateSort(tblLPR.lprSTChangedBy, bCtrl) ' lprSTChangedBy
  627.             tblLPR.StartRecordNumber = 1 ' Reset start position
  628.         End If
  629.     End Sub
  630.  
  631.     '
  632.     ' Load Sort Order parameters
  633.     '
  634.     Sub LoadSortOrder()
  635.         Dim sOrderBy As String
  636.         sOrderBy = tblLPR.SessionOrderBy ' Get order by from Session
  637.         If sOrderBy = "" Then
  638.             If tblLPR.SqlOrderBy <> "" Then
  639.                 sOrderBy = tblLPR.SqlOrderBy
  640.                 tblLPR.SessionOrderBy = sOrderBy
  641.                 tblLPR.lprDate.Sort = "DESC"
  642.                 tblLPR.lprEmpID.Sort = "ASC"
  643.             End If
  644.         End If
  645.     End Sub
  646.  
  647.     '
  648.     ' Reset command based on querystring parameter "cmd"
  649.     ' - reset: reset search parameters
  650.     ' - resetall: reset search and master/detail parameters
  651.     ' - resetsort: reset sort parameters
  652.     '
  653.     Sub ResetCmd()
  654.         Dim sCmd As String
  655.  
  656.         ' Get reset cmd
  657.         If ew_Get("cmd") <> "" Then
  658.             sCmd = ew_Get("cmd")
  659.  
  660.             ' Reset search criteria
  661.             If ew_SameText(sCmd, "reset") OrElse ew_SameText(sCmd, "resetall") Then
  662.                 ResetSearchParms()
  663.             End If
  664.  
  665.             ' Reset sort criteria
  666.             If ew_SameText(sCmd, "resetsort") Then
  667.                 Dim sOrderBy As String = ""
  668.                 tblLPR.SessionOrderBy = sOrderBy
  669.                 tblLPR.lprEmpID.Sort = ""
  670.                 tblLPR.lprDate.Sort = ""
  671.                 tblLPR.lprLocationID.Sort = ""
  672.                 tblLPR.lprFixtureLocationID.Sort = ""
  673.                 tblLPR.lprFixtureTypeID.Sort = ""
  674.                 tblLPR.lprFixtureNumber.Sort = ""
  675.                 tblLPR.lprChannelNumber.Sort = ""
  676.                 tblLPR.lprPriority.Sort = ""
  677.                 tblLPR.lprShortDesc.Sort = ""
  678.                 tblLPR.lprSTID.Sort = ""
  679.                 tblLPR.lprSTChangedBy.Sort = ""
  680.             End If
  681.  
  682.             ' Reset start position
  683.             lStartRec = 1
  684.             tblLPR.StartRecordNumber = lStartRec
  685.         End If
  686.     End Sub
  687.  
  688.     Public Pager As Object
  689.  
  690.     '
  691.     ' Set up Starting Record parameters
  692.     '
  693.     Sub SetUpStartRec()
  694.         Dim nPageNo As Integer
  695.  
  696.         ' Exit if lDisplayRecs = 0
  697.         If lDisplayRecs = 0 Then Exit Sub
  698.         If IsPageRequest Then ' Validate request
  699.  
  700.             ' Check for a "start" parameter
  701.             If ew_Get(EW_TABLE_START_REC) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_START_REC)) Then
  702.                 lStartRec = ew_ConvertToInt(ew_Get(EW_TABLE_START_REC))
  703.                 tblLPR.StartRecordNumber = lStartRec
  704.             ElseIf ew_Get(EW_TABLE_PAGE_NO) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_PAGE_NO)) Then
  705.                 nPageNo = ew_ConvertToInt(ew_Get(EW_TABLE_PAGE_NO))
  706.                 lStartRec = (nPageNo-1)*lDisplayRecs+1
  707.                 If lStartRec <= 0 Then
  708.                     lStartRec = 1
  709.                 ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
  710.                     lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
  711.                 End If
  712.                 tblLPR.StartRecordNumber = lStartRec
  713.             End If
  714.         End If
  715.         lStartRec = tblLPR.StartRecordNumber
  716.  
  717.         ' Check if correct start record counter
  718.         If lStartRec <= 0 Then ' Avoid invalid start record counter
  719.             lStartRec = 1 ' Reset start record counter
  720.             tblLPR.StartRecordNumber = lStartRec
  721.         ElseIf lStartRec > lTotalRecs Then ' Avoid starting record > total records
  722.             lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
  723.             tblLPR.StartRecordNumber = lStartRec
  724.         ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
  725.             lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
  726.             tblLPR.StartRecordNumber = lStartRec
  727.         End If
  728.     End Sub
  729.  
  730.     '
  731.     ' Load default values
  732.     '
  733.     Sub LoadDefaultValues()
  734.         tblLPR.lprPriority.CurrentValue = 2
  735.     End Sub
  736.  
  737.     '
  738.     '  Load search values for validation
  739.     '
  740.     Sub LoadSearchValues()
  741.         tblLPR.lprEmpID.AdvancedSearch.SearchValue = ew_Get("x_lprEmpID")
  742.         tblLPR.lprEmpID.AdvancedSearch.SearchOperator = ew_Get("z_lprEmpID")
  743.         tblLPR.lprDate.AdvancedSearch.SearchValue = ew_Get("x_lprDate")
  744.         tblLPR.lprDate.AdvancedSearch.SearchOperator = ew_Get("z_lprDate")
  745.         tblLPR.lprDate.AdvancedSearch.SearchCondition = ew_Get("v_lprDate")
  746.         tblLPR.lprDate.AdvancedSearch.SearchValue2 = ew_Get("y_lprDate")
  747.         tblLPR.lprDate.AdvancedSearch.SearchOperator2 = ew_Get("w_lprDate")
  748.         tblLPR.lprLocationID.AdvancedSearch.SearchValue = ew_Get("x_lprLocationID")
  749.         tblLPR.lprLocationID.AdvancedSearch.SearchOperator = ew_Get("z_lprLocationID")
  750.         tblLPR.lprFixtureLocationID.AdvancedSearch.SearchValue = ew_Get("x_lprFixtureLocationID")
  751.         tblLPR.lprFixtureLocationID.AdvancedSearch.SearchOperator = ew_Get("z_lprFixtureLocationID")
  752.         tblLPR.lprFixtureTypeID.AdvancedSearch.SearchValue = ew_Get("x_lprFixtureTypeID")
  753.         tblLPR.lprFixtureTypeID.AdvancedSearch.SearchOperator = ew_Get("z_lprFixtureTypeID")
  754.         tblLPR.lprFixtureNumber.AdvancedSearch.SearchValue = ew_Get("x_lprFixtureNumber")
  755.         tblLPR.lprFixtureNumber.AdvancedSearch.SearchOperator = ew_Get("z_lprFixtureNumber")
  756.         tblLPR.lprChannelNumber.AdvancedSearch.SearchValue = ew_Get("x_lprChannelNumber")
  757.         tblLPR.lprChannelNumber.AdvancedSearch.SearchOperator = ew_Get("z_lprChannelNumber")
  758.         tblLPR.lprPriority.AdvancedSearch.SearchValue = ew_Get("x_lprPriority")
  759.         tblLPR.lprPriority.AdvancedSearch.SearchOperator = ew_Get("z_lprPriority")
  760.         tblLPR.lprShortDesc.AdvancedSearch.SearchValue = ew_Get("x_lprShortDesc")
  761.         tblLPR.lprShortDesc.AdvancedSearch.SearchOperator = ew_Get("z_lprShortDesc")
  762.         tblLPR.lprSTID.AdvancedSearch.SearchValue = ew_Get("x_lprSTID")
  763.         tblLPR.lprSTID.AdvancedSearch.SearchOperator = ew_Get("z_lprSTID")
  764.         tblLPR.lprSTChangedBy.AdvancedSearch.SearchValue = ew_Get("x_lprSTChangedBy")
  765.         tblLPR.lprSTChangedBy.AdvancedSearch.SearchOperator = ew_Get("z_lprSTChangedBy")
  766.         tblLPR.lprDesc.AdvancedSearch.SearchValue = ew_Get("x_lprDesc")
  767.         tblLPR.lprDesc.AdvancedSearch.SearchOperator = ew_Get("z_lprDesc")
  768.         tblLPR.lprCreatedBy.AdvancedSearch.SearchValue = ew_Get("x_lprCreatedBy")
  769.         tblLPR.lprCreatedBy.AdvancedSearch.SearchOperator = ew_Get("z_lprCreatedBy")
  770.         tblLPR.lprCreatedOn.AdvancedSearch.SearchValue = ew_Get("x_lprCreatedOn")
  771.         tblLPR.lprCreatedOn.AdvancedSearch.SearchOperator = ew_Get("z_lprCreatedOn")
  772.         tblLPR.lprModifiedBy.AdvancedSearch.SearchValue = ew_Get("x_lprModifiedBy")
  773.         tblLPR.lprModifiedBy.AdvancedSearch.SearchOperator = ew_Get("z_lprModifiedBy")
  774.         tblLPR.lprModifiedOn.AdvancedSearch.SearchValue = ew_Get("x_lprModifiedOn")
  775.         tblLPR.lprModifiedOn.AdvancedSearch.SearchOperator = ew_Get("z_lprModifiedOn")
  776.     End Sub
  777.  
  778.     '
  779.     ' Load recordset
  780.     '
  781.     Function LoadRecordset() As OleDbDataReader
  782.  
  783.         ' Recordset Selecting event
  784.         tblLPR.Recordset_Selecting(tblLPR.CurrentFilter)
  785.  
  786.         ' Load list page SQL
  787.         Dim sSql As String = tblLPR.ListSQL
  788.  
  789.         ' Write SQL for debug
  790.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  791.  
  792.         ' Count
  793.         lTotalRecs = -1        
  794.         Try            
  795.             If sSql.StartsWith("SELECT * FROM ", StringComparison.InvariantCultureIgnoreCase) AndAlso _                
  796.                 ew_Empty(tblLPR.SqlGroupBy) AndAlso _
  797.                 ew_Empty(tblLPR.SqlHaving) Then
  798.                 Dim sCntSql As String = tblLPR.SelectCountSQL
  799.  
  800.                 ' Write SQL for debug
  801.                 If EW_DEBUG_ENABLED Then ew_Write("<br>" & sCntSql)
  802.                 lTotalRecs = Conn.ExecuteScalar(sCntSql)
  803.             End If            
  804.         Catch
  805.         End Try
  806.  
  807.         ' Load recordset
  808.         Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  809.         If lTotalRecs < 0 AndAlso Rs.HasRows Then
  810.             lTotalRecs = 0
  811.             While Rs.Read()
  812.                 lTotalRecs = lTotalRecs + 1
  813.             End While
  814.             Rs.Close()        
  815.             Rs = Conn.GetDataReader(sSql)
  816.         End If
  817.  
  818.         ' Recordset Selected event
  819.         tblLPR.Recordset_Selected(Rs)
  820.         Return Rs
  821.     End Function
  822.  
  823.     '
  824.     ' Load row based on key values
  825.     '
  826.     Function LoadRow() As Boolean
  827.         Dim RsRow As OleDbDataReader
  828.         Dim sFilter As String = tblLPR.KeyFilter
  829.  
  830.         ' Row Selecting event
  831.         tblLPR.Row_Selecting(sFilter)
  832.  
  833.         ' Load SQL based on filter
  834.         tblLPR.CurrentFilter = sFilter
  835.         Dim sSql As String = tblLPR.SQL
  836.  
  837.         ' Write SQL for debug
  838.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  839.         Try
  840.             RsRow = Conn.GetTempDataReader(sSql)    
  841.             If Not RsRow.Read() Then
  842.                 Return False
  843.             Else                
  844.                 LoadRowValues(RsRow) ' Load row values
  845.  
  846.                 ' Row Selected event
  847.                 tblLPR.Row_Selected(RsRow)
  848.                 Return True    
  849.             End If
  850.         Catch
  851.             If EW_DEBUG_ENABLED Then Throw
  852.             Return False
  853.         Finally
  854.             Conn.CloseTempDataReader()
  855.         End Try
  856.     End Function
  857.  
  858.     '
  859.     ' Load row values from recordset
  860.     '
  861.     Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
  862.         tblLPR.lprID.DbValue = RsRow("lprID")
  863.         tblLPR.lprEmpID.DbValue = RsRow("lprEmpID")
  864.         tblLPR.lprDate.DbValue = RsRow("lprDate")
  865.         tblLPR.lprLocationID.DbValue = RsRow("lprLocationID")
  866.         tblLPR.lprFixtureLocationID.DbValue = RsRow("lprFixtureLocationID")
  867.         tblLPR.lprFixtureTypeID.DbValue = RsRow("lprFixtureTypeID")
  868.         tblLPR.lprFixtureNumber.DbValue = RsRow("lprFixtureNumber")
  869.         tblLPR.lprChannelNumber.DbValue = RsRow("lprChannelNumber")
  870.         tblLPR.lprPriority.DbValue = RsRow("lprPriority")
  871.         tblLPR.lprShortDesc.DbValue = RsRow("lprShortDesc")
  872.         tblLPR.lprSTID.DbValue = RsRow("lprSTID")
  873.         tblLPR.lprSTChangedBy.DbValue = RsRow("lprSTChangedBy")
  874.         tblLPR.lprDesc.DbValue = RsRow("lprDesc")
  875.         tblLPR.lprCreatedBy.DbValue = RsRow("lprCreatedBy")
  876.         tblLPR.lprCreatedOn.DbValue = RsRow("lprCreatedOn")
  877.         tblLPR.lprModifiedBy.DbValue = RsRow("lprModifiedBy")
  878.         tblLPR.lprModifiedOn.DbValue = RsRow("lprModifiedOn")
  879.     End Sub
  880.  
  881.     '
  882.     ' Render row values based on field settings
  883.     '
  884.     Sub RenderRow()
  885.  
  886.         ' Row Rendering event
  887.         tblLPR.Row_Rendering()
  888.  
  889.         '
  890.         '  Common render codes for all row types
  891.         '
  892.         ' lprEmpID
  893.  
  894.         tblLPR.lprEmpID.CellCssStyle = ""
  895.         tblLPR.lprEmpID.CellCssClass = ""
  896.  
  897.         ' lprDate
  898.         tblLPR.lprDate.CellCssStyle = ""
  899.         tblLPR.lprDate.CellCssClass = ""
  900.  
  901.         ' lprLocationID
  902.         tblLPR.lprLocationID.CellCssStyle = ""
  903.         tblLPR.lprLocationID.CellCssClass = ""
  904.  
  905.         ' lprFixtureLocationID
  906.         tblLPR.lprFixtureLocationID.CellCssStyle = ""
  907.         tblLPR.lprFixtureLocationID.CellCssClass = ""
  908.  
  909.         ' lprFixtureTypeID
  910.         tblLPR.lprFixtureTypeID.CellCssStyle = ""
  911.         tblLPR.lprFixtureTypeID.CellCssClass = ""
  912.  
  913.         ' lprFixtureNumber
  914.         tblLPR.lprFixtureNumber.CellCssStyle = ""
  915.         tblLPR.lprFixtureNumber.CellCssClass = ""
  916.  
  917.         ' lprChannelNumber
  918.         tblLPR.lprChannelNumber.CellCssStyle = ""
  919.         tblLPR.lprChannelNumber.CellCssClass = ""
  920.  
  921.         ' lprPriority
  922.         tblLPR.lprPriority.CellCssStyle = ""
  923.         tblLPR.lprPriority.CellCssClass = ""
  924.  
  925.         ' lprShortDesc
  926.         tblLPR.lprShortDesc.CellCssStyle = ""
  927.         tblLPR.lprShortDesc.CellCssClass = ""
  928.  
  929.         ' lprSTID
  930.         tblLPR.lprSTID.CellCssStyle = ""
  931.         tblLPR.lprSTID.CellCssClass = ""
  932.  
  933.         ' lprSTChangedBy
  934.         tblLPR.lprSTChangedBy.CellCssStyle = ""
  935.         tblLPR.lprSTChangedBy.CellCssClass = ""
  936.  
  937.         '
  938.         '  View  Row
  939.         '
  940.  
  941.         If tblLPR.RowType = EW_ROWTYPE_VIEW Then ' View row
  942.  
  943.             ' lprEmpID
  944.             If ew_NotEmpty(tblLPR.lprEmpID.CurrentValue) Then
  945.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(tblLPR.lprEmpID.CurrentValue) & ""
  946.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  947.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  948.                 If RsWrk.Read() Then
  949.                     tblLPR.lprEmpID.ViewValue = RsWrk("empName")
  950.                 Else
  951.                     tblLPR.lprEmpID.ViewValue = tblLPR.lprEmpID.CurrentValue
  952.                 End If
  953.                 Conn.CloseTempDataReader()
  954.             Else
  955.                 tblLPR.lprEmpID.ViewValue = System.DBNull.Value
  956.             End If
  957.             tblLPR.lprEmpID.CssStyle = ""
  958.             tblLPR.lprEmpID.CssClass = ""
  959.             tblLPR.lprEmpID.ViewCustomAttributes = ""
  960.  
  961.             ' lprDate
  962.             tblLPR.lprDate.ViewValue = tblLPR.lprDate.CurrentValue
  963.             tblLPR.lprDate.ViewValue = ew_FormatDateTime(tblLPR.lprDate.ViewValue, 6)
  964.             tblLPR.lprDate.CssStyle = ""
  965.             tblLPR.lprDate.CssClass = ""
  966.             tblLPR.lprDate.ViewCustomAttributes = ""
  967.  
  968.             ' lprLocationID
  969.             If ew_NotEmpty(tblLPR.lprLocationID.CurrentValue) Then
  970.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(tblLPR.lprLocationID.CurrentValue) & ""
  971.                 sSqlWrk = sSqlWrk & " AND (" & "[locLighting]=True" & ")"
  972.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  973.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  974.                 If RsWrk.Read() Then
  975.                     tblLPR.lprLocationID.ViewValue = RsWrk("locDescription")
  976.                 Else
  977.                     tblLPR.lprLocationID.ViewValue = tblLPR.lprLocationID.CurrentValue
  978.                 End If
  979.                 Conn.CloseTempDataReader()
  980.             Else
  981.                 tblLPR.lprLocationID.ViewValue = System.DBNull.Value
  982.             End If
  983.             tblLPR.lprLocationID.CssStyle = ""
  984.             tblLPR.lprLocationID.CssClass = ""
  985.             tblLPR.lprLocationID.ViewCustomAttributes = ""
  986.  
  987.             ' lprFixtureLocationID
  988.             If ew_NotEmpty(tblLPR.lprFixtureLocationID.CurrentValue) Then
  989.                 sSqlWrk = "SELECT [floDescription] FROM [tblLPRFixtureLocation] WHERE [floID] = " & ew_AdjustSql(tblLPR.lprFixtureLocationID.CurrentValue) & ""
  990.                 sSqlWrk = sSqlWrk & " ORDER BY [floDescription] "
  991.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  992.                 If RsWrk.Read() Then
  993.                     tblLPR.lprFixtureLocationID.ViewValue = RsWrk("floDescription")
  994.                 Else
  995.                     tblLPR.lprFixtureLocationID.ViewValue = tblLPR.lprFixtureLocationID.CurrentValue
  996.                 End If
  997.                 Conn.CloseTempDataReader()
  998.             Else
  999.                 tblLPR.lprFixtureLocationID.ViewValue = System.DBNull.Value
  1000.             End If
  1001.             tblLPR.lprFixtureLocationID.CssStyle = ""
  1002.             tblLPR.lprFixtureLocationID.CssClass = ""
  1003.             tblLPR.lprFixtureLocationID.ViewCustomAttributes = ""
  1004.  
  1005.             ' lprFixtureTypeID
  1006.             If ew_NotEmpty(tblLPR.lprFixtureTypeID.CurrentValue) Then
  1007.                 sSqlWrk = "SELECT [ftyDescription] FROM [tblLPRFixtureType] WHERE [ftyID] = " & ew_AdjustSql(tblLPR.lprFixtureTypeID.CurrentValue) & ""
  1008.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  1009.                 If RsWrk.Read() Then
  1010.                     tblLPR.lprFixtureTypeID.ViewValue = RsWrk("ftyDescription")
  1011.                 Else
  1012.                     tblLPR.lprFixtureTypeID.ViewValue = tblLPR.lprFixtureTypeID.CurrentValue
  1013.                 End If
  1014.                 Conn.CloseTempDataReader()
  1015.             Else
  1016.                 tblLPR.lprFixtureTypeID.ViewValue = System.DBNull.Value
  1017.             End If
  1018.             tblLPR.lprFixtureTypeID.CssStyle = ""
  1019.             tblLPR.lprFixtureTypeID.CssClass = ""
  1020.             tblLPR.lprFixtureTypeID.ViewCustomAttributes = ""
  1021.  
  1022.             ' lprFixtureNumber
  1023.             tblLPR.lprFixtureNumber.ViewValue = tblLPR.lprFixtureNumber.CurrentValue
  1024.             If ew_Empty(tblLPR.Export) Then tblLPR.lprFixtureNumber.ViewValue = ew_Highlight(tblLPR.HighlightName, tblLPR.lprFixtureNumber.ViewValue, tblLPR.BasicSearchKeyword, tblLPR.BasicSearchType, tblLPR.GetAdvancedSearch("x_lprFixtureNumber"))
  1025.             tblLPR.lprFixtureNumber.CssStyle = ""
  1026.             tblLPR.lprFixtureNumber.CssClass = ""
  1027.             tblLPR.lprFixtureNumber.ViewCustomAttributes = ""
  1028.  
  1029.             ' lprChannelNumber
  1030.             tblLPR.lprChannelNumber.ViewValue = tblLPR.lprChannelNumber.CurrentValue
  1031.             tblLPR.lprChannelNumber.CssStyle = ""
  1032.             tblLPR.lprChannelNumber.CssClass = ""
  1033.             tblLPR.lprChannelNumber.ViewCustomAttributes = ""
  1034.  
  1035.             ' lprPriority
  1036.             If Not IsDBNull(tblLPR.lprPriority.CurrentValue) Then
  1037.                     Select Case tblLPR.lprPriority.CurrentValue
  1038.                         Case "0"
  1039.                             tblLPR.lprPriority.ViewValue = "Not Specified"
  1040.                         Case "1"
  1041.                             tblLPR.lprPriority.ViewValue = "Low"
  1042.                         Case "2"
  1043.                             tblLPR.lprPriority.ViewValue = "Medium"
  1044.                         Case "3"
  1045.                             tblLPR.lprPriority.ViewValue = "High"
  1046.                         Case Else
  1047.                             tblLPR.lprPriority.ViewValue = tblLPR.lprPriority.CurrentValue
  1048.                     End Select
  1049.             Else
  1050.                 tblLPR.lprPriority.ViewValue = System.DBNull.Value
  1051.             End If
  1052.             tblLPR.lprPriority.CssStyle = ""
  1053.             tblLPR.lprPriority.CssClass = ""
  1054.             tblLPR.lprPriority.ViewCustomAttributes = ""
  1055.  
  1056.             ' lprShortDesc
  1057.             tblLPR.lprShortDesc.ViewValue = tblLPR.lprShortDesc.CurrentValue
  1058.             If ew_Empty(tblLPR.Export) Then tblLPR.lprShortDesc.ViewValue = ew_Highlight(tblLPR.HighlightName, tblLPR.lprShortDesc.ViewValue, tblLPR.BasicSearchKeyword, tblLPR.BasicSearchType, tblLPR.GetAdvancedSearch("x_lprShortDesc"))
  1059.             tblLPR.lprShortDesc.CssStyle = ""
  1060.             tblLPR.lprShortDesc.CssClass = ""
  1061.             tblLPR.lprShortDesc.ViewCustomAttributes = ""
  1062.  
  1063.             ' lprSTID
  1064.             If ew_NotEmpty(tblLPR.lprSTID.CurrentValue) Then
  1065.                 sSqlWrk = "SELECT [lstDescription] FROM [tblLPRStatus] WHERE [lstID] = " & ew_AdjustSql(tblLPR.lprSTID.CurrentValue) & ""
  1066.                 sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
  1067.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  1068.                 If RsWrk.Read() Then
  1069.                     tblLPR.lprSTID.ViewValue = RsWrk("lstDescription")
  1070.                 Else
  1071.                     tblLPR.lprSTID.ViewValue = tblLPR.lprSTID.CurrentValue
  1072.                 End If
  1073.                 Conn.CloseTempDataReader()
  1074.             Else
  1075.                 tblLPR.lprSTID.ViewValue = System.DBNull.Value
  1076.             End If
  1077.             tblLPR.lprSTID.CssStyle = ""
  1078.             tblLPR.lprSTID.CssClass = ""
  1079.             tblLPR.lprSTID.ViewCustomAttributes = ""
  1080.  
  1081.             ' lprSTChangedBy
  1082.             tblLPR.lprSTChangedBy.ViewValue = tblLPR.lprSTChangedBy.CurrentValue
  1083.             If ew_Empty(tblLPR.Export) Then tblLPR.lprSTChangedBy.ViewValue = ew_Highlight(tblLPR.HighlightName, tblLPR.lprSTChangedBy.ViewValue, "", "", tblLPR.GetAdvancedSearch("x_lprSTChangedBy"))
  1084.             tblLPR.lprSTChangedBy.CssStyle = ""
  1085.             tblLPR.lprSTChangedBy.CssClass = ""
  1086.             tblLPR.lprSTChangedBy.ViewCustomAttributes = ""
  1087.  
  1088.             ' lprCreatedBy
  1089.             tblLPR.lprCreatedBy.ViewValue = tblLPR.lprCreatedBy.CurrentValue
  1090.             If ew_Empty(tblLPR.Export) Then tblLPR.lprCreatedBy.ViewValue = ew_Highlight(tblLPR.HighlightName, tblLPR.lprCreatedBy.ViewValue, "", "", tblLPR.GetAdvancedSearch("x_lprCreatedBy"))
  1091.             tblLPR.lprCreatedBy.CssStyle = ""
  1092.             tblLPR.lprCreatedBy.CssClass = ""
  1093.             tblLPR.lprCreatedBy.ViewCustomAttributes = ""
  1094.  
  1095.             ' lprCreatedOn
  1096.             tblLPR.lprCreatedOn.ViewValue = tblLPR.lprCreatedOn.CurrentValue
  1097.             tblLPR.lprCreatedOn.ViewValue = ew_FormatDateTime(tblLPR.lprCreatedOn.ViewValue, 6)
  1098.             tblLPR.lprCreatedOn.CssStyle = ""
  1099.             tblLPR.lprCreatedOn.CssClass = ""
  1100.             tblLPR.lprCreatedOn.ViewCustomAttributes = ""
  1101.  
  1102.             ' lprModifiedBy
  1103.             tblLPR.lprModifiedBy.ViewValue = tblLPR.lprModifiedBy.CurrentValue
  1104.             If ew_Empty(tblLPR.Export) Then tblLPR.lprModifiedBy.ViewValue = ew_Highlight(tblLPR.HighlightName, tblLPR.lprModifiedBy.ViewValue, "", "", tblLPR.GetAdvancedSearch("x_lprModifiedBy"))
  1105.             tblLPR.lprModifiedBy.CssStyle = ""
  1106.             tblLPR.lprModifiedBy.CssClass = ""
  1107.             tblLPR.lprModifiedBy.ViewCustomAttributes = ""
  1108.  
  1109.             ' lprModifiedOn
  1110.             tblLPR.lprModifiedOn.ViewValue = tblLPR.lprModifiedOn.CurrentValue
  1111.             tblLPR.lprModifiedOn.ViewValue = ew_FormatDateTime(tblLPR.lprModifiedOn.ViewValue, 6)
  1112.             tblLPR.lprModifiedOn.CssStyle = ""
  1113.             tblLPR.lprModifiedOn.CssClass = ""
  1114.             tblLPR.lprModifiedOn.ViewCustomAttributes = ""
  1115.  
  1116.             ' View refer script
  1117.             ' lprEmpID
  1118.  
  1119.             tblLPR.lprEmpID.HrefValue = ""
  1120.  
  1121.             ' lprDate
  1122.             tblLPR.lprDate.HrefValue = ""
  1123.  
  1124.             ' lprLocationID
  1125.             tblLPR.lprLocationID.HrefValue = ""
  1126.  
  1127.             ' lprFixtureLocationID
  1128.             tblLPR.lprFixtureLocationID.HrefValue = ""
  1129.  
  1130.             ' lprFixtureTypeID
  1131.             tblLPR.lprFixtureTypeID.HrefValue = ""
  1132.  
  1133.             ' lprFixtureNumber
  1134.             tblLPR.lprFixtureNumber.HrefValue = ""
  1135.  
  1136.             ' lprChannelNumber
  1137.             tblLPR.lprChannelNumber.HrefValue = ""
  1138.  
  1139.             ' lprPriority
  1140.             tblLPR.lprPriority.HrefValue = ""
  1141.  
  1142.             ' lprShortDesc
  1143.             tblLPR.lprShortDesc.HrefValue = ""
  1144.  
  1145.             ' lprSTID
  1146.             tblLPR.lprSTID.HrefValue = ""
  1147.  
  1148.             ' lprSTChangedBy
  1149.             tblLPR.lprSTChangedBy.HrefValue = ""
  1150.  
  1151.         '
  1152.         '  Search Row
  1153.         '
  1154.  
  1155.         ElseIf tblLPR.RowType = EW_ROWTYPE_SEARCH Then ' Search row
  1156.  
  1157.             ' lprEmpID
  1158.             tblLPR.lprEmpID.EditCustomAttributes = ""
  1159.             If Not Security.IsAdmin And Security.IsLoggedIn() Then ' Non system admin
  1160.                 tblLPR.lprEmpID.AdvancedSearch.SearchValue = Security.CurrentUserID
  1161.             If ew_NotEmpty(tblLPR.lprEmpID.AdvancedSearch.SearchValue) Then
  1162.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(tblLPR.lprEmpID.AdvancedSearch.SearchValue) & ""
  1163.                         sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  1164.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  1165.                 If RsWrk.Read() Then
  1166.                     tblLPR.lprEmpID.EditValue = RsWrk("empName")
  1167.                 Else
  1168.                     tblLPR.lprEmpID.EditValue = tblLPR.lprEmpID.AdvancedSearch.SearchValue
  1169.                 End If
  1170.                 Conn.CloseTempDataReader()
  1171.             Else
  1172.                 tblLPR.lprEmpID.EditValue = System.DBNull.Value
  1173.             End If
  1174.             tblLPR.lprEmpID.CssStyle = ""
  1175.             tblLPR.lprEmpID.CssClass = ""
  1176.             tblLPR.lprEmpID.ViewCustomAttributes = ""
  1177.             Else
  1178.             sSqlWrk = "SELECT [empID], [empName], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblEmployees]"
  1179.             sWhereWrk = ""
  1180.             sWhereWrk = tblEmployees.AddUserIDFilter(sWhereWrk)
  1181.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1182.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  1183.             arwrk = Conn.GetRows(sSqlWrk)
  1184.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1185.             tblLPR.lprEmpID.EditValue = arwrk
  1186.             End If
  1187.  
  1188.             ' lprDate
  1189.             tblLPR.lprDate.EditCustomAttributes = ""
  1190.             tblLPR.lprDate.EditValue = tblLPR.lprDate.AdvancedSearch.SearchValue
  1191.             tblLPR.lprDate.EditCustomAttributes = ""
  1192.             tblLPR.lprDate.EditValue2 = tblLPR.lprDate.AdvancedSearch.SearchValue2
  1193.  
  1194.             ' lprLocationID
  1195.             tblLPR.lprLocationID.EditCustomAttributes = ""
  1196.             sSqlWrk = "SELECT [locID], [locDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLocations]"
  1197.             sWhereWrk = ""
  1198.             If sWhereWrk <> "" Then sWhereWrk = "(" & sWhereWrk & ") AND "
  1199.             sWhereWrk = sWhereWrk & "(" & "[locLighting]=True" & ")"
  1200.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1201.             sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  1202.             arwrk = Conn.GetRows(sSqlWrk)
  1203.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1204.             tblLPR.lprLocationID.EditValue = arwrk
  1205.  
  1206.             ' lprFixtureLocationID
  1207.             tblLPR.lprFixtureLocationID.EditCustomAttributes = ""
  1208.  
  1209.             ' lprFixtureTypeID
  1210.             tblLPR.lprFixtureTypeID.EditCustomAttributes = ""
  1211.  
  1212.             ' lprFixtureNumber
  1213.             tblLPR.lprFixtureNumber.EditCustomAttributes = ""
  1214.             tblLPR.lprFixtureNumber.EditValue = ew_HtmlEncode(tblLPR.lprFixtureNumber.AdvancedSearch.SearchValue)
  1215.  
  1216.             ' lprChannelNumber
  1217.             tblLPR.lprChannelNumber.EditCustomAttributes = ""
  1218.             tblLPR.lprChannelNumber.EditValue = ew_HtmlEncode(tblLPR.lprChannelNumber.AdvancedSearch.SearchValue)
  1219.  
  1220.             ' lprPriority
  1221.             tblLPR.lprPriority.EditCustomAttributes = ""
  1222.             arwrk = New ArrayList
  1223.                 arwrk.Add(New String() {"0", "Not Specified"})
  1224.                 arwrk.Add(New String() {"1", "Low"})
  1225.                 arwrk.Add(New String() {"2", "Medium"})
  1226.                 arwrk.Add(New String() {"3", "High"})
  1227.             arwrk.Insert(0, New String() {"", "Please Select"})
  1228.             tblLPR.lprPriority.EditValue = arwrk
  1229.  
  1230.             ' lprShortDesc
  1231.             tblLPR.lprShortDesc.EditCustomAttributes = ""
  1232.             tblLPR.lprShortDesc.EditValue = ew_HtmlEncode(tblLPR.lprShortDesc.AdvancedSearch.SearchValue)
  1233.  
  1234.             ' lprSTID
  1235.             tblLPR.lprSTID.EditCustomAttributes = ""
  1236.             sSqlWrk = "SELECT [lstID], [lstDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLPRStatus]"
  1237.             sWhereWrk = ""
  1238.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1239.             sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
  1240.             arwrk = Conn.GetRows(sSqlWrk)
  1241.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1242.             tblLPR.lprSTID.EditValue = arwrk
  1243.  
  1244.             ' lprSTChangedBy
  1245.             tblLPR.lprSTChangedBy.EditCustomAttributes = ""
  1246.             tblLPR.lprSTChangedBy.EditValue = ew_HtmlEncode(tblLPR.lprSTChangedBy.AdvancedSearch.SearchValue)
  1247.         End If
  1248.  
  1249.         ' Row Rendered event
  1250.         tblLPR.Row_Rendered()
  1251.     End Sub
  1252.  
  1253.     '
  1254.     ' Validate search
  1255.     '
  1256.     Function ValidateSearch() As Boolean
  1257.  
  1258.         ' Initialize
  1259.         ParentPage.gsSearchError = ""
  1260.  
  1261.         ' Check if validation required
  1262.         If Not EW_SERVER_VALIDATE Then Return True ' Skip
  1263.         If Not ew_CheckUSDate(tblLPR.lprDate.AdvancedSearch.SearchValue) Then
  1264.             If ParentPage.gsSearchError <> "" Then ParentPage.gsSearchError = ParentPage.gsSearchError & "<br />"
  1265.             ParentPage.gsSearchError = ParentPage.gsSearchError & "Incorrect date, format = mm/dd/yyyy - Date"
  1266.         End If
  1267.         If Not ew_CheckUSDate(tblLPR.lprDate.AdvancedSearch.SearchValue2) Then
  1268.             If ParentPage.gsSearchError <> "" Then ParentPage.gsSearchError = ParentPage.gsSearchError & "<br />"
  1269.             ParentPage.gsSearchError = ParentPage.gsSearchError & "Incorrect date, format = mm/dd/yyyy - Date"
  1270.         End If
  1271.  
  1272.         ' Return validate result    
  1273.         Dim Valid As Boolean = (ParentPage.gsSearchError = "")
  1274.  
  1275.         ' Form_CustomValidate event
  1276.         Dim sFormCustomError As String = ""
  1277.         Valid = Valid And Form_CustomValidate(sFormCustomError)
  1278.         If sFormCustomError <> "" Then
  1279.             If ParentPage.gsSearchError <> "" Then ParentPage.gsSearchError = ParentPage.gsSearchError & "<br />"
  1280.             ParentPage.gsSearchError = ParentPage.gsSearchError & sFormCustomError
  1281.         End If
  1282.         Return Valid
  1283.     End Function
  1284.  
  1285.     '
  1286.     ' Load advanced search
  1287.     '
  1288.     Sub LoadAdvancedSearch()
  1289.         tblLPR.lprEmpID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprEmpID")
  1290.         tblLPR.lprDate.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprDate")
  1291.         tblLPR.lprDate.AdvancedSearch.SearchCondition = tblLPR.GetAdvancedSearch("v_lprDate")
  1292.         tblLPR.lprDate.AdvancedSearch.SearchValue2 = tblLPR.GetAdvancedSearch("y_lprDate")
  1293.         tblLPR.lprLocationID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprLocationID")
  1294.         tblLPR.lprFixtureLocationID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureLocationID")
  1295.         tblLPR.lprFixtureTypeID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureTypeID")
  1296.         tblLPR.lprFixtureNumber.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprFixtureNumber")
  1297.         tblLPR.lprChannelNumber.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprChannelNumber")
  1298.         tblLPR.lprPriority.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprPriority")
  1299.         tblLPR.lprShortDesc.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprShortDesc")
  1300.         tblLPR.lprSTID.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprSTID")
  1301.         tblLPR.lprSTChangedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprSTChangedBy")
  1302.         tblLPR.lprDesc.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprDesc")
  1303.         tblLPR.lprCreatedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprCreatedBy")
  1304.         tblLPR.lprCreatedOn.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprCreatedOn")
  1305.         tblLPR.lprModifiedBy.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprModifiedBy")
  1306.         tblLPR.lprModifiedOn.AdvancedSearch.SearchValue = tblLPR.GetAdvancedSearch("x_lprModifiedOn")
  1307.     End Sub
  1308.  
  1309.     '
  1310.     ' Show link optionally based on user ID
  1311.     '
  1312.     Function ShowOptionLink() As Boolean        
  1313.         If Security.IsLoggedIn() AndAlso Not Security.IsAdmin() Then
  1314.             Return Security.IsValidUserID(tblLPR.lprEmpID.CurrentValue)
  1315.         End If
  1316.         Return True
  1317.     End Function
  1318.  
  1319.         ' Page Load event
  1320.         Public Sub Page_Load()
  1321.  
  1322.             'HttpContext.Current.Response.Write("Page Load")
  1323.         End Sub
  1324.  
  1325.         ' Page Unload event
  1326.         Public Sub Page_Unload()
  1327.  
  1328.             'HttpContext.Current.Response.Write("Page Unload")
  1329.         End Sub
  1330.  
  1331.     ' Form Custom Validate event
  1332.     Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  1333.  
  1334.         'Return error message in CustomError
  1335.         Return True
  1336.     End Function
  1337.     End Class
  1338.  
  1339.     '
  1340.     ' ASP.NET Page_Load event
  1341.     '
  1342.  
  1343.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  1344.         Response.Buffer = EW_RESPONSE_BUFFER
  1345.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  1346.  
  1347.         ' Page init
  1348.         tblLPR_list = New ctblLPR_list(Me)        
  1349.         tblLPR_list.Page_Init()
  1350.  
  1351.         ' Page main processing
  1352.         tblLPR_list.Page_Main()
  1353.     End Sub
  1354.  
  1355.     '
  1356.     ' ASP.NET Page_Unload event
  1357.     '
  1358.  
  1359.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  1360.  
  1361.         ' Dispose page object
  1362.         If tblLPR_list IsNot Nothing Then tblLPR_list.Dispose()
  1363.     End Sub
  1364. End Class
  1365.