home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblFixtureMastersrch.aspx.vb < prev    next >
Text File  |  2010-08-24  |  20KB  |  577 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 tblFixtureMastersrch
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblFixtureMaster_search As ctblFixtureMaster_search
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblFixtureMaster_search
  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 tblFixtureMaster.UseTokenInUrl Then Url = Url & "t=" & tblFixtureMaster.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 tblFixtureMaster.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (tblFixtureMaster.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (tblFixtureMaster.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' tblFixtureMaster
  57.         Public Property tblFixtureMaster() As ctblFixtureMaster
  58.             Get                
  59.                 Return ParentPage.tblFixtureMaster
  60.             End Get
  61.             Set(ByVal v As ctblFixtureMaster)
  62.                 ParentPage.tblFixtureMaster = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' tblFixtureMaster
  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 = "search"
  85.             m_PageObjName = "tblFixtureMaster_search"
  86.             m_PageObjTypeName = "ctblFixtureMaster_search"
  87.  
  88.             ' Table Name
  89.             m_TableName = "tblFixtureMaster"
  90.  
  91.             ' Initialize table object
  92.             tblFixtureMaster = New ctblFixtureMaster(Me)
  93.             tblEmployees = New ctblEmployees(Me)
  94.  
  95.             ' Connect to database
  96.             Conn = New cConnection()
  97.         End Sub
  98.  
  99.         '
  100.         '  Subroutine Page_Init
  101.         '  - called before page main
  102.         '  - check Security
  103.         '  - set up response header
  104.         '  - call page load events
  105.         '
  106.         Public Sub Page_Init()
  107.             Security = New cAdvancedSecurity(Me)
  108.             If Not Security.IsLoggedIn() Then Security.AutoLogin()
  109.             If Not Security.IsLoggedIn() Then
  110.                 Security.SaveLastUrl()
  111.                 Page_Terminate("login.aspx")
  112.             End If
  113.  
  114.             ' Table Permission loading event
  115.             Security.TablePermission_Loading()
  116.             Security.LoadCurrentUserLevel(TableName)
  117.  
  118.             ' Table Permission loaded event
  119.             Security.TablePermission_Loaded()
  120.             If Not Security.CanSearch Then
  121.                 Security.SaveLastUrl()
  122.                 Page_Terminate("tblFixtureMasterlist.aspx")
  123.             End If
  124.  
  125.             ' User ID loading event
  126.             Security.UserID_Loading()
  127.             If Security.IsLoggedIn() Then Call Security.LoadUserID()
  128.  
  129.             ' User ID loaded event
  130.             Security.UserID_Loaded()
  131.  
  132.             ' Global page loading event (in ewglobal*.vb)
  133.             ParentPage.Page_Loading()
  134.  
  135.             ' Page load event, used in current page
  136.             Page_Load()
  137.         End Sub
  138.  
  139.         '
  140.         '  Class terminate
  141.         '  - clean up page object
  142.         '
  143.         Public Sub Dispose() Implements IDisposable.Dispose
  144.             Page_Terminate("")
  145.         End Sub
  146.  
  147.         '
  148.         '  Sub Page_Terminate
  149.         '  - called when exit page
  150.         '  - clean up connection and objects
  151.         '  - if URL specified, redirect to URL
  152.         '
  153.         Sub Page_Terminate(url As String)
  154.  
  155.             ' Page unload event, used in current page
  156.             Page_Unload()
  157.  
  158.             ' Global page unloaded event (in ewglobal*.vb)
  159.             ParentPage.Page_Unloaded()
  160.  
  161.             ' Close connection
  162.             Conn.Dispose()
  163.             Security = Nothing
  164.             tblFixtureMaster.Dispose()
  165.             tblEmployees.Dispose()
  166.  
  167.             ' Go to URL if specified
  168.             If url <> "" Then
  169.                 HttpContext.Current.Response.Clear()
  170.                 HttpContext.Current.Response.Redirect(url)
  171.             End If
  172.         End Sub
  173.  
  174.     '
  175.     ' Page main processing
  176.     '
  177.     Sub Page_Main()
  178.         ObjForm = New cFormObj
  179.         If IsPageRequest Then ' Validate request
  180.  
  181.             ' Get action
  182.             tblFixtureMaster.CurrentAction = ObjForm.GetValue("a_search")
  183.             Select Case tblFixtureMaster.CurrentAction
  184.                 Case "S" ' Get Search Criteria
  185.  
  186.                     ' Build search string for advanced search, remove blank field
  187.                     Dim sSrchStr As String
  188.                     LoadSearchValues() ' Get search values
  189.                     If ValidateSearch() Then
  190.                         sSrchStr = BuildAdvancedSearch()
  191.                     Else
  192.                         sSrchStr = ""
  193.                         Message = ParentPage.gsSearchError
  194.                     End If
  195.                     If sSrchStr <> "" Then
  196.                         sSrchStr = tblFixtureMaster.UrlParm(sSrchStr)
  197.                     Page_Terminate("tblFixtureMasterlist.aspx" & "?" & sSrchStr) ' Go to list page
  198.                     End If
  199.             End Select
  200.         End If
  201.  
  202.         ' Restore search settings from Session
  203.         If ParentPage.gsSearchError = "" Then
  204.             LoadAdvancedSearch()
  205.         End If
  206.  
  207.         ' Render row for search
  208.         tblFixtureMaster.RowType = EW_ROWTYPE_SEARCH
  209.         RenderRow()
  210.     End Sub
  211.  
  212.     '
  213.     ' Build advanced search
  214.     '
  215.     Function BuildAdvancedSearch() As String
  216.         Dim sSrchUrl As String = ""
  217.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxMFG) ' lfxMFG
  218.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxModelType) ' lfxModelType
  219.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxSerialNumber) ' lfxSerialNumber
  220.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxLamp) ' lfxLamp
  221.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxLocationID) ' lfxLocationID
  222.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxHangPos) ' lfxHangPos
  223.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxChannel) ' lfxChannel
  224.         BuildSearchUrl(sSrchUrl, tblFixtureMaster.lfxNotes) ' lfxNotes
  225.         Return sSrchUrl
  226.     End Function
  227.  
  228.     '
  229.     ' Build search URL
  230.     '
  231.     Sub BuildSearchUrl(ByRef Url As String, ByRef Fld As Object)
  232.         Dim FldVal As String, FldOpr As String, FldCond As String, FldVal2 As String, FldOpr2 As String
  233.         Dim FldParm As String
  234.         Dim IsValidValue As Boolean, sWrk As String = ""
  235.         FldParm = Fld.FldVar.Substring(2)
  236.         FldVal = ObjForm.GetValue("x_" & FldParm)
  237.         FldOpr = ObjForm.GetValue("z_" & FldParm)
  238.         FldCond = ObjForm.GetValue("v_" & FldParm)
  239.         FldVal2 = ObjForm.GetValue("y_" & FldParm)
  240.         FldOpr2 = ObjForm.GetValue("w_" & FldParm)        
  241.         If ew_SameText(FldOpr, "BETWEEN") Then
  242.             IsValidValue = (Fld.FldDataType <> EW_DATATYPE_NUMBER) OrElse _
  243.                 (Fld.FldDataType = EW_DATATYPE_NUMBER AndAlso IsNumeric(FldVal) AndAlso IsNumeric(FldVal2))
  244.             If ew_NotEmpty(FldVal) AndAlso ew_NotEmpty(FldVal2) AndAlso IsValidValue Then
  245.                 sWrk = "x_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldVal) & _
  246.                     "&y_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldVal2) & _
  247.                     "&z_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldOpr)
  248.             End If
  249.         ElseIf ew_SameText(FldOpr, "IS NULL") OrElse ew_SameText(FldOpr, "IS NOT NULL") Then
  250.             sWrk = "x_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldVal) & _
  251.                 "&z_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldOpr)
  252.         Else
  253.             IsValidValue = (Fld.FldDataType <> EW_DATATYPE_NUMBER) OrElse _
  254.                 (Fld.FldDataType = EW_DATATYPE_NUMBER AndAlso IsNumeric(FldVal))
  255.             If ew_NotEmpty(FldVal) AndAlso IsValidValue AndAlso ew_IsValidOpr(FldOpr, Fld.FldDataType) Then
  256.                 sWrk = "x_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldVal) & _
  257.                     "&z_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldOpr)
  258.             End If
  259.             IsValidValue = (Fld.FldDataType <> EW_DATATYPE_NUMBER) OrElse _
  260.                 (Fld.FldDataType = EW_DATATYPE_NUMBER AndAlso IsNumeric(FldVal2))
  261.             If ew_NotEmpty(FldVal2) AndAlso IsValidValue AndAlso ew_IsValidOpr(FldOpr2, Fld.FldDataType) Then
  262.                 If sWrk <> "" Then sWrk = sWrk & "&v_" & FldParm & "=" & FldCond & "&"
  263.                 sWrk = sWrk & "y_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldVal2) & _
  264.                     "&w_" & FldParm & "=" & HttpContext.Current.Server.UrlEncode(FldOpr2)
  265.             End If
  266.         End If
  267.         If sWrk <> "" Then
  268.             If Url <> "" Then Url = Url & "&"
  269.             Url = Url & sWrk
  270.         End If
  271.     End Sub
  272.  
  273.     '
  274.     ' Load default values
  275.     '
  276.     Sub LoadDefaultValues()
  277.     End Sub
  278.  
  279.     '
  280.     '  Load search values for validation
  281.     '
  282.     Sub LoadSearchValues()
  283.         tblFixtureMaster.lfxMFG.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxMFG")
  284.         tblFixtureMaster.lfxMFG.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxMFG")
  285.         tblFixtureMaster.lfxModelType.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxModelType")
  286.         tblFixtureMaster.lfxModelType.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxModelType")
  287.         tblFixtureMaster.lfxSerialNumber.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxSerialNumber")
  288.         tblFixtureMaster.lfxSerialNumber.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxSerialNumber")
  289.         tblFixtureMaster.lfxLamp.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxLamp")
  290.         tblFixtureMaster.lfxLamp.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxLamp")
  291.         tblFixtureMaster.lfxLocationID.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxLocationID")
  292.         tblFixtureMaster.lfxLocationID.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxLocationID")
  293.         tblFixtureMaster.lfxHangPos.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxHangPos")
  294.         tblFixtureMaster.lfxHangPos.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxHangPos")
  295.         tblFixtureMaster.lfxChannel.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxChannel")
  296.         tblFixtureMaster.lfxChannel.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxChannel")
  297.         tblFixtureMaster.lfxNotes.AdvancedSearch.SearchValue = ObjForm.GetValue("x_lfxNotes")
  298.         tblFixtureMaster.lfxNotes.AdvancedSearch.SearchOperator = ObjForm.GetValue("z_lfxNotes")
  299.     End Sub
  300.  
  301.     '
  302.     ' Render row values based on field settings
  303.     '
  304.     Sub RenderRow()
  305.  
  306.         ' Row Rendering event
  307.         tblFixtureMaster.Row_Rendering()
  308.  
  309.         '
  310.         '  Common render codes for all row types
  311.         '
  312.         ' lfxMFG
  313.  
  314.         tblFixtureMaster.lfxMFG.CellCssStyle = ""
  315.         tblFixtureMaster.lfxMFG.CellCssClass = ""
  316.  
  317.         ' lfxModelType
  318.         tblFixtureMaster.lfxModelType.CellCssStyle = ""
  319.         tblFixtureMaster.lfxModelType.CellCssClass = ""
  320.  
  321.         ' lfxSerialNumber
  322.         tblFixtureMaster.lfxSerialNumber.CellCssStyle = ""
  323.         tblFixtureMaster.lfxSerialNumber.CellCssClass = ""
  324.  
  325.         ' lfxLamp
  326.         tblFixtureMaster.lfxLamp.CellCssStyle = ""
  327.         tblFixtureMaster.lfxLamp.CellCssClass = ""
  328.  
  329.         ' lfxLocationID
  330.         tblFixtureMaster.lfxLocationID.CellCssStyle = ""
  331.         tblFixtureMaster.lfxLocationID.CellCssClass = ""
  332.  
  333.         ' lfxHangPos
  334.         tblFixtureMaster.lfxHangPos.CellCssStyle = ""
  335.         tblFixtureMaster.lfxHangPos.CellCssClass = ""
  336.  
  337.         ' lfxChannel
  338.         tblFixtureMaster.lfxChannel.CellCssStyle = ""
  339.         tblFixtureMaster.lfxChannel.CellCssClass = ""
  340.  
  341.         ' lfxNotes
  342.         tblFixtureMaster.lfxNotes.CellCssStyle = ""
  343.         tblFixtureMaster.lfxNotes.CellCssClass = ""
  344.  
  345.         '
  346.         '  View  Row
  347.         '
  348.  
  349.         If tblFixtureMaster.RowType = EW_ROWTYPE_VIEW Then ' View row
  350.  
  351.             ' lfxMFG
  352.             tblFixtureMaster.lfxMFG.ViewValue = tblFixtureMaster.lfxMFG.CurrentValue
  353.             tblFixtureMaster.lfxMFG.CssStyle = ""
  354.             tblFixtureMaster.lfxMFG.CssClass = ""
  355.             tblFixtureMaster.lfxMFG.ViewCustomAttributes = ""
  356.  
  357.             ' lfxModelType
  358.             tblFixtureMaster.lfxModelType.ViewValue = tblFixtureMaster.lfxModelType.CurrentValue
  359.             tblFixtureMaster.lfxModelType.CssStyle = ""
  360.             tblFixtureMaster.lfxModelType.CssClass = ""
  361.             tblFixtureMaster.lfxModelType.ViewCustomAttributes = ""
  362.  
  363.             ' lfxSerialNumber
  364.             tblFixtureMaster.lfxSerialNumber.ViewValue = tblFixtureMaster.lfxSerialNumber.CurrentValue
  365.             tblFixtureMaster.lfxSerialNumber.CssStyle = ""
  366.             tblFixtureMaster.lfxSerialNumber.CssClass = ""
  367.             tblFixtureMaster.lfxSerialNumber.ViewCustomAttributes = ""
  368.  
  369.             ' lfxLamp
  370.             tblFixtureMaster.lfxLamp.ViewValue = tblFixtureMaster.lfxLamp.CurrentValue
  371.             tblFixtureMaster.lfxLamp.CssStyle = ""
  372.             tblFixtureMaster.lfxLamp.CssClass = ""
  373.             tblFixtureMaster.lfxLamp.ViewCustomAttributes = ""
  374.  
  375.             ' lfxLocationID
  376.             If ew_NotEmpty(tblFixtureMaster.lfxLocationID.CurrentValue) Then
  377.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(tblFixtureMaster.lfxLocationID.CurrentValue) & ""
  378.                 sSqlWrk = sSqlWrk & " AND (" & "[locLighting]=True" & ")"
  379.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  380.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  381.                 If RsWrk.Read() Then
  382.                     tblFixtureMaster.lfxLocationID.ViewValue = RsWrk("locDescription")
  383.                 Else
  384.                     tblFixtureMaster.lfxLocationID.ViewValue = tblFixtureMaster.lfxLocationID.CurrentValue
  385.                 End If
  386.                 Conn.CloseTempDataReader()
  387.             Else
  388.                 tblFixtureMaster.lfxLocationID.ViewValue = System.DBNull.Value
  389.             End If
  390.             tblFixtureMaster.lfxLocationID.CssStyle = ""
  391.             tblFixtureMaster.lfxLocationID.CssClass = ""
  392.             tblFixtureMaster.lfxLocationID.ViewCustomAttributes = ""
  393.  
  394.             ' lfxHangPos
  395.             tblFixtureMaster.lfxHangPos.ViewValue = tblFixtureMaster.lfxHangPos.CurrentValue
  396.             tblFixtureMaster.lfxHangPos.CssStyle = ""
  397.             tblFixtureMaster.lfxHangPos.CssClass = ""
  398.             tblFixtureMaster.lfxHangPos.ViewCustomAttributes = ""
  399.  
  400.             ' lfxChannel
  401.             tblFixtureMaster.lfxChannel.ViewValue = tblFixtureMaster.lfxChannel.CurrentValue
  402.             tblFixtureMaster.lfxChannel.CssStyle = ""
  403.             tblFixtureMaster.lfxChannel.CssClass = ""
  404.             tblFixtureMaster.lfxChannel.ViewCustomAttributes = ""
  405.  
  406.             ' lfxNotes
  407.             tblFixtureMaster.lfxNotes.ViewValue = tblFixtureMaster.lfxNotes.CurrentValue
  408.             tblFixtureMaster.lfxNotes.CssStyle = ""
  409.             tblFixtureMaster.lfxNotes.CssClass = ""
  410.             tblFixtureMaster.lfxNotes.ViewCustomAttributes = ""
  411.  
  412.             ' View refer script
  413.             ' lfxMFG
  414.  
  415.             tblFixtureMaster.lfxMFG.HrefValue = ""
  416.  
  417.             ' lfxModelType
  418.             tblFixtureMaster.lfxModelType.HrefValue = ""
  419.  
  420.             ' lfxSerialNumber
  421.             tblFixtureMaster.lfxSerialNumber.HrefValue = ""
  422.  
  423.             ' lfxLamp
  424.             tblFixtureMaster.lfxLamp.HrefValue = ""
  425.  
  426.             ' lfxLocationID
  427.             tblFixtureMaster.lfxLocationID.HrefValue = ""
  428.  
  429.             ' lfxHangPos
  430.             tblFixtureMaster.lfxHangPos.HrefValue = ""
  431.  
  432.             ' lfxChannel
  433.             tblFixtureMaster.lfxChannel.HrefValue = ""
  434.  
  435.             ' lfxNotes
  436.             tblFixtureMaster.lfxNotes.HrefValue = ""
  437.  
  438.         '
  439.         '  Search Row
  440.         '
  441.  
  442.         ElseIf tblFixtureMaster.RowType = EW_ROWTYPE_SEARCH Then ' Search row
  443.  
  444.             ' lfxMFG
  445.             tblFixtureMaster.lfxMFG.EditCustomAttributes = ""
  446.             tblFixtureMaster.lfxMFG.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxMFG.AdvancedSearch.SearchValue)
  447.  
  448.             ' lfxModelType
  449.             tblFixtureMaster.lfxModelType.EditCustomAttributes = ""
  450.             tblFixtureMaster.lfxModelType.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxModelType.AdvancedSearch.SearchValue)
  451.  
  452.             ' lfxSerialNumber
  453.             tblFixtureMaster.lfxSerialNumber.EditCustomAttributes = ""
  454.             tblFixtureMaster.lfxSerialNumber.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxSerialNumber.AdvancedSearch.SearchValue)
  455.  
  456.             ' lfxLamp
  457.             tblFixtureMaster.lfxLamp.EditCustomAttributes = ""
  458.             tblFixtureMaster.lfxLamp.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxLamp.AdvancedSearch.SearchValue)
  459.  
  460.             ' lfxLocationID
  461.             tblFixtureMaster.lfxLocationID.EditCustomAttributes = ""
  462.             sSqlWrk = "SELECT [locID], [locDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLocations]"
  463.             sWhereWrk = ""
  464.             If sWhereWrk <> "" Then sWhereWrk = "(" & sWhereWrk & ") AND "
  465.             sWhereWrk = sWhereWrk & "(" & "[locLighting]=True" & ")"
  466.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  467.             sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  468.             arwrk = Conn.GetRows(sSqlWrk)
  469.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  470.             tblFixtureMaster.lfxLocationID.EditValue = arwrk
  471.  
  472.             ' lfxHangPos
  473.             tblFixtureMaster.lfxHangPos.EditCustomAttributes = ""
  474.             tblFixtureMaster.lfxHangPos.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxHangPos.AdvancedSearch.SearchValue)
  475.  
  476.             ' lfxChannel
  477.             tblFixtureMaster.lfxChannel.EditCustomAttributes = ""
  478.             tblFixtureMaster.lfxChannel.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxChannel.AdvancedSearch.SearchValue)
  479.  
  480.             ' lfxNotes
  481.             tblFixtureMaster.lfxNotes.EditCustomAttributes = ""
  482.             tblFixtureMaster.lfxNotes.EditValue = ew_HtmlEncode(tblFixtureMaster.lfxNotes.AdvancedSearch.SearchValue)
  483.         End If
  484.  
  485.         ' Row Rendered event
  486.         tblFixtureMaster.Row_Rendered()
  487.     End Sub
  488.  
  489.     '
  490.     ' Validate search
  491.     '
  492.     Function ValidateSearch() As Boolean
  493.  
  494.         ' Initialize
  495.         ParentPage.gsSearchError = ""
  496.  
  497.         ' Check if validation required
  498.         If Not EW_SERVER_VALIDATE Then Return True ' Skip
  499.         If Not ew_CheckInteger(tblFixtureMaster.lfxChannel.AdvancedSearch.SearchValue) Then
  500.             If ParentPage.gsSearchError <> "" Then ParentPage.gsSearchError = ParentPage.gsSearchError & "<br />"
  501.             ParentPage.gsSearchError = ParentPage.gsSearchError & "Incorrect integer - Channel"
  502.         End If
  503.  
  504.         ' Return validate result    
  505.         Dim Valid As Boolean = (ParentPage.gsSearchError = "")
  506.  
  507.         ' Form_CustomValidate event
  508.         Dim sFormCustomError As String = ""
  509.         Valid = Valid And Form_CustomValidate(sFormCustomError)
  510.         If sFormCustomError <> "" Then
  511.             If ParentPage.gsSearchError <> "" Then ParentPage.gsSearchError = ParentPage.gsSearchError & "<br />"
  512.             ParentPage.gsSearchError = ParentPage.gsSearchError & sFormCustomError
  513.         End If
  514.         Return Valid
  515.     End Function
  516.  
  517.     '
  518.     ' Load advanced search
  519.     '
  520.     Sub LoadAdvancedSearch()
  521.         tblFixtureMaster.lfxMFG.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxMFG")
  522.         tblFixtureMaster.lfxModelType.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxModelType")
  523.         tblFixtureMaster.lfxSerialNumber.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxSerialNumber")
  524.         tblFixtureMaster.lfxLamp.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxLamp")
  525.         tblFixtureMaster.lfxLocationID.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxLocationID")
  526.         tblFixtureMaster.lfxHangPos.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxHangPos")
  527.         tblFixtureMaster.lfxChannel.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxChannel")
  528.         tblFixtureMaster.lfxNotes.AdvancedSearch.SearchValue = tblFixtureMaster.GetAdvancedSearch("x_lfxNotes")
  529.     End Sub
  530.  
  531.         ' Page Load event
  532.         Public Sub Page_Load()
  533.  
  534.             'HttpContext.Current.Response.Write("Page Load")
  535.         End Sub
  536.  
  537.         ' Page Unload event
  538.         Public Sub Page_Unload()
  539.  
  540.             'HttpContext.Current.Response.Write("Page Unload")
  541.         End Sub
  542.  
  543.     ' Form Custom Validate event
  544.     Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  545.  
  546.         'Return error message in CustomError
  547.         Return True
  548.     End Function
  549.     End Class
  550.  
  551.     '
  552.     ' ASP.NET Page_Load event
  553.     '
  554.  
  555.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  556.         Response.Buffer = EW_RESPONSE_BUFFER
  557.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  558.  
  559.         ' Page init
  560.         tblFixtureMaster_search = New ctblFixtureMaster_search(Me)        
  561.         tblFixtureMaster_search.Page_Init()
  562.  
  563.         ' Page main processing
  564.         tblFixtureMaster_search.Page_Main()
  565.     End Sub
  566.  
  567.     '
  568.     ' ASP.NET Page_Unload event
  569.     '
  570.  
  571.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  572.  
  573.         ' Dispose page object
  574.         If tblFixtureMaster_search IsNot Nothing Then tblFixtureMaster_search.Dispose()
  575.     End Sub
  576. End Class
  577.