home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblEventsedit.aspx.vb < prev    next >
Text File  |  2015-05-13  |  21KB  |  688 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 tblEventsedit
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblEvents_edit As ctblEvents_edit
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblEvents_edit
  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 tblEvents.UseTokenInUrl Then Url = Url & "t=" & tblEvents.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 tblEvents.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (tblEvents.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (tblEvents.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' tblEvents
  57.         Public Property tblEvents() As ctblEvents
  58.             Get                
  59.                 Return ParentPage.tblEvents
  60.             End Get
  61.             Set(ByVal v As ctblEvents)
  62.                 ParentPage.tblEvents = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' tblEvents
  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 = "edit"
  85.             m_PageObjName = "tblEvents_edit"
  86.             m_PageObjTypeName = "ctblEvents_edit"
  87.  
  88.             ' Table Name
  89.             m_TableName = "tblEvents"
  90.  
  91.             ' Initialize table object
  92.             tblEvents = New ctblEvents(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.CanEdit Then
  121.                 Security.SaveLastUrl()
  122.                 Page_Terminate("tblEventslist.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.             tblEvents.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.  
  179.         ' Load key from QueryString
  180.         If ew_Get("evtID") <> "" Then
  181.             tblEvents.evtID.QueryStringValue = ew_Get("evtID")
  182.         End If
  183.  
  184.         ' Create form object
  185.         ObjForm = New cFormObj
  186.         If ObjForm.GetValue("a_edit") <> "" Then
  187.             tblEvents.CurrentAction = ObjForm.GetValue("a_edit") ' Get action code
  188.             LoadFormValues() ' Get form values
  189.  
  190.             ' Validate Form
  191.             If Not ValidateForm() Then
  192.                 tblEvents.CurrentAction = "" ' Form error, reset action
  193.                 Message = ParentPage.gsFormError
  194.                 LoadRow() ' Restore row
  195.                 RestoreFormValues() ' Restore form values if validate failed
  196.             End If
  197.         Else
  198.             tblEvents.CurrentAction = "I" ' Default action is display
  199.         End If
  200.  
  201.         ' Check if valid key
  202.         If ew_Empty(tblEvents.evtID.CurrentValue) Then Page_Terminate("tblEventslist.aspx") ' Invalid key, return to list
  203.         Select Case tblEvents.CurrentAction
  204.             Case "I" ' Get a record to display
  205.                 If Not LoadRow() Then ' Load Record based on key
  206.                     Message = "No records found" ' No record found
  207.                     Page_Terminate("tblEventslist.aspx") ' No matching record, return to list
  208.                 End If
  209.             Case "U" ' Update
  210.                 tblEvents.SendEmail = True ' Send email on update success
  211.                 If EditRow() Then ' Update Record based on key
  212.                     Message = "Update succeeded" ' Update success
  213.                     Dim sReturnUrl As String = tblEvents.ReturnUrl
  214.                     Page_Terminate(sReturnUrl) ' Return to caller
  215.                 Else
  216.                     LoadRow() ' Restore row
  217.                     RestoreFormValues() ' Restore form values if update failed
  218.                 End If
  219.         End Select
  220.  
  221.         ' Render the record
  222.         tblEvents.RowType = EW_ROWTYPE_EDIT ' Render as edit
  223.  
  224.         ' Render row
  225.         RenderRow()
  226.     End Sub
  227.  
  228.     '
  229.     ' Get upload file
  230.     '
  231.     Sub GetUploadFiles()
  232.  
  233.         ' Get upload data
  234.     End Sub
  235.  
  236.     '
  237.     ' Load default values
  238.     '
  239.     Sub LoadDefaultValues()
  240.     End Sub
  241.  
  242.     '
  243.     ' Load form values
  244.     '
  245.     Sub LoadFormValues()
  246.         tblEvents.evtDescription.FormValue = ObjForm.GetValue("x_evtDescription")
  247.             tblEvents.evtDescription.OldValue = ObjForm.GetValue("o_evtDescription")
  248.  
  249.             tblEvents.evtIsActive.FormValue = ObjForm.GetValue("x_evtIsActive")
  250.             tblEvents.evtIsActive.OldValue = ObjForm.GetValue("o_evtIsActive")
  251.  
  252.             tblEvents.evtAllocateBilling.FormValue = ObjForm.GetValue("x_evtAllocateBilling")
  253.             tblEvents.evtAllocateBilling.OldValue = ObjForm.GetValue("o_evtAllocateBilling")
  254.  
  255.             tblEvents.evtBillingNotes.FormValue = ObjForm.GetValue("x_evtBillingNotes")
  256.             tblEvents.evtBillingNotes.OldValue = ObjForm.GetValue("o_evtBillingNotes")
  257.  
  258.             tblEvents.evtTierLevel.FormValue = ObjForm.GetValue("x_evtTierLevel")
  259.             tblEvents.evtTierLevel.OldValue = ObjForm.GetValue("o_evtTierLevel")
  260.  
  261.             tblEvents.evtOverTimePriority.FormValue = ObjForm.GetValue("x_evtOverTimePriority")
  262.             tblEvents.evtOverTimePriority.OldValue = ObjForm.GetValue("o_evtOverTimePriority")
  263.  
  264.             tblEvents.evtID.FormValue = ObjForm.GetValue("x_evtID")
  265.     End Sub
  266.  
  267.     '
  268.     ' Restore form values
  269.     '
  270.     Sub RestoreFormValues()
  271.             tblEvents.evtDescription.CurrentValue = tblEvents.evtDescription.FormValue
  272.             tblEvents.evtIsActive.CurrentValue = tblEvents.evtIsActive.FormValue
  273.             tblEvents.evtAllocateBilling.CurrentValue = tblEvents.evtAllocateBilling.FormValue
  274.             tblEvents.evtBillingNotes.CurrentValue = tblEvents.evtBillingNotes.FormValue
  275.             tblEvents.evtTierLevel.CurrentValue = tblEvents.evtTierLevel.FormValue
  276.             tblEvents.evtOverTimePriority.CurrentValue = tblEvents.evtOverTimePriority.FormValue
  277.         tblEvents.evtID.CurrentValue = tblEvents.evtID.FormValue
  278.     End Sub
  279.  
  280.     '
  281.     ' Load row based on key values
  282.     '
  283.     Function LoadRow() As Boolean
  284.         Dim RsRow As OleDbDataReader
  285.         Dim sFilter As String = tblEvents.KeyFilter
  286.  
  287.         ' Row Selecting event
  288.         tblEvents.Row_Selecting(sFilter)
  289.  
  290.         ' Load SQL based on filter
  291.         tblEvents.CurrentFilter = sFilter
  292.         Dim sSql As String = tblEvents.SQL
  293.  
  294.         ' Write SQL for debug
  295.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  296.         Try
  297.             RsRow = Conn.GetTempDataReader(sSql)    
  298.             If Not RsRow.Read() Then
  299.                 Return False
  300.             Else                
  301.                 LoadRowValues(RsRow) ' Load row values
  302.  
  303.                 ' Row Selected event
  304.                 tblEvents.Row_Selected(RsRow)
  305.                 Return True    
  306.             End If
  307.         Catch
  308.             If EW_DEBUG_ENABLED Then Throw
  309.             Return False
  310.         Finally
  311.             Conn.CloseTempDataReader()
  312.         End Try
  313.     End Function
  314.  
  315.     '
  316.     ' Load row values from recordset
  317.     '
  318.     Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
  319.         tblEvents.evtID.DbValue = RsRow("evtID")
  320.             tblEvents.evtDescription.DbValue = RsRow("evtDescription")
  321.             tblEvents.evtIsActive.DbValue = IIf(ew_ConvertToBool(RsRow("evtIsActive")), "1", "0")
  322.             tblEvents.evtAllocateBilling.DbValue = IIf(ew_ConvertToBool(RsRow("evtAllocateBilling")), "1", "0")
  323.             tblEvents.evtBillingNotes.DbValue = RsRow("evtBillingNotes")
  324.             tblEvents.evtTierLevel.DbValue = RsRow("evtTierLevel")
  325.             tblEvents.evtOverTimePriority.DbValue = RsRow("evtOverTimePriority")
  326.         End Sub
  327.  
  328.     '
  329.     ' Render row values based on field settings
  330.     '
  331.     Sub RenderRow()
  332.  
  333.         ' Row Rendering event
  334.         tblEvents.Row_Rendering()
  335.  
  336.         '
  337.         '  Common render codes for all row types
  338.         '
  339.         ' evtDescription
  340.  
  341.         tblEvents.evtDescription.CellCssStyle = ""
  342.         tblEvents.evtDescription.CellCssClass = ""
  343.  
  344.             ' evtIsActive
  345.  
  346.             tblEvents.evtIsActive.CellCssStyle = ""
  347.             tblEvents.evtIsActive.CellCssClass = ""
  348.  
  349.             ' evtAllocateBilling
  350.  
  351.             tblEvents.evtAllocateBilling.CellCssStyle = ""
  352.             tblEvents.evtAllocateBilling.CellCssClass = ""
  353.  
  354.             ' evtBillingNotes
  355.  
  356.             tblEvents.evtBillingNotes.CellCssStyle = ""
  357.             tblEvents.evtBillingNotes.CellCssClass = ""
  358.  
  359.             ' evtTierLevel
  360.  
  361.             tblEvents.evtTierLevel.CellCssStyle = ""
  362.             tblEvents.evtTierLevel.CellCssClass = ""
  363.  
  364.             ' evtOverTimePriority
  365.  
  366.             tblEvents.evtOverTimePriority.CellCssStyle = ""
  367.             tblEvents.evtOverTimePriority.CellCssClass = ""
  368.  
  369.             '
  370.         '  View  Row
  371.         '
  372.  
  373.         If tblEvents.RowType = EW_ROWTYPE_VIEW Then ' View row
  374.  
  375.             ' evtID
  376.             tblEvents.evtID.ViewValue = tblEvents.evtID.CurrentValue
  377.             tblEvents.evtID.CssStyle = ""
  378.             tblEvents.evtID.CssClass = ""
  379.             tblEvents.evtID.ViewCustomAttributes = ""
  380.  
  381.             ' evtDescription
  382.             tblEvents.evtDescription.ViewValue = tblEvents.evtDescription.CurrentValue
  383.             tblEvents.evtDescription.CssStyle = ""
  384.             tblEvents.evtDescription.CssClass = ""
  385.             tblEvents.evtDescription.ViewCustomAttributes = ""
  386.  
  387.                 ' evtIsActive
  388.                 If Convert.ToString(tblEvents.evtIsActive.CurrentValue) = "1" Then
  389.                     tblEvents.evtIsActive.ViewValue = "Yes"
  390.                 Else
  391.                     tblEvents.evtIsActive.ViewValue = "No"
  392.                 End If
  393.                 tblEvents.evtIsActive.CssStyle = ""
  394.                 tblEvents.evtIsActive.CssClass = ""
  395.                 tblEvents.evtIsActive.ViewCustomAttributes = ""
  396.  
  397.                 ' evtAllocateBilling
  398.                 If Convert.ToString(tblEvents.evtAllocateBilling.CurrentValue) = "1" Then
  399.                     tblEvents.evtAllocateBilling.ViewValue = "Yes"
  400.                 Else
  401.                     tblEvents.evtAllocateBilling.ViewValue = "No"
  402.                 End If
  403.                 tblEvents.evtAllocateBilling.CssStyle = ""
  404.                 tblEvents.evtAllocateBilling.CssClass = ""
  405.                 tblEvents.evtAllocateBilling.ViewCustomAttributes = ""
  406.  
  407.                 ' evtBillingNotes
  408.                 tblEvents.evtBillingNotes.ViewValue = tblEvents.evtBillingNotes.CurrentValue
  409.                 tblEvents.evtBillingNotes.CssStyle = ""
  410.                 tblEvents.evtBillingNotes.CssClass = ""
  411.                 tblEvents.evtBillingNotes.ViewCustomAttributes = ""
  412.  
  413.  
  414.                 ' evtTierLevel
  415.                 If Not IsDBNull(tblEvents.evtTierLevel.CurrentValue) Then
  416.                     Select Case tblEvents.evtTierLevel.CurrentValue
  417.                         Case "0"
  418.                             tblEvents.evtTierLevel.ViewValue = "0"
  419.                         Case "1"
  420.                             tblEvents.evtTierLevel.ViewValue = "1"
  421.                         Case "2"
  422.                             tblEvents.evtTierLevel.ViewValue = "2"
  423.                         Case "3"
  424.                             tblEvents.evtTierLevel.ViewValue = "3"
  425.                         Case "4"
  426.                             tblEvents.evtTierLevel.ViewValue = "4"
  427.                         Case "5"
  428.                             tblEvents.evtTierLevel.ViewValue = "5"
  429.                         Case Else
  430.                             tblEvents.evtTierLevel.ViewValue = tblEvents.evtTierLevel.CurrentValue
  431.                     End Select
  432.                 Else
  433.                     tblEvents.evtTierLevel.ViewValue = System.DBNull.Value
  434.                 End If
  435.                 tblEvents.evtTierLevel.CssStyle = ""
  436.                 tblEvents.evtTierLevel.CssClass = ""
  437.                 tblEvents.evtTierLevel.ViewCustomAttributes = ""
  438.  
  439.                 ' evtOverTimePriority
  440.                 tblEvents.evtOverTimePriority.ViewValue = tblEvents.evtOverTimePriority.CurrentValue
  441.                 tblEvents.evtOverTimePriority.CssStyle = ""
  442.                 tblEvents.evtOverTimePriority.CssClass = ""
  443.                 tblEvents.evtOverTimePriority.ViewCustomAttributes = ""
  444.  
  445.             ' View refer script
  446.             ' evtDescription
  447.  
  448.                 tblEvents.evtDescription.HrefValue = ""
  449.  
  450.                 ' evtIsActive
  451.                 tblEvents.evtIsActive.HrefValue = ""
  452.  
  453.                 ' evtAllocateBilling
  454.                 tblEvents.evtAllocateBilling.HrefValue = ""
  455.  
  456.                 ' evtBillingNotes
  457.                 tblEvents.evtBillingNotes.HrefValue = ""
  458.  
  459.                 ' evtTierLevel
  460.                 tblEvents.evtTierLevel.HrefValue = ""
  461.  
  462.                 ' evtOverTimePriority
  463.                 tblEvents.evtOverTimePriority.HrefValue = ""
  464.  
  465.         '
  466.         '  Edit Row
  467.         '
  468.  
  469.         ElseIf tblEvents.RowType = EW_ROWTYPE_EDIT Then ' Edit row
  470.  
  471.             ' evtDescription
  472.             tblEvents.evtDescription.EditCustomAttributes = ""
  473.                 tblEvents.evtDescription.EditValue = ew_HtmlEncode(tblEvents.evtDescription.CurrentValue)
  474.  
  475.                 ' evtIsActive
  476.                 tblEvents.evtIsActive.EditCustomAttributes = ""
  477.                 tblEvents.evtIsActive.EditValue = ew_HtmlEncode(tblEvents.evtIsActive.CurrentValue)
  478.  
  479.                 ' evtAllocateBilling
  480.                 tblEvents.evtAllocateBilling.EditCustomAttributes = ""
  481.                 tblEvents.evtAllocateBilling.EditValue = ew_HtmlEncode(tblEvents.evtAllocateBilling.CurrentValue)
  482.  
  483.                 ' evtBillingNotes
  484.                 tblEvents.evtBillingNotes.EditCustomAttributes = ""
  485.                 tblEvents.evtBillingNotes.EditValue = ew_HtmlEncode(tblEvents.evtBillingNotes.CurrentValue)
  486.  
  487.                 ' evtTierLevel
  488.                 tblEvents.evtTierLevel.EditCustomAttributes = ""
  489.                 tblEvents.evtTierLevel.EditValue = ew_HtmlEncode(tblEvents.evtTierLevel.CurrentValue)
  490.  
  491.                 ' evtOverTimePriority
  492.                 tblEvents.evtOverTimePriority.EditCustomAttributes = ""
  493.                 tblEvents.evtOverTimePriority.EditValue = ew_HtmlEncode(tblEvents.evtOverTimePriority.CurrentValue)
  494.  
  495.                 ' evtTierLevel
  496.                 tblEvents.evtTierLevel.EditCustomAttributes = ""
  497.                 arwrk = New ArrayList
  498.                 arwrk.Add(New String() {"0", "0"})
  499.                 arwrk.Add(New String() {"1", "1"})
  500.                 arwrk.Add(New String() {"2", "2"})
  501.                 arwrk.Add(New String() {"3", "3"})
  502.                 arwrk.Add(New String() {"4", "4"})
  503.                 arwrk.Add(New String() {"5", "5"})
  504.                 arwrk.Insert(0, New String() {"", "Please Select"})
  505.                 tblEvents.evtTierLevel.EditValue = arwrk
  506.  
  507.                 ' Edit refer script
  508.             ' evtDescription
  509.  
  510.                 tblEvents.evtDescription.HrefValue = ""
  511.  
  512.                 ' evtIsActive
  513.  
  514.                 tblEvents.evtIsActive.HrefValue = ""
  515.  
  516.                 ' evtAllocateBilling
  517.  
  518.                 tblEvents.evtAllocateBilling.HrefValue = ""
  519.  
  520.                 ' evtBillingNotes
  521.  
  522.                 tblEvents.evtBillingNotes.HrefValue = ""
  523.  
  524.                 ' evtTierLevel
  525.  
  526.                 tblEvents.evtTierLevel.HrefValue = ""
  527.  
  528.                 ' evtOverTimePriority
  529.  
  530.                 tblEvents.evtOverTimePriority.HrefValue = ""
  531.         End If
  532.  
  533.         ' Row Rendered event
  534.         tblEvents.Row_Rendered()
  535.     End Sub
  536.  
  537.     '
  538.     ' Validate form
  539.     '
  540.     Function ValidateForm() As Boolean
  541.  
  542.         ' Initialize
  543.         ParentPage.gsFormError = ""
  544.  
  545.         ' Check if validation required
  546.         If Not EW_SERVER_VALIDATE Then Return (ParentPage.gsFormError = "")
  547.  
  548.         ' Return validate result
  549.         Dim Valid As Boolean = (ParentPage.gsFormError = "")
  550.  
  551.         ' Form_CustomValidate event
  552.         Dim sFormCustomError As String = ""
  553.         Valid = Valid And Form_CustomValidate(sFormCustomError)
  554.         If sFormCustomError <> "" Then
  555.             If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  556.             ParentPage.gsFormError = ParentPage.gsFormError & sFormCustomError
  557.         End If
  558.         Return Valid
  559.     End Function
  560.  
  561.     '
  562.     ' Update record based on key values
  563.     '
  564.     Function EditRow() As Boolean
  565.         Dim RsEdit As OleDbDataReader, RsChk As OleDbDataReader
  566.         Dim sSql As String, sFilter As String
  567.         Dim sSqlChk As String, sFilterChk As String
  568.         Dim bUpdateRow As Boolean
  569.         Dim RsOld As OrderedDictionary
  570.         Dim sIdxErrMsg As String
  571.         Dim Rs As New OrderedDictionary
  572.         sFilter = tblEvents.KeyFilter
  573.         tblEvents.CurrentFilter  = sFilter
  574.         sSql = tblEvents.SQL
  575.         Try
  576.             RsEdit = Conn.GetDataReader(sSql) 
  577.         Catch e As Exception
  578.             If EW_DEBUG_ENABLED Then Throw
  579.             Message = e.Message
  580.             RsEdit.Close()
  581.             EditRow = False
  582.         End Try
  583.         If Not RsEdit.Read() Then
  584.             RsEdit.Close()
  585.             EditRow = False ' Update Failed
  586.         Else
  587.             RsOld = Conn.GetRow(RsEdit)
  588.             RsEdit.Close()
  589.  
  590.             ' evtDescription
  591.             tblEvents.evtDescription.SetDbValue(tblEvents.evtDescription.CurrentValue, System.DBNull.Value)
  592.                 Rs("evtDescription") = tblEvents.evtDescription.DbValue
  593.  
  594.                 ' evtIsActive
  595.                 tblEvents.evtIsActive.SetDbValue((tblEvents.evtIsActive.CurrentValue <> "" And Not IsDBNull(tblEvents.evtIsActive.CurrentValue)), System.DBNull.Value)
  596.                 Rs("evtIsActive") = tblEvents.evtIsActive.DbValue
  597.  
  598.                 ' evtAllocateBilling
  599.                 tblEvents.evtAllocateBilling.SetDbValue((tblEvents.evtAllocateBilling.CurrentValue <> "" And Not IsDBNull(tblEvents.evtAllocateBilling.CurrentValue)), System.DBNull.Value)
  600.                 Rs("evtAllocateBilling") = tblEvents.evtAllocateBilling.DbValue
  601.  
  602.                 ' evtBillingNotes
  603.                 tblEvents.evtBillingNotes.SetDbValue(tblEvents.evtBillingNotes.CurrentValue, System.DBNull.Value)
  604.                 Rs("evtBillingNotes") = tblEvents.evtBillingNotes.DbValue
  605.  
  606.                 ' evtTierLevel
  607.                 tblEvents.evtTierLevel.SetDbValue(tblEvents.evtTierLevel.CurrentValue, System.DBNull.Value)
  608.                 Rs("evtTierLevel") = tblEvents.evtTierLevel.DbValue
  609.  
  610.                 ' evtOverTimePriority
  611.                 tblEvents.evtOverTimePriority.SetDbValue(tblEvents.evtOverTimePriority.CurrentValue, System.DBNull.Value)
  612.                 Rs("evtOverTimePriority") = tblEvents.evtOverTimePriority.DbValue
  613.  
  614.                 ' Row Updating event
  615.             bUpdateRow = tblEvents.Row_Updating(RsOld, Rs)
  616.             If bUpdateRow Then
  617.                 Try
  618.                     tblEvents.Update(Rs)
  619.                     EditRow = True
  620.                 Catch e As Exception
  621.                     If EW_DEBUG_ENABLED Then Throw
  622.                     Message = e.Message
  623.                     EditRow = False
  624.                 End Try
  625.             Else
  626.                 If tblEvents.CancelMessage <> "" Then
  627.                     Message = tblEvents.CancelMessage
  628.                     tblEvents.CancelMessage = ""
  629.                 Else
  630.                     Message = "Update cancelled"
  631.                 End If
  632.                 EditRow = False
  633.             End If
  634.         End If
  635.  
  636.         ' Row Updated event
  637.         If EditRow Then
  638.             tblEvents.Row_Updated(RsOld, Rs)
  639.         End If
  640.     End Function
  641.  
  642.         ' Page Load event
  643.         Public Sub Page_Load()
  644.  
  645.             'HttpContext.Current.Response.Write("Page Load")
  646.         End Sub
  647.  
  648.         ' Page Unload event
  649.         Public Sub Page_Unload()
  650.  
  651.             'HttpContext.Current.Response.Write("Page Unload")
  652.         End Sub
  653.  
  654.     ' Form Custom Validate event
  655.     Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  656.  
  657.         'Return error message in CustomError
  658.         Return True
  659.     End Function
  660.     End Class
  661.  
  662.     '
  663.     ' ASP.NET Page_Load event
  664.     '
  665.  
  666.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  667.         Response.Buffer = EW_RESPONSE_BUFFER
  668.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  669.  
  670.         ' Page init
  671.         tblEvents_edit = New ctblEvents_edit(Me)        
  672.         tblEvents_edit.Page_Init()
  673.  
  674.         ' Page main processing
  675.         tblEvents_edit.Page_Main()
  676.     End Sub
  677.  
  678.     '
  679.     ' ASP.NET Page_Unload event
  680.     '
  681.  
  682.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  683.  
  684.         ' Dispose page object
  685.         If tblEvents_edit IsNot Nothing Then tblEvents_edit.Dispose()
  686.     End Sub
  687. End Class
  688.