home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblLPRdelete.aspx.vb < prev    next >
Text File  |  2010-08-24  |  21KB  |  754 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 tblLPRdelete
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblLPR_delete As ctblLPR_delete
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblLPR_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 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 = "delete"
  85.             m_PageObjName = "tblLPR_delete"
  86.             m_PageObjTypeName = "ctblLPR_delete"
  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.         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("tblLPRlist.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.             If Security.IsLoggedIn() And ew_Empty(Security.CurrentUserID) Then
  132.                 Message = "You do not have the right permission to view the page"
  133.                 Page_Terminate("tblLPRlist.aspx")
  134.             End If
  135.  
  136.             ' Global page loading event (in ewglobal*.vb)
  137.             ParentPage.Page_Loading()
  138.  
  139.             ' Page load event, used in current page
  140.             Page_Load()
  141.         End Sub
  142.  
  143.         '
  144.         '  Class terminate
  145.         '  - clean up page object
  146.         '
  147.         Public Sub Dispose() Implements IDisposable.Dispose
  148.             Page_Terminate("")
  149.         End Sub
  150.  
  151.         '
  152.         '  Sub Page_Terminate
  153.         '  - called when exit page
  154.         '  - clean up connection and objects
  155.         '  - if URL specified, redirect to URL
  156.         '
  157.         Sub Page_Terminate(url As String)
  158.  
  159.             ' Page unload event, used in current page
  160.             Page_Unload()
  161.  
  162.             ' Global page unloaded event (in ewglobal*.vb)
  163.             ParentPage.Page_Unloaded()
  164.  
  165.             ' Close connection
  166.             Conn.Dispose()
  167.             Security = Nothing
  168.             tblLPR.Dispose()
  169.             tblEmployees.Dispose()
  170.  
  171.             ' Go to URL if specified
  172.             If url <> "" Then
  173.                 HttpContext.Current.Response.Clear()
  174.                 HttpContext.Current.Response.Redirect(url)
  175.             End If
  176.         End Sub
  177.  
  178.     Public lTotalRecs As Integer
  179.  
  180.     Public lRecCnt As Integer
  181.  
  182.     Public arRecKeys() As String
  183.  
  184.     '
  185.     ' Page main processing
  186.     '
  187.     Sub Page_Main()
  188.         Dim sKey As String = ""
  189.         Dim bSingleDelete As Boolean = True ' Initialize as single delete
  190.         Dim nKeySelected As Integer = 0 ' Initialize selected key count
  191.         Dim sKeyFld As String, arKeyFlds() As String
  192.         Dim sFilter As String        
  193.  
  194.         ' Load Key Parameters
  195.         If ew_Get("lprID") <> "" Then
  196.             tblLPR.lprID.QueryStringValue = ew_Get("lprID")
  197.             If Not IsNumeric(tblLPR.lprID.QueryStringValue) Then
  198.             Page_Terminate("tblLPRlist.aspx") ' Prevent SQL injection, return to list
  199.             End If
  200.             sKey = sKey & tblLPR.lprID.QueryStringValue
  201.         Else
  202.             bSingleDelete = False
  203.         End If
  204.         If bSingleDelete Then
  205.             nKeySelected = 1 ' Set up key selected count
  206.             Array.Resize(arRecKeys, 1) ' Set up key
  207.             arRecKeys(0) = sKey
  208.         Else
  209.             If HttpContext.Current.Request.Form("key_m") IsNot Nothing Then ' Key in form
  210.                 arRecKeys = HttpContext.Current.Request.Form.GetValues("key_m")
  211.                 nKeySelected = arRecKeys.Length                
  212.             End If
  213.         End If
  214.         If nKeySelected <= 0 Then Page_Terminate("tblLPRlist.aspx") ' No key specified, return to list
  215.  
  216.         ' Build filter
  217.         For i As Integer = 0 to arRecKeys.GetUpperBound(0)
  218.             sKey = arRecKeys(i).Trim()
  219.             sFilter = sFilter & "("
  220.  
  221.             ' Set up key field
  222.             sKeyFld = sKey
  223.             If Not IsNumeric(sKeyFld) Then Page_Terminate("tblLPRlist.aspx") ' Prevent SQL injection, return to list
  224.             sFilter = sFilter & "[lprID]=" & ew_AdjustSql(sKeyFld) & " AND "
  225.             If sFilter.EndsWith(" AND ") Then sFilter = sFilter.Substring(0, sFilter.Length-5) & ") OR "
  226.         Next
  227.         If sFilter.EndsWith(" OR ") Then sFilter = sFilter.Substring(0, sFilter.Length-4)
  228.  
  229.         ' Set up filter (SQL WHERE clause)
  230.         ' SQL constructor in tblLPR class, tblLPRinfo.aspx
  231.  
  232.         tblLPR.CurrentFilter = sFilter
  233.  
  234.         ' Get action
  235.         If ew_Post("a_delete") <> "" Then
  236.             tblLPR.CurrentAction = ew_Post("a_delete")
  237.         Else
  238.             tblLPR.CurrentAction = "I"    ' Display record
  239.         End If
  240.         Select Case tblLPR.CurrentAction
  241.             Case "D" ' Delete
  242.                 tblLPR.SendEmail = True ' Send email on delete success
  243.                 If DeleteRows() Then ' delete rows
  244.                     Message = "Delete succeeded" ' Set up success message
  245.                 Page_Terminate(tblLPR.ReturnUrl) ' Return to caller
  246.                 End If
  247.         End Select
  248.     End Sub
  249.  
  250.     '
  251.     '  Function DeleteRows
  252.     '  - Delete Records based on current filter
  253.     '
  254.     Function DeleteRows() As Boolean
  255.         Dim sKey As String, sThisKey As String, sKeyFld As String
  256.         Dim arKeyFlds() As String
  257.         Dim RsDelete As OleDbDataReader = Nothing
  258.         Dim sSql As String, sWrkFilter As String 
  259.         Dim RsOld As ArrayList
  260.         DeleteRows = True
  261.         sWrkFilter = tblLPR.CurrentFilter
  262.  
  263.         ' Set up filter (SQL WHERE Clause)
  264.         ' SQL constructor in tblLPR class, tblLPRinfo.aspx
  265.  
  266.         tblLPR.CurrentFilter = sWrkFilter
  267.         sSql = tblLPR.SQL
  268.         Conn.BeginTrans() ' Begin transaction
  269.         Try
  270.             RsDelete = Conn.GetDataReader(sSql)
  271.             If Not RsDelete.HasRows Then
  272.                 Message = "No records found" ' No record found
  273.                 RsDelete.Close()
  274.                 RsDelete.Dispose()                    
  275.                 Return False
  276.             End If
  277.         Catch e As Exception
  278.             If EW_DEBUG_ENABLED Then Throw
  279.             Message = e.Message
  280.             Return False
  281.         End Try
  282.  
  283.         ' Clone old rows
  284.         RsOld = Conn.GetRows(RsDelete)
  285.         RsDelete.Close()
  286.         RsDelete.Dispose()
  287.  
  288.         ' Call Row_Deleting event
  289.         If DeleteRows Then
  290.             For Each Row As OrderedDictionary in RsOld
  291.                 DeleteRows = tblLPR.Row_Deleting(Row)
  292.                 If Not DeleteRows Then Exit For
  293.             Next Row
  294.         End If
  295.         If DeleteRows Then
  296.             sKey = ""
  297.             For Each Row As OrderedDictionary in RsOld
  298.                 sThisKey = ""
  299.                 If sThisKey <> "" Then sThisKey = sThisKey & EW_COMPOSITE_KEY_SEPARATOR
  300.                 sThisKey = sThisKey & Convert.ToString(Row("lprID"))
  301.                 Try
  302.                     tblLPR.Delete(Row)
  303.                 Catch e As Exception
  304.                     If EW_DEBUG_ENABLED Then Throw            
  305.                     Message = e.Message ' Set up error message
  306.                     DeleteRows = False
  307.                     Exit For
  308.                 End Try
  309.                 If sKey <> "" Then sKey = sKey & ", "
  310.                 sKey = sKey & sThisKey
  311.             Next Row
  312.         Else
  313.  
  314.             ' Set up error message
  315.             If tblLPR.CancelMessage <> "" Then
  316.                 Message = tblLPR.CancelMessage
  317.                 tblLPR.CancelMessage = ""
  318.             Else
  319.                 Message = "Delete cancelled"
  320.             End If
  321.         End If
  322.         If DeleteRows Then
  323.  
  324.             ' Commit the changes
  325.             Conn.CommitTrans()                
  326.  
  327.             ' Row deleted event
  328.             For Each Row As OrderedDictionary in RsOld
  329.                 tblLPR.Row_Deleted(Row)
  330.             Next
  331.         Else
  332.             Conn.RollbackTrans() ' Rollback transaction            
  333.         End If
  334.     End Function
  335.  
  336.     '
  337.     ' Load default values
  338.     '
  339.     Sub LoadDefaultValues()
  340.     End Sub
  341.  
  342.     '
  343.     ' Load recordset
  344.     '
  345.     Function LoadRecordset() As OleDbDataReader
  346.  
  347.         ' Recordset Selecting event
  348.         tblLPR.Recordset_Selecting(tblLPR.CurrentFilter)
  349.  
  350.         ' Load list page SQL
  351.         Dim sSql As String = tblLPR.ListSQL
  352.  
  353.         ' Write SQL for debug
  354.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  355.  
  356.         ' Count
  357.         lTotalRecs = -1        
  358.         Try            
  359.             If sSql.StartsWith("SELECT * FROM ", StringComparison.InvariantCultureIgnoreCase) AndAlso _                
  360.                 ew_Empty(tblLPR.SqlGroupBy) AndAlso _
  361.                 ew_Empty(tblLPR.SqlHaving) Then
  362.                 Dim sCntSql As String = tblLPR.SelectCountSQL
  363.  
  364.                 ' Write SQL for debug
  365.                 If EW_DEBUG_ENABLED Then ew_Write("<br>" & sCntSql)
  366.                 lTotalRecs = Conn.ExecuteScalar(sCntSql)
  367.             End If            
  368.         Catch
  369.         End Try
  370.  
  371.         ' Load recordset
  372.         Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  373.         If lTotalRecs < 0 AndAlso Rs.HasRows Then
  374.             lTotalRecs = 0
  375.             While Rs.Read()
  376.                 lTotalRecs = lTotalRecs + 1
  377.             End While
  378.             Rs.Close()        
  379.             Rs = Conn.GetDataReader(sSql)
  380.         End If
  381.  
  382.         ' Recordset Selected event
  383.         tblLPR.Recordset_Selected(Rs)
  384.         Return Rs
  385.     End Function
  386.  
  387.     '
  388.     ' Load row based on key values
  389.     '
  390.     Function LoadRow() As Boolean
  391.         Dim RsRow As OleDbDataReader
  392.         Dim sFilter As String = tblLPR.KeyFilter
  393.  
  394.         ' Row Selecting event
  395.         tblLPR.Row_Selecting(sFilter)
  396.  
  397.         ' Load SQL based on filter
  398.         tblLPR.CurrentFilter = sFilter
  399.         Dim sSql As String = tblLPR.SQL
  400.  
  401.         ' Write SQL for debug
  402.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  403.         Try
  404.             RsRow = Conn.GetTempDataReader(sSql)    
  405.             If Not RsRow.Read() Then
  406.                 Return False
  407.             Else                
  408.                 LoadRowValues(RsRow) ' Load row values
  409.  
  410.                 ' Row Selected event
  411.                 tblLPR.Row_Selected(RsRow)
  412.                 Return True    
  413.             End If
  414.         Catch
  415.             If EW_DEBUG_ENABLED Then Throw
  416.             Return False
  417.         Finally
  418.             Conn.CloseTempDataReader()
  419.         End Try
  420.     End Function
  421.  
  422.     '
  423.     ' Load row values from recordset
  424.     '
  425.     Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
  426.         tblLPR.lprID.DbValue = RsRow("lprID")
  427.         tblLPR.lprEmpID.DbValue = RsRow("lprEmpID")
  428.         tblLPR.lprDate.DbValue = RsRow("lprDate")
  429.         tblLPR.lprLocationID.DbValue = RsRow("lprLocationID")
  430.         tblLPR.lprFixtureLocationID.DbValue = RsRow("lprFixtureLocationID")
  431.         tblLPR.lprFixtureTypeID.DbValue = RsRow("lprFixtureTypeID")
  432.         tblLPR.lprFixtureNumber.DbValue = RsRow("lprFixtureNumber")
  433.         tblLPR.lprChannelNumber.DbValue = RsRow("lprChannelNumber")
  434.         tblLPR.lprPriority.DbValue = RsRow("lprPriority")
  435.         tblLPR.lprShortDesc.DbValue = RsRow("lprShortDesc")
  436.         tblLPR.lprSTID.DbValue = RsRow("lprSTID")
  437.         tblLPR.lprSTChangedBy.DbValue = RsRow("lprSTChangedBy")
  438.         tblLPR.lprDesc.DbValue = RsRow("lprDesc")
  439.         tblLPR.lprCreatedBy.DbValue = RsRow("lprCreatedBy")
  440.         tblLPR.lprCreatedOn.DbValue = RsRow("lprCreatedOn")
  441.         tblLPR.lprModifiedBy.DbValue = RsRow("lprModifiedBy")
  442.         tblLPR.lprModifiedOn.DbValue = RsRow("lprModifiedOn")
  443.     End Sub
  444.  
  445.     '
  446.     ' Render row values based on field settings
  447.     '
  448.     Sub RenderRow()
  449.  
  450.         ' Row Rendering event
  451.         tblLPR.Row_Rendering()
  452.  
  453.         '
  454.         '  Common render codes for all row types
  455.         '
  456.         ' lprEmpID
  457.  
  458.         tblLPR.lprEmpID.CellCssStyle = ""
  459.         tblLPR.lprEmpID.CellCssClass = ""
  460.  
  461.         ' lprDate
  462.         tblLPR.lprDate.CellCssStyle = ""
  463.         tblLPR.lprDate.CellCssClass = ""
  464.  
  465.         ' lprLocationID
  466.         tblLPR.lprLocationID.CellCssStyle = ""
  467.         tblLPR.lprLocationID.CellCssClass = ""
  468.  
  469.         ' lprFixtureLocationID
  470.         tblLPR.lprFixtureLocationID.CellCssStyle = ""
  471.         tblLPR.lprFixtureLocationID.CellCssClass = ""
  472.  
  473.         ' lprFixtureTypeID
  474.         tblLPR.lprFixtureTypeID.CellCssStyle = ""
  475.         tblLPR.lprFixtureTypeID.CellCssClass = ""
  476.  
  477.         ' lprFixtureNumber
  478.         tblLPR.lprFixtureNumber.CellCssStyle = ""
  479.         tblLPR.lprFixtureNumber.CellCssClass = ""
  480.  
  481.         ' lprChannelNumber
  482.         tblLPR.lprChannelNumber.CellCssStyle = ""
  483.         tblLPR.lprChannelNumber.CellCssClass = ""
  484.  
  485.         ' lprPriority
  486.         tblLPR.lprPriority.CellCssStyle = ""
  487.         tblLPR.lprPriority.CellCssClass = ""
  488.  
  489.         ' lprShortDesc
  490.         tblLPR.lprShortDesc.CellCssStyle = ""
  491.         tblLPR.lprShortDesc.CellCssClass = ""
  492.  
  493.         ' lprSTID
  494.         tblLPR.lprSTID.CellCssStyle = ""
  495.         tblLPR.lprSTID.CellCssClass = ""
  496.  
  497.         ' lprSTChangedBy
  498.         tblLPR.lprSTChangedBy.CellCssStyle = ""
  499.         tblLPR.lprSTChangedBy.CellCssClass = ""
  500.  
  501.         '
  502.         '  View  Row
  503.         '
  504.  
  505.         If tblLPR.RowType = EW_ROWTYPE_VIEW Then ' View row
  506.  
  507.             ' lprEmpID
  508.             If ew_NotEmpty(tblLPR.lprEmpID.CurrentValue) Then
  509.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(tblLPR.lprEmpID.CurrentValue) & ""
  510.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  511.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  512.                 If RsWrk.Read() Then
  513.                     tblLPR.lprEmpID.ViewValue = RsWrk("empName")
  514.                 Else
  515.                     tblLPR.lprEmpID.ViewValue = tblLPR.lprEmpID.CurrentValue
  516.                 End If
  517.                 Conn.CloseTempDataReader()
  518.             Else
  519.                 tblLPR.lprEmpID.ViewValue = System.DBNull.Value
  520.             End If
  521.             tblLPR.lprEmpID.CssStyle = ""
  522.             tblLPR.lprEmpID.CssClass = ""
  523.             tblLPR.lprEmpID.ViewCustomAttributes = ""
  524.  
  525.             ' lprDate
  526.             tblLPR.lprDate.ViewValue = tblLPR.lprDate.CurrentValue
  527.             tblLPR.lprDate.ViewValue = ew_FormatDateTime(tblLPR.lprDate.ViewValue, 6)
  528.             tblLPR.lprDate.CssStyle = ""
  529.             tblLPR.lprDate.CssClass = ""
  530.             tblLPR.lprDate.ViewCustomAttributes = ""
  531.  
  532.             ' lprLocationID
  533.             If ew_NotEmpty(tblLPR.lprLocationID.CurrentValue) Then
  534.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(tblLPR.lprLocationID.CurrentValue) & ""
  535.                 sSqlWrk = sSqlWrk & " AND (" & "[locLighting]=True" & ")"
  536.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  537.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  538.                 If RsWrk.Read() Then
  539.                     tblLPR.lprLocationID.ViewValue = RsWrk("locDescription")
  540.                 Else
  541.                     tblLPR.lprLocationID.ViewValue = tblLPR.lprLocationID.CurrentValue
  542.                 End If
  543.                 Conn.CloseTempDataReader()
  544.             Else
  545.                 tblLPR.lprLocationID.ViewValue = System.DBNull.Value
  546.             End If
  547.             tblLPR.lprLocationID.CssStyle = ""
  548.             tblLPR.lprLocationID.CssClass = ""
  549.             tblLPR.lprLocationID.ViewCustomAttributes = ""
  550.  
  551.             ' lprFixtureLocationID
  552.             If ew_NotEmpty(tblLPR.lprFixtureLocationID.CurrentValue) Then
  553.                 sSqlWrk = "SELECT [floDescription] FROM [tblLPRFixtureLocation] WHERE [floID] = " & ew_AdjustSql(tblLPR.lprFixtureLocationID.CurrentValue) & ""
  554.                 sSqlWrk = sSqlWrk & " ORDER BY [floDescription] "
  555.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  556.                 If RsWrk.Read() Then
  557.                     tblLPR.lprFixtureLocationID.ViewValue = RsWrk("floDescription")
  558.                 Else
  559.                     tblLPR.lprFixtureLocationID.ViewValue = tblLPR.lprFixtureLocationID.CurrentValue
  560.                 End If
  561.                 Conn.CloseTempDataReader()
  562.             Else
  563.                 tblLPR.lprFixtureLocationID.ViewValue = System.DBNull.Value
  564.             End If
  565.             tblLPR.lprFixtureLocationID.CssStyle = ""
  566.             tblLPR.lprFixtureLocationID.CssClass = ""
  567.             tblLPR.lprFixtureLocationID.ViewCustomAttributes = ""
  568.  
  569.             ' lprFixtureTypeID
  570.             If ew_NotEmpty(tblLPR.lprFixtureTypeID.CurrentValue) Then
  571.                 sSqlWrk = "SELECT [ftyDescription] FROM [tblLPRFixtureType] WHERE [ftyID] = " & ew_AdjustSql(tblLPR.lprFixtureTypeID.CurrentValue) & ""
  572.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  573.                 If RsWrk.Read() Then
  574.                     tblLPR.lprFixtureTypeID.ViewValue = RsWrk("ftyDescription")
  575.                 Else
  576.                     tblLPR.lprFixtureTypeID.ViewValue = tblLPR.lprFixtureTypeID.CurrentValue
  577.                 End If
  578.                 Conn.CloseTempDataReader()
  579.             Else
  580.                 tblLPR.lprFixtureTypeID.ViewValue = System.DBNull.Value
  581.             End If
  582.             tblLPR.lprFixtureTypeID.CssStyle = ""
  583.             tblLPR.lprFixtureTypeID.CssClass = ""
  584.             tblLPR.lprFixtureTypeID.ViewCustomAttributes = ""
  585.  
  586.             ' lprFixtureNumber
  587.             tblLPR.lprFixtureNumber.ViewValue = tblLPR.lprFixtureNumber.CurrentValue
  588.             tblLPR.lprFixtureNumber.CssStyle = ""
  589.             tblLPR.lprFixtureNumber.CssClass = ""
  590.             tblLPR.lprFixtureNumber.ViewCustomAttributes = ""
  591.  
  592.             ' lprChannelNumber
  593.             tblLPR.lprChannelNumber.ViewValue = tblLPR.lprChannelNumber.CurrentValue
  594.             tblLPR.lprChannelNumber.CssStyle = ""
  595.             tblLPR.lprChannelNumber.CssClass = ""
  596.             tblLPR.lprChannelNumber.ViewCustomAttributes = ""
  597.  
  598.             ' lprPriority
  599.             If Not IsDBNull(tblLPR.lprPriority.CurrentValue) Then
  600.                 Select Case tblLPR.lprPriority.CurrentValue
  601.                         Case "0"
  602.                             tblLPR.lprPriority.ViewValue = "Not Specified"
  603.                         Case "1"
  604.                             tblLPR.lprPriority.ViewValue = "Low"
  605.                         Case "2"
  606.                             tblLPR.lprPriority.ViewValue = "Medium"
  607.                     Case "3"
  608.                             tblLPR.lprPriority.ViewValue = "High"
  609.                     Case Else
  610.                         tblLPR.lprPriority.ViewValue = tblLPR.lprPriority.CurrentValue
  611.                 End Select
  612.             Else
  613.                 tblLPR.lprPriority.ViewValue = System.DBNull.Value
  614.             End If
  615.             tblLPR.lprPriority.CssStyle = ""
  616.             tblLPR.lprPriority.CssClass = ""
  617.             tblLPR.lprPriority.ViewCustomAttributes = ""
  618.  
  619.             ' lprShortDesc
  620.             tblLPR.lprShortDesc.ViewValue = tblLPR.lprShortDesc.CurrentValue
  621.             tblLPR.lprShortDesc.CssStyle = ""
  622.             tblLPR.lprShortDesc.CssClass = ""
  623.             tblLPR.lprShortDesc.ViewCustomAttributes = ""
  624.  
  625.             ' lprSTID
  626.             If ew_NotEmpty(tblLPR.lprSTID.CurrentValue) Then
  627.                 sSqlWrk = "SELECT [lstDescription] FROM [tblLPRStatus] WHERE [lstID] = " & ew_AdjustSql(tblLPR.lprSTID.CurrentValue) & ""
  628.                 sSqlWrk = sSqlWrk & " ORDER BY [lstDescription] "
  629.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  630.                 If RsWrk.Read() Then
  631.                     tblLPR.lprSTID.ViewValue = RsWrk("lstDescription")
  632.                 Else
  633.                     tblLPR.lprSTID.ViewValue = tblLPR.lprSTID.CurrentValue
  634.                 End If
  635.                 Conn.CloseTempDataReader()
  636.             Else
  637.                 tblLPR.lprSTID.ViewValue = System.DBNull.Value
  638.             End If
  639.             tblLPR.lprSTID.CssStyle = ""
  640.             tblLPR.lprSTID.CssClass = ""
  641.             tblLPR.lprSTID.ViewCustomAttributes = ""
  642.  
  643.             ' lprSTChangedBy
  644.             tblLPR.lprSTChangedBy.ViewValue = tblLPR.lprSTChangedBy.CurrentValue
  645.             tblLPR.lprSTChangedBy.CssStyle = ""
  646.             tblLPR.lprSTChangedBy.CssClass = ""
  647.             tblLPR.lprSTChangedBy.ViewCustomAttributes = ""
  648.  
  649.             ' lprCreatedBy
  650.             tblLPR.lprCreatedBy.ViewValue = tblLPR.lprCreatedBy.CurrentValue
  651.             tblLPR.lprCreatedBy.CssStyle = ""
  652.             tblLPR.lprCreatedBy.CssClass = ""
  653.             tblLPR.lprCreatedBy.ViewCustomAttributes = ""
  654.  
  655.             ' lprCreatedOn
  656.             tblLPR.lprCreatedOn.ViewValue = tblLPR.lprCreatedOn.CurrentValue
  657.             tblLPR.lprCreatedOn.ViewValue = ew_FormatDateTime(tblLPR.lprCreatedOn.ViewValue, 6)
  658.             tblLPR.lprCreatedOn.CssStyle = ""
  659.             tblLPR.lprCreatedOn.CssClass = ""
  660.             tblLPR.lprCreatedOn.ViewCustomAttributes = ""
  661.  
  662.             ' lprModifiedBy
  663.             tblLPR.lprModifiedBy.ViewValue = tblLPR.lprModifiedBy.CurrentValue
  664.             tblLPR.lprModifiedBy.CssStyle = ""
  665.             tblLPR.lprModifiedBy.CssClass = ""
  666.             tblLPR.lprModifiedBy.ViewCustomAttributes = ""
  667.  
  668.             ' lprModifiedOn
  669.             tblLPR.lprModifiedOn.ViewValue = tblLPR.lprModifiedOn.CurrentValue
  670.             tblLPR.lprModifiedOn.ViewValue = ew_FormatDateTime(tblLPR.lprModifiedOn.ViewValue, 6)
  671.             tblLPR.lprModifiedOn.CssStyle = ""
  672.             tblLPR.lprModifiedOn.CssClass = ""
  673.             tblLPR.lprModifiedOn.ViewCustomAttributes = ""
  674.  
  675.             ' View refer script
  676.             ' lprEmpID
  677.  
  678.             tblLPR.lprEmpID.HrefValue = ""
  679.  
  680.             ' lprDate
  681.             tblLPR.lprDate.HrefValue = ""
  682.  
  683.             ' lprLocationID
  684.             tblLPR.lprLocationID.HrefValue = ""
  685.  
  686.             ' lprFixtureLocationID
  687.             tblLPR.lprFixtureLocationID.HrefValue = ""
  688.  
  689.             ' lprFixtureTypeID
  690.             tblLPR.lprFixtureTypeID.HrefValue = ""
  691.  
  692.             ' lprFixtureNumber
  693.             tblLPR.lprFixtureNumber.HrefValue = ""
  694.  
  695.             ' lprChannelNumber
  696.             tblLPR.lprChannelNumber.HrefValue = ""
  697.  
  698.             ' lprPriority
  699.             tblLPR.lprPriority.HrefValue = ""
  700.  
  701.             ' lprShortDesc
  702.             tblLPR.lprShortDesc.HrefValue = ""
  703.  
  704.             ' lprSTID
  705.             tblLPR.lprSTID.HrefValue = ""
  706.  
  707.             ' lprSTChangedBy
  708.             tblLPR.lprSTChangedBy.HrefValue = ""
  709.         End If
  710.  
  711.         ' Row Rendered event
  712.         tblLPR.Row_Rendered()
  713.     End Sub
  714.  
  715.         ' Page Load event
  716.         Public Sub Page_Load()
  717.  
  718.             'HttpContext.Current.Response.Write("Page Load")
  719.         End Sub
  720.  
  721.         ' Page Unload event
  722.         Public Sub Page_Unload()
  723.  
  724.             'HttpContext.Current.Response.Write("Page Unload")
  725.         End Sub
  726.     End Class
  727.  
  728.     '
  729.     ' ASP.NET Page_Load event
  730.     '
  731.  
  732.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  733.         Response.Buffer = EW_RESPONSE_BUFFER
  734.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  735.  
  736.         ' Page init
  737.         tblLPR_delete = New ctblLPR_delete(Me)        
  738.         tblLPR_delete.Page_Init()
  739.  
  740.         ' Page main processing
  741.         tblLPR_delete.Page_Main()
  742.     End Sub
  743.  
  744.     '
  745.     ' ASP.NET Page_Unload event
  746.     '
  747.  
  748.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  749.  
  750.         ' Dispose page object
  751.         If tblLPR_delete IsNot Nothing Then tblLPR_delete.Dispose()
  752.     End Sub
  753. End Class
  754.