home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / ltgFixtureMasterdelete.aspx.vb < prev    next >
Text File  |  2014-01-25  |  20KB  |  674 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 ltgFixtureMasterdelete
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public ltgFixtureMaster_delete As cltgFixtureMaster_delete
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class cltgFixtureMaster_delete
  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 ltgFixtureMaster.UseTokenInUrl Then Url = Url & "t=" & ltgFixtureMaster.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 ltgFixtureMaster.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (ltgFixtureMaster.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (ltgFixtureMaster.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' ltgFixtureMaster
  57.         Public Property ltgFixtureMaster() As cltgFixtureMaster
  58.             Get                
  59.                 Return ParentPage.ltgFixtureMaster
  60.             End Get
  61.             Set(ByVal v As cltgFixtureMaster)
  62.                 ParentPage.ltgFixtureMaster = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' ltgFixtureMaster
  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 = "delete"
  85.             m_PageObjName = "ltgFixtureMaster_delete"
  86.             m_PageObjTypeName = "cltgFixtureMaster_delete"
  87.  
  88.             ' Table Name
  89.             m_TableName = "ltgFixtureMaster"
  90.  
  91.             ' Initialize table object
  92.             ltgFixtureMaster = New cltgFixtureMaster(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.CanDelete Then
  121.                 Security.SaveLastUrl()
  122.                 Page_Terminate("ltgFixtureMasterlist.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.             ltgFixtureMaster.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.     Public lTotalRecs As Integer
  175.  
  176.     Public lRecCnt As Integer
  177.  
  178.     Public arRecKeys() As String
  179.  
  180.     '
  181.     ' Page main processing
  182.     '
  183.     Sub Page_Main()
  184.         Dim sKey As String = ""
  185.         Dim bSingleDelete As Boolean = True ' Initialize as single delete
  186.         Dim nKeySelected As Integer = 0 ' Initialize selected key count
  187.         Dim sKeyFld As String, arKeyFlds() As String
  188.         Dim sFilter As String        
  189.  
  190.         ' Load Key Parameters
  191.         If ew_Get("lfxID") <> "" Then
  192.             ltgFixtureMaster.lfxID.QueryStringValue = ew_Get("lfxID")
  193.             If Not IsNumeric(ltgFixtureMaster.lfxID.QueryStringValue) Then
  194.             Page_Terminate("ltgFixtureMasterlist.aspx") ' Prevent SQL injection, return to list
  195.             End If
  196.             sKey = sKey & ltgFixtureMaster.lfxID.QueryStringValue
  197.         Else
  198.             bSingleDelete = False
  199.         End If
  200.         If bSingleDelete Then
  201.             nKeySelected = 1 ' Set up key selected count
  202.             Array.Resize(arRecKeys, 1) ' Set up key
  203.             arRecKeys(0) = sKey
  204.         Else
  205.             If HttpContext.Current.Request.Form("key_m") IsNot Nothing Then ' Key in form
  206.                 arRecKeys = HttpContext.Current.Request.Form.GetValues("key_m")
  207.                 nKeySelected = arRecKeys.Length                
  208.             End If
  209.         End If
  210.         If nKeySelected <= 0 Then Page_Terminate("ltgFixtureMasterlist.aspx") ' No key specified, return to list
  211.  
  212.         ' Build filter
  213.         For i As Integer = 0 to arRecKeys.GetUpperBound(0)
  214.             sKey = arRecKeys(i).Trim()
  215.             sFilter = sFilter & "("
  216.  
  217.             ' Set up key field
  218.             sKeyFld = sKey
  219.             If Not IsNumeric(sKeyFld) Then Page_Terminate("ltgFixtureMasterlist.aspx") ' Prevent SQL injection, return to list
  220.             sFilter = sFilter & "[lfxID]=" & ew_AdjustSql(sKeyFld) & " AND "
  221.             If sFilter.EndsWith(" AND ") Then sFilter = sFilter.Substring(0, sFilter.Length-5) & ") OR "
  222.         Next
  223.         If sFilter.EndsWith(" OR ") Then sFilter = sFilter.Substring(0, sFilter.Length-4)
  224.  
  225.         ' Set up filter (SQL WHERE clause)
  226.         ' SQL constructor in ltgFixtureMaster class, ltgFixtureMasterinfo.aspx
  227.  
  228.         ltgFixtureMaster.CurrentFilter = sFilter
  229.  
  230.         ' Get action
  231.         If ew_Post("a_delete") <> "" Then
  232.             ltgFixtureMaster.CurrentAction = ew_Post("a_delete")
  233.         Else
  234.             ltgFixtureMaster.CurrentAction = "I"    ' Display record
  235.         End If
  236.         Select Case ltgFixtureMaster.CurrentAction
  237.             Case "D" ' Delete
  238.                 ltgFixtureMaster.SendEmail = True ' Send email on delete success
  239.                 If DeleteRows() Then ' delete rows
  240.                     Message = "Delete succeeded" ' Set up success message
  241.                 Page_Terminate(ltgFixtureMaster.ReturnUrl) ' Return to caller
  242.                 End If
  243.         End Select
  244.     End Sub
  245.  
  246.     '
  247.     '  Function DeleteRows
  248.     '  - Delete Records based on current filter
  249.     '
  250.     Function DeleteRows() As Boolean
  251.         Dim sKey As String, sThisKey As String, sKeyFld As String
  252.         Dim arKeyFlds() As String
  253.         Dim RsDelete As OleDbDataReader = Nothing
  254.         Dim sSql As String, sWrkFilter As String 
  255.         Dim RsOld As ArrayList
  256.         DeleteRows = True
  257.         sWrkFilter = ltgFixtureMaster.CurrentFilter
  258.  
  259.         ' Set up filter (SQL WHERE Clause)
  260.         ' SQL constructor in ltgFixtureMaster class, ltgFixtureMasterinfo.aspx
  261.  
  262.         ltgFixtureMaster.CurrentFilter = sWrkFilter
  263.         sSql = ltgFixtureMaster.SQL
  264.         Conn.BeginTrans() ' Begin transaction
  265.         Try
  266.             RsDelete = Conn.GetDataReader(sSql)
  267.             If Not RsDelete.HasRows Then
  268.                 Message = "No records found" ' No record found
  269.                 RsDelete.Close()
  270.                 RsDelete.Dispose()                    
  271.                 Return False
  272.             End If
  273.         Catch e As Exception
  274.             If EW_DEBUG_ENABLED Then Throw
  275.             Message = e.Message
  276.             Return False
  277.         End Try
  278.  
  279.         ' Clone old rows
  280.         RsOld = Conn.GetRows(RsDelete)
  281.         RsDelete.Close()
  282.         RsDelete.Dispose()
  283.  
  284.         ' Call Row_Deleting event
  285.         If DeleteRows Then
  286.             For Each Row As OrderedDictionary in RsOld
  287.                 DeleteRows = ltgFixtureMaster.Row_Deleting(Row)
  288.                 If Not DeleteRows Then Exit For
  289.             Next Row
  290.         End If
  291.         If DeleteRows Then
  292.             sKey = ""
  293.             For Each Row As OrderedDictionary in RsOld
  294.                 sThisKey = ""
  295.                 If sThisKey <> "" Then sThisKey = sThisKey & EW_COMPOSITE_KEY_SEPARATOR
  296.                 sThisKey = sThisKey & Convert.ToString(Row("lfxID"))
  297.                 Try
  298.                     ltgFixtureMaster.Delete(Row)
  299.                 Catch e As Exception
  300.                     If EW_DEBUG_ENABLED Then Throw            
  301.                     Message = e.Message ' Set up error message
  302.                     DeleteRows = False
  303.                     Exit For
  304.                 End Try
  305.                 If sKey <> "" Then sKey = sKey & ", "
  306.                 sKey = sKey & sThisKey
  307.             Next Row
  308.         Else
  309.  
  310.             ' Set up error message
  311.             If ltgFixtureMaster.CancelMessage <> "" Then
  312.                 Message = ltgFixtureMaster.CancelMessage
  313.                 ltgFixtureMaster.CancelMessage = ""
  314.             Else
  315.                 Message = "Delete cancelled"
  316.             End If
  317.         End If
  318.         If DeleteRows Then
  319.  
  320.             ' Commit the changes
  321.             Conn.CommitTrans()                
  322.  
  323.             ' Row deleted event
  324.             For Each Row As OrderedDictionary in RsOld
  325.                 ltgFixtureMaster.Row_Deleted(Row)
  326.             Next
  327.         Else
  328.             Conn.RollbackTrans() ' Rollback transaction            
  329.         End If
  330.     End Function
  331.  
  332.     '
  333.     ' Load default values
  334.     '
  335.     Sub LoadDefaultValues()
  336.     End Sub
  337.  
  338.     '
  339.     ' Load recordset
  340.     '
  341.     Function LoadRecordset() As OleDbDataReader
  342.  
  343.         ' Recordset Selecting event
  344.         ltgFixtureMaster.Recordset_Selecting(ltgFixtureMaster.CurrentFilter)
  345.  
  346.         ' Load list page SQL
  347.         Dim sSql As String = ltgFixtureMaster.ListSQL
  348.  
  349.         ' Write SQL for debug
  350.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  351.  
  352.         ' Count
  353.         lTotalRecs = -1        
  354.         Try            
  355.             If sSql.StartsWith("SELECT * FROM ", StringComparison.InvariantCultureIgnoreCase) AndAlso _                
  356.                 ew_Empty(ltgFixtureMaster.SqlGroupBy) AndAlso _
  357.                 ew_Empty(ltgFixtureMaster.SqlHaving) Then
  358.                 Dim sCntSql As String = ltgFixtureMaster.SelectCountSQL
  359.  
  360.                 ' Write SQL for debug
  361.                 If EW_DEBUG_ENABLED Then ew_Write("<br>" & sCntSql)
  362.                 lTotalRecs = Conn.ExecuteScalar(sCntSql)
  363.             End If            
  364.         Catch
  365.         End Try
  366.  
  367.         ' Load recordset
  368.         Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  369.         If lTotalRecs < 0 AndAlso Rs.HasRows Then
  370.             lTotalRecs = 0
  371.             While Rs.Read()
  372.                 lTotalRecs = lTotalRecs + 1
  373.             End While
  374.             Rs.Close()        
  375.             Rs = Conn.GetDataReader(sSql)
  376.         End If
  377.  
  378.         ' Recordset Selected event
  379.         ltgFixtureMaster.Recordset_Selected(Rs)
  380.         Return Rs
  381.     End Function
  382.  
  383.     '
  384.     ' Load row based on key values
  385.     '
  386.     Function LoadRow() As Boolean
  387.         Dim RsRow As OleDbDataReader
  388.         Dim sFilter As String = ltgFixtureMaster.KeyFilter
  389.  
  390.         ' Row Selecting event
  391.         ltgFixtureMaster.Row_Selecting(sFilter)
  392.  
  393.         ' Load SQL based on filter
  394.         ltgFixtureMaster.CurrentFilter = sFilter
  395.         Dim sSql As String = ltgFixtureMaster.SQL
  396.  
  397.         ' Write SQL for debug
  398.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  399.         Try
  400.             RsRow = Conn.GetTempDataReader(sSql)    
  401.             If Not RsRow.Read() Then
  402.                 Return False
  403.             Else                
  404.                 LoadRowValues(RsRow) ' Load row values
  405.  
  406.                 ' Row Selected event
  407.                 ltgFixtureMaster.Row_Selected(RsRow)
  408.                 Return True    
  409.             End If
  410.         Catch
  411.             If EW_DEBUG_ENABLED Then Throw
  412.             Return False
  413.         Finally
  414.             Conn.CloseTempDataReader()
  415.         End Try
  416.     End Function
  417.  
  418.     '
  419.     ' Load row values from recordset
  420.     '
  421.     Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
  422.         ltgFixtureMaster.lfxID.DbValue = RsRow("lfxID")
  423.         ltgFixtureMaster.lfxCode.DbValue = RsRow("lfxCode")
  424.         ltgFixtureMaster.lfxDescription.DbValue = RsRow("lfxDescription")
  425.         ltgFixtureMaster.lfxMFG.DbValue = RsRow("lfxMFG")
  426.         ltgFixtureMaster.lfxModel.DbValue = RsRow("lfxModel")
  427.         ltgFixtureMaster.lfxSerialNumber.DbValue = RsRow("lfxSerialNumber")
  428.         ltgFixtureMaster.lfxLamp.DbValue = RsRow("lfxLamp")
  429.         ltgFixtureMaster.lfxFixtureTypeID.DbValue = RsRow("lfxFixtureTypeID")
  430.         ltgFixtureMaster.lfxLocationID.DbValue = RsRow("lfxLocationID")
  431.         ltgFixtureMaster.lfxChannel.DbValue = RsRow("lfxChannel")
  432.         ltgFixtureMaster.lfxIsActive.DbValue = IIf(ew_ConvertToBool(RsRow("lfxIsActive")), "1", "0")
  433.         ltgFixtureMaster.lfxCreatedBy.DbValue = RsRow("lfxCreatedBy")
  434.         ltgFixtureMaster.lfxCreatedOn.DbValue = RsRow("lfxCreatedOn")
  435.         ltgFixtureMaster.lfxModifiedBy.DbValue = RsRow("lfxModifiedBy")
  436.         ltgFixtureMaster.lfxModifiedOn.DbValue = RsRow("lfxModifiedOn")
  437.     End Sub
  438.  
  439.     '
  440.     ' Render row values based on field settings
  441.     '
  442.     Sub RenderRow()
  443.  
  444.         ' Row Rendering event
  445.         ltgFixtureMaster.Row_Rendering()
  446.  
  447.         '
  448.         '  Common render codes for all row types
  449.         '
  450.         ' lfxCode
  451.  
  452.         ltgFixtureMaster.lfxCode.CellCssStyle = ""
  453.         ltgFixtureMaster.lfxCode.CellCssClass = ""
  454.  
  455.         ' lfxDescription
  456.         ltgFixtureMaster.lfxDescription.CellCssStyle = ""
  457.         ltgFixtureMaster.lfxDescription.CellCssClass = ""
  458.  
  459.         ' lfxMFG
  460.         ltgFixtureMaster.lfxMFG.CellCssStyle = ""
  461.         ltgFixtureMaster.lfxMFG.CellCssClass = ""
  462.  
  463.         ' lfxModel
  464.         ltgFixtureMaster.lfxModel.CellCssStyle = ""
  465.         ltgFixtureMaster.lfxModel.CellCssClass = ""
  466.  
  467.         ' lfxSerialNumber
  468.         ltgFixtureMaster.lfxSerialNumber.CellCssStyle = ""
  469.         ltgFixtureMaster.lfxSerialNumber.CellCssClass = ""
  470.  
  471.         ' lfxFixtureTypeID
  472.         ltgFixtureMaster.lfxFixtureTypeID.CellCssStyle = ""
  473.         ltgFixtureMaster.lfxFixtureTypeID.CellCssClass = ""
  474.  
  475.         ' lfxLocationID
  476.         ltgFixtureMaster.lfxLocationID.CellCssStyle = ""
  477.         ltgFixtureMaster.lfxLocationID.CellCssClass = ""
  478.  
  479.         '
  480.         '  View  Row
  481.         '
  482.  
  483.         If ltgFixtureMaster.RowType = EW_ROWTYPE_VIEW Then ' View row
  484.  
  485.             ' lfxID
  486.             ltgFixtureMaster.lfxID.ViewValue = ltgFixtureMaster.lfxID.CurrentValue
  487.             ltgFixtureMaster.lfxID.CssStyle = ""
  488.             ltgFixtureMaster.lfxID.CssClass = ""
  489.             ltgFixtureMaster.lfxID.ViewCustomAttributes = ""
  490.  
  491.             ' lfxCode
  492.             ltgFixtureMaster.lfxCode.ViewValue = ltgFixtureMaster.lfxCode.CurrentValue
  493.             ltgFixtureMaster.lfxCode.CssStyle = ""
  494.             ltgFixtureMaster.lfxCode.CssClass = ""
  495.             ltgFixtureMaster.lfxCode.ViewCustomAttributes = ""
  496.  
  497.             ' lfxDescription
  498.             ltgFixtureMaster.lfxDescription.ViewValue = ltgFixtureMaster.lfxDescription.CurrentValue
  499.             ltgFixtureMaster.lfxDescription.CssStyle = ""
  500.             ltgFixtureMaster.lfxDescription.CssClass = ""
  501.             ltgFixtureMaster.lfxDescription.ViewCustomAttributes = ""
  502.  
  503.             ' lfxMFG
  504.             ltgFixtureMaster.lfxMFG.ViewValue = ltgFixtureMaster.lfxMFG.CurrentValue
  505.             ltgFixtureMaster.lfxMFG.CssStyle = ""
  506.             ltgFixtureMaster.lfxMFG.CssClass = ""
  507.             ltgFixtureMaster.lfxMFG.ViewCustomAttributes = ""
  508.  
  509.             ' lfxModel
  510.             ltgFixtureMaster.lfxModel.ViewValue = ltgFixtureMaster.lfxModel.CurrentValue
  511.             ltgFixtureMaster.lfxModel.CssStyle = ""
  512.             ltgFixtureMaster.lfxModel.CssClass = ""
  513.             ltgFixtureMaster.lfxModel.ViewCustomAttributes = ""
  514.  
  515.             ' lfxSerialNumber
  516.             ltgFixtureMaster.lfxSerialNumber.ViewValue = ltgFixtureMaster.lfxSerialNumber.CurrentValue
  517.             ltgFixtureMaster.lfxSerialNumber.CssStyle = ""
  518.             ltgFixtureMaster.lfxSerialNumber.CssClass = ""
  519.             ltgFixtureMaster.lfxSerialNumber.ViewCustomAttributes = ""
  520.  
  521.             ' lfxLamp
  522.             ltgFixtureMaster.lfxLamp.ViewValue = ltgFixtureMaster.lfxLamp.CurrentValue
  523.             ltgFixtureMaster.lfxLamp.CssStyle = ""
  524.             ltgFixtureMaster.lfxLamp.CssClass = ""
  525.             ltgFixtureMaster.lfxLamp.ViewCustomAttributes = ""
  526.  
  527.             ' lfxFixtureTypeID
  528.             If ew_NotEmpty(ltgFixtureMaster.lfxFixtureTypeID.CurrentValue) Then
  529.                 sSqlWrk = "SELECT [ftyDescription] FROM [ltgFixtureType] WHERE [ftyID] = " & ew_AdjustSql(ltgFixtureMaster.lfxFixtureTypeID.CurrentValue) & ""
  530.                 sSqlWrk = sSqlWrk & " AND (" & "[ftyIsActive] = True" & ")"
  531.                 sSqlWrk = sSqlWrk & " ORDER BY [ftyDescription] "
  532.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  533.                 If RsWrk.Read() Then
  534.                     ltgFixtureMaster.lfxFixtureTypeID.ViewValue = RsWrk("ftyDescription")
  535.                 Else
  536.                     ltgFixtureMaster.lfxFixtureTypeID.ViewValue = ltgFixtureMaster.lfxFixtureTypeID.CurrentValue
  537.                 End If
  538.                 Conn.CloseTempDataReader()
  539.             Else
  540.                 ltgFixtureMaster.lfxFixtureTypeID.ViewValue = System.DBNull.Value
  541.             End If
  542.             ltgFixtureMaster.lfxFixtureTypeID.CssStyle = ""
  543.             ltgFixtureMaster.lfxFixtureTypeID.CssClass = ""
  544.             ltgFixtureMaster.lfxFixtureTypeID.ViewCustomAttributes = ""
  545.  
  546.             ' lfxLocationID
  547.             If ew_NotEmpty(ltgFixtureMaster.lfxLocationID.CurrentValue) Then
  548.                 sSqlWrk = "SELECT [floDescription] FROM [ltgFixtureLocation] WHERE [floID] = " & ew_AdjustSql(ltgFixtureMaster.lfxLocationID.CurrentValue) & ""
  549.                 sSqlWrk = sSqlWrk & " AND (" & "[floIsActive]=True" & ")"
  550.                 sSqlWrk = sSqlWrk & " ORDER BY [floDescription] "
  551.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  552.                 If RsWrk.Read() Then
  553.                     ltgFixtureMaster.lfxLocationID.ViewValue = RsWrk("floDescription")
  554.                 Else
  555.                     ltgFixtureMaster.lfxLocationID.ViewValue = ltgFixtureMaster.lfxLocationID.CurrentValue
  556.                 End If
  557.                 Conn.CloseTempDataReader()
  558.             Else
  559.                 ltgFixtureMaster.lfxLocationID.ViewValue = System.DBNull.Value
  560.             End If
  561.             ltgFixtureMaster.lfxLocationID.CssStyle = ""
  562.             ltgFixtureMaster.lfxLocationID.CssClass = ""
  563.             ltgFixtureMaster.lfxLocationID.ViewCustomAttributes = ""
  564.  
  565.             ' lfxChannel
  566.             ltgFixtureMaster.lfxChannel.ViewValue = ltgFixtureMaster.lfxChannel.CurrentValue
  567.             ltgFixtureMaster.lfxChannel.CssStyle = ""
  568.             ltgFixtureMaster.lfxChannel.CssClass = ""
  569.             ltgFixtureMaster.lfxChannel.ViewCustomAttributes = ""
  570.  
  571.             ' lfxIsActive
  572.             If Convert.ToString(ltgFixtureMaster.lfxIsActive.CurrentValue) = "1" Then
  573.                 ltgFixtureMaster.lfxIsActive.ViewValue = "Yes"
  574.             Else
  575.                 ltgFixtureMaster.lfxIsActive.ViewValue = "No"
  576.             End If
  577.             ltgFixtureMaster.lfxIsActive.CssStyle = ""
  578.             ltgFixtureMaster.lfxIsActive.CssClass = ""
  579.             ltgFixtureMaster.lfxIsActive.ViewCustomAttributes = ""
  580.  
  581.             ' lfxCreatedBy
  582.             ltgFixtureMaster.lfxCreatedBy.ViewValue = ltgFixtureMaster.lfxCreatedBy.CurrentValue
  583.             ltgFixtureMaster.lfxCreatedBy.CssStyle = ""
  584.             ltgFixtureMaster.lfxCreatedBy.CssClass = ""
  585.             ltgFixtureMaster.lfxCreatedBy.ViewCustomAttributes = ""
  586.  
  587.             ' lfxCreatedOn
  588.             ltgFixtureMaster.lfxCreatedOn.ViewValue = ltgFixtureMaster.lfxCreatedOn.CurrentValue
  589.             ltgFixtureMaster.lfxCreatedOn.ViewValue = ew_FormatDateTime(ltgFixtureMaster.lfxCreatedOn.ViewValue, 6)
  590.             ltgFixtureMaster.lfxCreatedOn.CssStyle = ""
  591.             ltgFixtureMaster.lfxCreatedOn.CssClass = ""
  592.             ltgFixtureMaster.lfxCreatedOn.ViewCustomAttributes = ""
  593.  
  594.             ' lfxModifiedBy
  595.             ltgFixtureMaster.lfxModifiedBy.ViewValue = ltgFixtureMaster.lfxModifiedBy.CurrentValue
  596.             ltgFixtureMaster.lfxModifiedBy.CssStyle = ""
  597.             ltgFixtureMaster.lfxModifiedBy.CssClass = ""
  598.             ltgFixtureMaster.lfxModifiedBy.ViewCustomAttributes = ""
  599.  
  600.             ' lfxModifiedOn
  601.             ltgFixtureMaster.lfxModifiedOn.ViewValue = ltgFixtureMaster.lfxModifiedOn.CurrentValue
  602.             ltgFixtureMaster.lfxModifiedOn.ViewValue = ew_FormatDateTime(ltgFixtureMaster.lfxModifiedOn.ViewValue, 6)
  603.             ltgFixtureMaster.lfxModifiedOn.CssStyle = ""
  604.             ltgFixtureMaster.lfxModifiedOn.CssClass = ""
  605.             ltgFixtureMaster.lfxModifiedOn.ViewCustomAttributes = ""
  606.  
  607.             ' View refer script
  608.             ' lfxCode
  609.  
  610.             ltgFixtureMaster.lfxCode.HrefValue = ""
  611.  
  612.             ' lfxDescription
  613.             ltgFixtureMaster.lfxDescription.HrefValue = ""
  614.  
  615.             ' lfxMFG
  616.             ltgFixtureMaster.lfxMFG.HrefValue = ""
  617.  
  618.             ' lfxModel
  619.             ltgFixtureMaster.lfxModel.HrefValue = ""
  620.  
  621.             ' lfxSerialNumber
  622.             ltgFixtureMaster.lfxSerialNumber.HrefValue = ""
  623.  
  624.             ' lfxFixtureTypeID
  625.             ltgFixtureMaster.lfxFixtureTypeID.HrefValue = ""
  626.  
  627.             ' lfxLocationID
  628.             ltgFixtureMaster.lfxLocationID.HrefValue = ""
  629.         End If
  630.  
  631.         ' Row Rendered event
  632.         ltgFixtureMaster.Row_Rendered()
  633.     End Sub
  634.  
  635.         ' Page Load event
  636.         Public Sub Page_Load()
  637.  
  638.             'HttpContext.Current.Response.Write("Page Load")
  639.         End Sub
  640.  
  641.         ' Page Unload event
  642.         Public Sub Page_Unload()
  643.  
  644.             'HttpContext.Current.Response.Write("Page Unload")
  645.         End Sub
  646.     End Class
  647.  
  648.     '
  649.     ' ASP.NET Page_Load event
  650.     '
  651.  
  652.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  653.         Response.Buffer = EW_RESPONSE_BUFFER
  654.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  655.  
  656.         ' Page init
  657.         ltgFixtureMaster_delete = New cltgFixtureMaster_delete(Me)        
  658.         ltgFixtureMaster_delete.Page_Init()
  659.  
  660.         ' Page main processing
  661.         ltgFixtureMaster_delete.Page_Main()
  662.     End Sub
  663.  
  664.     '
  665.     ' ASP.NET Page_Unload event
  666.     '
  667.  
  668.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  669.  
  670.         ' Dispose page object
  671.         If ltgFixtureMaster_delete IsNot Nothing Then ltgFixtureMaster_delete.Dispose()
  672.     End Sub
  673. End Class
  674.