home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / App_Code / viewScheduleinfo.vb < prev   
Text File  |  2010-08-26  |  37KB  |  1,147 lines

  1. Imports System.Data
  2. Imports System.Data.Common
  3. Imports System.Data.OleDb
  4.  
  5. '
  6. ' ASP.NET Maker 7 Project Class (Table)
  7. '
  8. Public Partial Class AspNetMaker7_tfpssnet
  9.     Inherits System.Web.UI.Page
  10.  
  11.     Public viewSchedule As cviewSchedule
  12.  
  13.     ' Define table class
  14.     Class cviewSchedule
  15.         Inherits AspNetMakerBase
  16.         Implements IDisposable
  17.  
  18.         ' Used by system generated functions
  19.         Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
  20.  
  21.         Private arwrk As Object
  22.  
  23.         Private armultiwrk() As String
  24.  
  25.         ' Constructor
  26.         Public Sub New(ByRef APage As AspNetMakerPage)
  27.             m_Page = APage
  28.             m_ParentPage = APage.ParentPage            
  29.         End Sub
  30.  
  31.         ' Define table level constants    
  32.         Public UseTokenInUrl As Boolean = EW_USE_TOKEN_IN_URL
  33.  
  34.         ' Table variable
  35.         Public ReadOnly Property TableVar() As String
  36.             Get
  37.                 Return "viewSchedule"
  38.             End Get
  39.         End Property
  40.  
  41.         ' Table name
  42.         Public ReadOnly Property TableName() As String
  43.             Get
  44.                 Return "viewSchedule"
  45.             End Get
  46.         End Property
  47.  
  48.         ' Records per page        
  49.         Public Property RecordsPerPage() As Integer
  50.             Get                
  51.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_REC_PER_PAGE)
  52.             End Get
  53.             Set(ByVal Value As Integer)                
  54.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_REC_PER_PAGE) = Value
  55.             End Set
  56.         End Property
  57.  
  58.         ' Start record number        
  59.         Public Property StartRecordNumber() As Integer
  60.             Get                
  61.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_START_REC)
  62.             End Get
  63.             Set(ByVal Value As Integer)                
  64.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_START_REC) = Value
  65.             End Set
  66.         End Property
  67.  
  68.         ' Search Highlight Name
  69.         Public ReadOnly Property HighlightName() As String
  70.             Get
  71.                 Return "viewSchedule_Highlight"
  72.             End Get
  73.         End Property
  74.  
  75.         ' Advanced search
  76.         Public Function GetAdvancedSearch(ByRef fld As Object) As String            
  77.             Return Convert.ToString(ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ADVANCED_SEARCH & "_" & fld))
  78.         End Function
  79.  
  80.         Public Sub SetAdvancedSearch(ByRef fld As Object, v As Object)            
  81.             If ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ADVANCED_SEARCH & "_" & fld) <> v Then
  82.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ADVANCED_SEARCH & "_" & fld) = v
  83.             End If
  84.         End Sub
  85.  
  86.         ' Basic search keyword        
  87.         Public Property BasicSearchKeyword() As String
  88.             Get                
  89.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_BASIC_SEARCH)
  90.             End Get
  91.             Set(ByVal Value As String)                
  92.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_BASIC_SEARCH) = Value
  93.             End Set
  94.         End Property
  95.  
  96.         ' Basic Search Type        
  97.         Public Property BasicSearchType() As String
  98.             Get
  99.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_BASIC_SEARCH_TYPE)
  100.             End Get
  101.             Set(ByVal Value As String)
  102.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_BASIC_SEARCH_TYPE) = Value
  103.             End Set
  104.         End Property
  105.  
  106.         ' Search WHERE clause        
  107.         Public Property SearchWhere() As String
  108.             Get
  109.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_SEARCH_WHERE)
  110.             End Get
  111.             Set(ByVal Value As String)
  112.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_SEARCH_WHERE) = Value
  113.             End Set
  114.         End Property
  115.  
  116.         ' Multiple column sort
  117.         Public Sub UpdateSort(ofld, ctrl)
  118.             Dim sSortField As String, sLastSort As String, sThisSort As String, sOrderBy As String
  119.             If CurrentOrder = ofld.FldName Then
  120.                 sSortField = ofld.FldExpression
  121.                 sLastSort = ofld.Sort
  122.                 If CurrentOrderType = "ASC" OrElse CurrentOrderType = "DESC" Then
  123.                     sThisSort = CurrentOrderType
  124.                 Else
  125.                     If sLastSort = "ASC" Then sThisSort = "DESC" Else sThisSort = "ASC"
  126.                 End If
  127.                 ofld.Sort = sThisSort
  128.                 If ctrl Then
  129.                     sOrderBy = SessionOrderBy
  130.                     If sOrderBy.Contains(sSortField & " " & sLastSort) Then
  131.                         sOrderBy = sOrderBy.Replace(sSortField & " " & sLastSort, sSortField & " " & sThisSort)
  132.                     Else
  133.                         If sOrderBy <> "" Then sOrderBy = sOrderBy & ", "
  134.                         sOrderBy = sOrderBy & sSortField & " " & sThisSort
  135.                     End If
  136.                     SessionOrderBy = sOrderBy ' Save to Session
  137.                 Else
  138.                     SessionOrderBy = sSortField & " " & sThisSort ' Save to Session
  139.                 End If
  140.             Else
  141.                 If Not ctrl Then ofld.Sort = ""
  142.             End If
  143.         End Sub
  144.  
  145.         ' Session WHERE Clause        
  146.         Public Property SessionWhere() As String
  147.             Get                
  148.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_WHERE)
  149.             End Get
  150.             Set(ByVal Value As String)                
  151.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_WHERE) = Value
  152.             End Set
  153.         End Property
  154.  
  155.         ' Session ORDER BY        
  156.         Public Property SessionOrderBy() As String
  157.             Get                
  158.                 Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ORDER_BY)
  159.             End Get
  160.             Set(ByVal Value As String)                
  161.                 ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_ORDER_BY) = Value
  162.             End Set
  163.         End Property
  164.  
  165.         ' Session key
  166.         Public Function GetKey(ByRef fld As Object) As Object
  167.             Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_KEY & "_" & fld)
  168.         End Function
  169.  
  170.         Public Sub SetKey(ByRef fld As Object, ByRef v As Object)
  171.             ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_KEY & "_" & fld) = v
  172.         End Sub
  173.  
  174.         ' Table level SQL
  175.         Public ReadOnly Property SqlSelect() As String
  176.             Get ' Select
  177.                 Return "SELECT tblSchedule.schSchID, tblSchedule.schDate, tblSchedule.schEvtID, tblSchedule.schPartsID, tblSchedule.schCallTime, tblSchedule.schStartTime, tblSchedule.schEndTime, tblSchedule.schOutTime, tblSchedule.schLocID, tblSchedule.schEmpID, tblSchedule.schPosID, tblSchedule.schTypID, tblSchedule.schNotes, tblSchedule.schActualStart, tblSchedule.schActualEnd, tblSchedule.schDateCreated, tblSchedule.schStatus FROM tblSchedule"
  178.             End Get
  179.         End Property
  180.  
  181.         Public ReadOnly Property SqlWhere() As String
  182.             Get ' Where
  183.                 Return ""
  184.             End Get
  185.         End Property
  186.  
  187.         Public ReadOnly Property SqlGroupBy() As String
  188.             Get ' Group By
  189.                 Return ""
  190.             End Get
  191.         End Property
  192.  
  193.         Public ReadOnly Property SqlHaving() As String
  194.             Get ' Having
  195.                 Return ""
  196.             End Get
  197.         End Property
  198.  
  199.         Public ReadOnly Property SqlOrderBy() As String
  200.             Get ' Order By
  201.                 Return "[schDate] ASC,[schStartTime] ASC,[schCallTime] ASC"
  202.             End Get
  203.         End Property
  204.  
  205.         ' SQL variables
  206.         Public CurrentFilter As String ' Current filter
  207.  
  208.         Public CurrentOrder As String ' Current order
  209.  
  210.         Public CurrentOrderType As String ' Current order type
  211.  
  212.         ' Get SQL
  213.         Public Function GetSQL(where As String, orderby As String) As String
  214.             Return ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, where, orderby)
  215.         End Function
  216.  
  217.         ' Table SQL
  218.         Public ReadOnly Property SQL() As String
  219.             Get
  220.                 Dim sFilter As String, sSort As String
  221.                 sFilter = CurrentFilter
  222.  
  223.                 ' Add user ID filter
  224.                 If Security.CurrentUserID <> "" And Not Security.IsAdmin Then ' Non system admin
  225.                     sFilter = AddUserIDFilter(sFilter) ' Add user ID filter
  226.                 End If
  227.                 sSort = SessionOrderBy
  228.                 Return ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, sFilter, sSort)
  229.             End Get
  230.         End Property
  231.  
  232.         ' Return table SQL with list page filter
  233.         Public ReadOnly Property ListSQL() As String
  234.             Get
  235.                 Dim sFilter As String, sSort As String
  236.                 sFilter = SessionWhere
  237.                 If CurrentFilter <> "" Then
  238.                     If sFilter <> "" Then
  239.                         sFilter = "(" & sFilter & ") AND (" & CurrentFilter & ")"
  240.                     Else
  241.                         sFilter = CurrentFilter
  242.                     End If
  243.                 End If
  244.  
  245.                 ' Add user ID filter
  246.                 If Security.CurrentUserID <> "" And Not Security.IsAdmin Then ' Non system admin
  247.                     sFilter = AddUserIDFilter(sFilter) ' Add user ID filter
  248.                 End If
  249.                 sSort = SessionOrderBy
  250.                 Return ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, sFilter, sSort)
  251.             End Get
  252.         End Property
  253.  
  254.         ' Return SQL for record count
  255.         Public ReadOnly Property SelectCountSQL() As String
  256.             Get
  257.                 Dim sFilter As String = SessionWhere
  258.                 If CurrentFilter <> "" Then
  259.                     If sFilter <> "" Then
  260.                         sFilter = "(" & sFilter & ") AND (" & CurrentFilter & ")"
  261.                     Else
  262.                         sFilter = CurrentFilter
  263.                     End If
  264.                 End If
  265.  
  266.                 ' Add user ID filter
  267.                 If Security.CurrentUserID <> "" And Not Security.IsAdmin Then ' Non system admin
  268.                     sFilter = AddUserIDFilter(sFilter) ' Add user ID filter
  269.                 End If
  270.                 Return ew_BuildSelectSql("SELECT COUNT(*) FROM " & SqlSelect.Substring(14), SqlWhere, "", "", "", sFilter, "")
  271.             End Get
  272.         End Property        
  273.  
  274.         ' Insert
  275.         Public Function Insert(ByRef Rs As OrderedDictionary) As Integer
  276.             Dim Sql As String = ""            
  277.             Dim names As String = ""
  278.             Dim values As String = ""            
  279.             Dim value As Object
  280.             Dim fld As cField        
  281.             For Each f As DictionaryEntry In Rs
  282.                 fld = FieldByName(f.Key)
  283.                 If fld IsNot Nothing Then
  284.                     names = names & fld.FldExpression & ","
  285.                     values = values & EW_DB_SQLPARAM_SYMBOL
  286.                     If EW_DB_SQLPARAM_SYMBOL <> "?" Then values = values & fld.FldVar
  287.                     values = values & ","
  288.                 End If
  289.             Next f
  290.             If names.EndsWith(",") Then names = names.Remove(names.Length - 1)
  291.             If values.EndsWith(",") Then values = values.Remove(values.Length - 1)
  292.             If names = "" Then Return -1
  293.             Sql = "INSERT INTO tblSchedule (" & names & ") VALUES (" & values & ")"
  294.             Dim command As OleDbCommand = Conn.GetCommand(Sql)
  295.             For Each f As DictionaryEntry In Rs
  296.                 fld = FieldByName(f.Key)
  297.                 If fld IsNot Nothing Then
  298.                     value = f.Value    
  299.                     command.Parameters.Add(fld.FldVar, fld.FldDbType).Value = value    
  300.                 End If
  301.             Next
  302.             Return command.ExecuteNonQuery()            
  303.         End Function
  304.  
  305.         ' Update
  306.         Public Function Update(ByRef Rs As OrderedDictionary) As Integer
  307.             Dim Sql As String = ""            
  308.             Dim values As String = ""            
  309.             Dim value As Object
  310.             Dim fld As cField
  311.             For Each f As DictionaryEntry In Rs
  312.                 fld = FieldByName(f.Key)
  313.                 If fld IsNot Nothing Then
  314.                     values = values & fld.FldExpression & "=" & EW_DB_SQLPARAM_SYMBOL
  315.                     If EW_DB_SQLPARAM_SYMBOL <> "?" Then values = values & fld.FldVar
  316.                     values = values & ","
  317.                 End If
  318.             Next f
  319.             If values.EndsWith(",") Then values = values.Remove(values.Length - 1)
  320.             If values = "" Then Return -1
  321.             Sql = "UPDATE tblSchedule SET " & values
  322.             If CurrentFilter <> "" Then Sql = Sql & " WHERE " & CurrentFilter
  323.             Dim command As OleDbCommand = Conn.GetCommand(Sql)
  324.             For Each f As DictionaryEntry In Rs
  325.                 fld = FieldByName(f.Key)
  326.                 If fld IsNot Nothing Then
  327.                     value = f.Value    
  328.                     command.Parameters.Add(fld.FldVar, fld.FldDbType).Value = value
  329.                 End If
  330.             Next
  331.             Return command.ExecuteNonQuery()
  332.         End Function
  333.  
  334.         ' Delete
  335.         Public Function Delete(ByRef Rs As OrderedDictionary) As Integer
  336.             Dim Sql As String
  337.             Dim fld As cField            
  338.             Sql = "DELETE FROM tblSchedule WHERE "
  339.             fld = FieldByName("schSchID")
  340.             Sql = Sql & fld.FldExpression & "=" & ew_QuotedValue(Rs("schSchID"), EW_DATATYPE_NUMBER) & " AND "
  341.             If Sql.EndsWith(" AND ") Then Sql = Sql.Remove(Sql.Length - 5)
  342.             If CurrentFilter <> "" Then    Sql = Sql & " AND " & CurrentFilter
  343.             Return Conn.Execute(Sql)
  344.         End Function
  345.  
  346.         ' Key filter for table
  347.         Private ReadOnly Property SqlKeyFilter() As String
  348.             Get
  349.                 Return "tblSchedule.schSchID = @schSchID@"
  350.             End Get
  351.         End Property
  352.  
  353.         ' Return Key filter for table
  354.         Public ReadOnly Property KeyFilter() As String
  355.             Get
  356.                 Dim sKeyFilter As String
  357.                 sKeyFilter = SqlKeyFilter
  358.                 If Not IsNumeric(schSchID.CurrentValue) Then
  359.                     sKeyFilter = "0=1" ' Invalid key
  360.                 End If
  361.                 sKeyFilter = sKeyFilter.Replace("@schSchID@", ew_AdjustSql(schSchID.CurrentValue)) ' Replace key value
  362.                 Return sKeyFilter
  363.             End Get
  364.         End Property
  365.  
  366.         ' Return URL
  367.         Public ReadOnly Property ReturnUrl() As String
  368.             Get ' Get referer URL automatically
  369.                 If HttpContext.Current.Request.ServerVariables("HTTP_REFERER") IsNot Nothing Then
  370.                     If ew_ReferPage() <> ew_CurrentPage() AndAlso ew_ReferPage() <> "login.aspx" Then ' Referer not same page or login page
  371.                         Dim url As String = HttpContext.Current.Request.ServerVariables("HTTP_REFERER")
  372.                         If url.Contains("?a=") Then ' Remove action
  373.                             Dim p1 As Integer = url.LastIndexOf("?a=")                            
  374.                             Dim p2 As Integer = url.IndexOf("&", p1)                            
  375.                             If p2 > -1 Then
  376.                                 url = url.Substring(0, p1 + 1) & url.Substring(p2 + 1)
  377.                             Else
  378.                                 url = url.Substring(0, p1)                                 
  379.                             End If
  380.                         End If
  381.                         ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL) = url ' Save to Session
  382.                     End If
  383.                 End If
  384.                 If ew_NotEmpty(ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL)) Then
  385.                     Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL)
  386.                 Else
  387.                     Return "viewSchedulelist.aspx"
  388.                 End If
  389.             End Get
  390.         End Property
  391.  
  392.         ' View URL
  393.         Public Function ViewUrl() As String
  394.             Return KeyUrl("viewScheduleview.aspx", UrlParm(""))
  395.         End Function
  396.  
  397.         ' Add URL
  398.         Public Function AddUrl() As String
  399.             AddUrl = "viewScheduleadd.aspx"
  400.             Dim sUrlParm As String
  401.             sUrlParm = UrlParm("")
  402.             If sUrlParm <> "" Then AddUrl = AddUrl & "?" & sUrlParm
  403.         End Function
  404.  
  405.         ' Edit URL
  406.         Public Function EditUrl() As String
  407.             Return KeyUrl("viewScheduleedit.aspx", UrlParm(""))
  408.         End Function
  409.  
  410.         ' Inline edit URL
  411.         Public Function InlineEditUrl() As String
  412.             Return KeyUrl(ew_CurrentPage(), UrlParm("a=edit"))
  413.         End Function
  414.  
  415.         ' Copy URL
  416.         Public Function CopyUrl() As String
  417.             Return KeyUrl("viewScheduleadd.aspx", UrlParm(""))
  418.         End Function
  419.  
  420.         ' Inline copy URL
  421.         Public Function InlineCopyUrl() As String
  422.             Return KeyUrl(ew_CurrentPage(), UrlParm("a=copy"))
  423.         End Function
  424.  
  425.         ' Delete URL
  426.         Public Function DeleteUrl() As String
  427.             Return KeyUrl("viewScheduledelete.aspx", UrlParm(""))
  428.         End Function
  429.  
  430.         ' Key URL
  431.         Public Function KeyUrl(url As String, parm As String) As String
  432.             Dim sUrl As String
  433.             sUrl = url & "?"
  434.             If parm <> "" Then sUrl = sUrl & parm & "&"
  435.             If Not IsDbNull(schSchID.CurrentValue) Then
  436.                 sUrl = sUrl & "schSchID=" & schSchID.CurrentValue
  437.             Else
  438.                 Return "javascript:alert('Invalid Record! Key is null');"
  439.             End If
  440.             Return sUrl
  441.         End Function
  442.  
  443.         ' URL parm
  444.         Function UrlParm(parm As String) As String
  445.             Dim OutStr As String = ""
  446.             If UseTokenInUrl Then
  447.                 OutStr = "t=viewSchedule"
  448.             End If
  449.             If parm <> "" Then
  450.                 If OutStr <> "" Then OutStr = OutStr & "&"
  451.                 OutStr = OutStr & parm
  452.             End If
  453.             Return OutStr
  454.         End Function
  455.  
  456.         ' Sort URL
  457.         Public Function SortUrl(ByRef fld As cField) As String
  458.             Dim OutStr As String = ""
  459.             If CurrentAction <> "" OrElse Export <> "" OrElse (fld.FldType = 201 OrElse fld.FldType = 203 OrElse fld.FldType = 205) Then
  460.                 OutStr = ""
  461.             Else
  462.                 OutStr = ew_CurrentPage()
  463.                 Dim sUrlParm As String
  464.                 sUrlParm = UrlParm("order=" & HttpContext.Current.Server.UrlEncode(fld.FldName) & "&ordertype=" & fld.ReverseSort)
  465.                 OutStr = OutStr & "?" & sUrlParm
  466.             End If
  467.             Return OutStr
  468.         End Function        
  469.  
  470.         ' Load rows based on filter
  471.         Public Function LoadRs(sFilter As String) As OleDbDataReader
  472.             Dim RsRows As OleDbDataReader
  473.  
  474.             ' Set up filter (SQL WHERE clause)
  475.             CurrentFilter = sFilter
  476.             Dim sSql As String = SQL()
  477.             Try
  478.                 RsRows = Conn.GetDataReader(sSql)
  479.                 If RsRows.HasRows Then
  480.                     Return RsRows
  481.                 Else
  482.                     RsRows.Close()
  483.                     RsRows.Dispose()
  484.                 End If
  485.             Catch
  486.             End Try
  487.             Return Nothing
  488.         End Function
  489.  
  490.         ' Load row values from recordset
  491.         Public Sub LoadListRowValues(ByRef RsRow As OleDbDataReader)            
  492.             schSchID.DbValue = RsRow("schSchID")
  493.             schDate.DbValue = RsRow("schDate")
  494.             schEvtID.DbValue = RsRow("schEvtID")
  495.             schPartsID.DbValue = RsRow("schPartsID")
  496.             schCallTime.DbValue = RsRow("schCallTime")
  497.             schStartTime.DbValue = RsRow("schStartTime")
  498.             schEndTime.DbValue = RsRow("schEndTime")
  499.             schOutTime.DbValue = RsRow("schOutTime")
  500.             schLocID.DbValue = RsRow("schLocID")
  501.             schEmpID.DbValue = RsRow("schEmpID")
  502.             schPosID.DbValue = RsRow("schPosID")
  503.             schTypID.DbValue = RsRow("schTypID")
  504.             schNotes.DbValue = RsRow("schNotes")
  505.             schActualStart.DbValue = RsRow("schActualStart")
  506.             schActualEnd.DbValue = RsRow("schActualEnd")
  507.             schDateCreated.DbValue = RsRow("schDateCreated")
  508.             schStatus.DbValue = RsRow("schStatus")
  509.         End Sub
  510.  
  511.         ' Render list row values
  512.         Public Sub RenderListRow()
  513.  
  514.             ' Row Rendering event
  515.             Row_Rendering()
  516.  
  517.             ' schDate
  518.             schDate.ViewValue = schDate.CurrentValue
  519.             schDate.ViewValue = ew_FormatDateTime(schDate.ViewValue, 6)
  520.             schDate.CssStyle = ""
  521.             schDate.CssClass = ""
  522.             schDate.ViewCustomAttributes = ""
  523.  
  524.             ' schEvtID
  525.             If ew_NotEmpty(schEvtID.CurrentValue) Then
  526.                 sSqlWrk = "SELECT [evtDescription] FROM [tblEvents] WHERE [evtID] = " & ew_AdjustSql(schEvtID.CurrentValue) & ""
  527.                 sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  528.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  529.                 If RsWrk.Read() Then
  530.                     schEvtID.ViewValue = RsWrk("evtDescription")
  531.                 Else
  532.                     schEvtID.ViewValue = schEvtID.CurrentValue
  533.                 End If
  534.                 Conn.CloseTempDataReader()
  535.             Else
  536.                 schEvtID.ViewValue = System.DBNull.Value
  537.             End If
  538.             schEvtID.CssStyle = ""
  539.             schEvtID.CssClass = ""
  540.             schEvtID.ViewCustomAttributes = ""
  541.  
  542.             ' schPartsID
  543.             If ew_NotEmpty(schPartsID.CurrentValue) Then
  544.                 sSqlWrk = "SELECT [prtDescription] FROM [tblParts] WHERE [prtID] = " & ew_AdjustSql(schPartsID.CurrentValue) & ""
  545.                 sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  546.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  547.                 If RsWrk.Read() Then
  548.                     schPartsID.ViewValue = RsWrk("prtDescription")
  549.                 Else
  550.                     schPartsID.ViewValue = schPartsID.CurrentValue
  551.                 End If
  552.                 Conn.CloseTempDataReader()
  553.             Else
  554.                 schPartsID.ViewValue = System.DBNull.Value
  555.             End If
  556.             schPartsID.CssStyle = ""
  557.             schPartsID.CssClass = ""
  558.             schPartsID.ViewCustomAttributes = ""
  559.  
  560.             ' schCallTime
  561.             schCallTime.ViewValue = schCallTime.CurrentValue
  562.             schCallTime.ViewValue = ew_FormatDateTime(schCallTime.ViewValue, 14)
  563.             schCallTime.CssStyle = ""
  564.             schCallTime.CssClass = ""
  565.             schCallTime.ViewCustomAttributes = ""
  566.  
  567.             ' schStartTime
  568.             schStartTime.ViewValue = schStartTime.CurrentValue
  569.             schStartTime.ViewValue = ew_FormatDateTime(schStartTime.ViewValue, 14)
  570.             schStartTime.CssStyle = ""
  571.             schStartTime.CssClass = ""
  572.             schStartTime.ViewCustomAttributes = ""
  573.  
  574.             ' schEndTime
  575.             schEndTime.ViewValue = schEndTime.CurrentValue
  576.             schEndTime.ViewValue = ew_FormatDateTime(schEndTime.ViewValue, 14)
  577.             schEndTime.CssStyle = ""
  578.             schEndTime.CssClass = ""
  579.             schEndTime.ViewCustomAttributes = ""
  580.  
  581.             ' schOutTime
  582.             schOutTime.ViewValue = schOutTime.CurrentValue
  583.             schOutTime.ViewValue = ew_FormatDateTime(schOutTime.ViewValue, 14)
  584.             schOutTime.CssStyle = ""
  585.             schOutTime.CssClass = ""
  586.             schOutTime.ViewCustomAttributes = ""
  587.  
  588.             ' schLocID
  589.             If ew_NotEmpty(schLocID.CurrentValue) Then
  590.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(schLocID.CurrentValue) & ""
  591.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  592.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  593.                 If RsWrk.Read() Then
  594.                     schLocID.ViewValue = RsWrk("locDescription")
  595.                 Else
  596.                     schLocID.ViewValue = schLocID.CurrentValue
  597.                 End If
  598.                 Conn.CloseTempDataReader()
  599.             Else
  600.                 schLocID.ViewValue = System.DBNull.Value
  601.             End If
  602.             schLocID.CssStyle = ""
  603.             schLocID.CssClass = ""
  604.             schLocID.ViewCustomAttributes = ""
  605.  
  606.             ' schEmpID
  607.             If ew_NotEmpty(schEmpID.CurrentValue) Then
  608.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(schEmpID.CurrentValue) & ""
  609.                 sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  610.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  611.                 If RsWrk.Read() Then
  612.                     schEmpID.ViewValue = RsWrk("empName")
  613.                 Else
  614.                     schEmpID.ViewValue = schEmpID.CurrentValue
  615.                 End If
  616.                 Conn.CloseTempDataReader()
  617.             Else
  618.                 schEmpID.ViewValue = System.DBNull.Value
  619.             End If
  620.             schEmpID.CssStyle = ""
  621.             schEmpID.CssClass = ""
  622.             schEmpID.ViewCustomAttributes = ""
  623.  
  624.             ' schPosID
  625.             If ew_NotEmpty(schPosID.CurrentValue) Then
  626.                 sSqlWrk = "SELECT [posDescription] FROM [tblPositions] WHERE [posID] = " & ew_AdjustSql(schPosID.CurrentValue) & ""
  627.                 sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  628.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  629.                 If RsWrk.Read() Then
  630.                     schPosID.ViewValue = RsWrk("posDescription")
  631.                 Else
  632.                     schPosID.ViewValue = schPosID.CurrentValue
  633.                 End If
  634.                 Conn.CloseTempDataReader()
  635.             Else
  636.                 schPosID.ViewValue = System.DBNull.Value
  637.             End If
  638.             schPosID.CssStyle = ""
  639.             schPosID.CssClass = ""
  640.             schPosID.ViewCustomAttributes = ""
  641.  
  642.             ' schTypID
  643.             If ew_NotEmpty(schTypID.CurrentValue) Then
  644.                 sSqlWrk = "SELECT [typDescription] FROM [tblTypes] WHERE [typID] = " & ew_AdjustSql(schTypID.CurrentValue) & ""
  645.                 sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  646.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  647.                 If RsWrk.Read() Then
  648.                     schTypID.ViewValue = RsWrk("typDescription")
  649.                 Else
  650.                     schTypID.ViewValue = schTypID.CurrentValue
  651.                 End If
  652.                 Conn.CloseTempDataReader()
  653.             Else
  654.                 schTypID.ViewValue = System.DBNull.Value
  655.             End If
  656.             schTypID.CssStyle = ""
  657.             schTypID.CssClass = ""
  658.             schTypID.ViewCustomAttributes = ""
  659.  
  660.             ' schActualStart
  661.             schActualStart.ViewValue = schActualStart.CurrentValue
  662.             schActualStart.ViewValue = ew_FormatDateTime(schActualStart.ViewValue, 14)
  663.             schActualStart.CssStyle = ""
  664.             schActualStart.CssClass = ""
  665.             schActualStart.ViewCustomAttributes = ""
  666.  
  667.             ' schActualEnd
  668.             schActualEnd.ViewValue = schActualEnd.CurrentValue
  669.             schActualEnd.ViewValue = ew_FormatDateTime(schActualEnd.ViewValue, 14)
  670.             schActualEnd.CssStyle = ""
  671.             schActualEnd.CssClass = ""
  672.             schActualEnd.ViewCustomAttributes = ""
  673.  
  674.             ' schStatus
  675.             If ew_NotEmpty(schStatus.CurrentValue) Then
  676.                 sSqlWrk = "SELECT [stDescription] FROM [tblScheduleStatus] WHERE [stID] = " & ew_AdjustSql(schStatus.CurrentValue) & ""
  677.                 sSqlWrk = sSqlWrk & " ORDER BY [stDescription] "
  678.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  679.                 If RsWrk.Read() Then
  680.                     schStatus.ViewValue = RsWrk("stDescription")
  681.                 Else
  682.                     schStatus.ViewValue = schStatus.CurrentValue
  683.                 End If
  684.                 Conn.CloseTempDataReader()
  685.             Else
  686.                 schStatus.ViewValue = System.DBNull.Value
  687.             End If
  688.             schStatus.CssStyle = ""
  689.             schStatus.CssClass = ""
  690.             schStatus.ViewCustomAttributes = ""
  691.  
  692.             ' schDate
  693.             schDate.HrefValue = ""
  694.  
  695.             ' schEvtID
  696.             schEvtID.HrefValue = ""
  697.  
  698.             ' schPartsID
  699.             schPartsID.HrefValue = ""
  700.  
  701.             ' schCallTime
  702.             schCallTime.HrefValue = ""
  703.  
  704.             ' schStartTime
  705.             schStartTime.HrefValue = ""
  706.  
  707.             ' schEndTime
  708.             schEndTime.HrefValue = ""
  709.  
  710.             ' schOutTime
  711.             schOutTime.HrefValue = ""
  712.  
  713.             ' schLocID
  714.             schLocID.HrefValue = ""
  715.  
  716.             ' schEmpID
  717.             schEmpID.HrefValue = ""
  718.  
  719.             ' schPosID
  720.             schPosID.HrefValue = ""
  721.  
  722.             ' schTypID
  723.             schTypID.HrefValue = ""
  724.  
  725.             ' schActualStart
  726.             schActualStart.HrefValue = ""
  727.  
  728.             ' schActualEnd
  729.             schActualEnd.HrefValue = ""
  730.  
  731.             ' schStatus
  732.             schStatus.HrefValue = ""
  733.  
  734.             ' Row Rendered event
  735.             Row_Rendered()
  736.         End Sub
  737.  
  738.         ' Add user ID filter
  739.         Public Function AddUserIDFilter(sFilter As String) As String
  740.             Dim sFilterWrk As String
  741.             sFilterWrk = Security.UserIDList
  742.             If Not Security.IsAdmin AndAlso sFilterWrk <> "" Then
  743.                 sFilterWrk = "tblSchedule.schEmpID IN (" & sFilterWrk & ")"
  744.                 If sFilter <> "" Then sFilterWrk = "(" & sFilter & ") AND (" & sFilterWrk & ")"
  745.             Else
  746.                 sFilterWrk = sFilter
  747.             End If
  748.             Return sFilterWrk
  749.         End Function        
  750.  
  751.         ' Get user ID subquery
  752.         Public Function GetUserIDSubquery(ByRef fld As Object, ByRef masterfld As Object) As String
  753.             Dim sWrk As String = ""
  754.             Dim sSql As String = "SELECT " & masterfld.FldExpression & " FROM tblSchedule WHERE " & AddUserIDFilter("")            
  755.             If EW_USE_SUBQUERY_FOR_MASTER_USER_ID Then ' Use subquery
  756.                 sWrk = sSql
  757.             Else ' List all values
  758.                 Dim RsUser As OleDbDataReader = Conn.GetTempDataReader(sSql)
  759.                 Try
  760.                     Do While RsUser.Read()
  761.                         If sWrk <> "" Then sWrk = sWrk & ","
  762.                         sWrk = sWrk & ew_QuotedValue(RsUser(0), masterfld.FldDataType)
  763.                     Loop
  764.                 Finally
  765.                     Conn.CloseTempDataReader()
  766.                 End Try
  767.             End If
  768.             If sWrk <> "" Then
  769.                 sWrk = fld.FldExpression & " IN (" & sWrk & ")"
  770.             End If
  771.             Return sWrk
  772.         End Function
  773.  
  774.         Public CurrentAction As String ' Current action
  775.  
  776.         Public EventCancelled As Boolean ' Event cancelled
  777.  
  778.         Public CancelMessage As String ' Cancel message
  779.  
  780.         ' Row Type
  781.         Public RowType As Integer    
  782.  
  783.         Public CssClass As String = "" ' CSS class
  784.  
  785.         Public CssStyle As String = "" ' CSS style
  786.  
  787.         Public RowClientEvents As String = "" ' Row client events
  788.  
  789.         ' Row Attribute
  790.         Public ReadOnly Property RowAttributes() As String
  791.             Get
  792.                 Dim sAtt As String = ""
  793.                 If ew_NotEmpty(CssStyle) Then
  794.                     sAtt = sAtt & " style=""" & CssStyle.Trim() & """"
  795.                 End If
  796.                 If ew_NotEmpty(CssClass) Then
  797.                     sAtt = sAtt & " class=""" & CssClass.Trim() & """"
  798.                 End If
  799.                 If m_Export = "" Then
  800.                     If ew_NotEmpty(RowClientEvents) Then
  801.                         sAtt = sAtt & " " & RowClientEvents.Trim()
  802.                     End If
  803.                 End If
  804.                 Return sAtt
  805.             End Get
  806.         End Property
  807.  
  808.         ' Export
  809.         Private m_Export As String
  810.  
  811.         Public Property Export() As String
  812.             Get
  813.                 Return m_Export
  814.             End Get
  815.             Set(ByVal Value As String)
  816.                 m_Export = Value
  817.             End Set
  818.         End Property
  819.  
  820.         ' Export Original Value
  821.         Public ExportOriginalValue As Boolean = EW_EXPORT_ORIGINAL_VALUE
  822.  
  823.         ' Export All
  824.         Public ExportAll As Boolean = EW_EXPORT_ALL
  825.  
  826.         ' Send Email
  827.         Public SendEmail As Boolean
  828.  
  829.         ' Custom Inner Html
  830.         Public TableCustomInnerHtml As Object
  831.  
  832.         '
  833.         '  Field objects
  834.         '        
  835.         Public Function FieldByName(Name As String) As Object
  836.             If Name = "schSchID" Then Return schSchID
  837.             If Name = "schDate" Then Return schDate
  838.             If Name = "schEvtID" Then Return schEvtID
  839.             If Name = "schPartsID" Then Return schPartsID
  840.             If Name = "schCallTime" Then Return schCallTime
  841.             If Name = "schStartTime" Then Return schStartTime
  842.             If Name = "schEndTime" Then Return schEndTime
  843.             If Name = "schOutTime" Then Return schOutTime
  844.             If Name = "schLocID" Then Return schLocID
  845.             If Name = "schEmpID" Then Return schEmpID
  846.             If Name = "schPosID" Then Return schPosID
  847.             If Name = "schTypID" Then Return schTypID
  848.             If Name = "schNotes" Then Return schNotes
  849.             If Name = "schActualStart" Then Return schActualStart
  850.             If Name = "schActualEnd" Then Return schActualEnd
  851.             If Name = "schDateCreated" Then Return schDateCreated
  852.             If Name = "schStatus" Then Return schStatus
  853.             Return Nothing        
  854.         End Function
  855.  
  856.         ' schSchID
  857.         Private m_schSchID As cField
  858.  
  859.         Public ReadOnly Property schSchID() As cField
  860.             Get
  861.                 If m_schSchID Is Nothing Then m_schSchID = New cField("viewSchedule", "x_schSchID", "schSchID", "tblSchedule.schSchID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  862.                 Return m_schSchID
  863.             End Get
  864.         End Property
  865.  
  866.         ' schDate
  867.         Private m_schDate As cField
  868.  
  869.         Public ReadOnly Property schDate() As cField
  870.             Get
  871.                 If m_schDate Is Nothing Then m_schDate = New cField("viewSchedule", "x_schDate", "schDate", "tblSchedule.schDate", 7, OleDbType.Date, EW_DATATYPE_DATE,  6)
  872.                 Return m_schDate
  873.             End Get
  874.         End Property
  875.  
  876.         ' schEvtID
  877.         Private m_schEvtID As cField
  878.  
  879.         Public ReadOnly Property schEvtID() As cField
  880.             Get
  881.                 If m_schEvtID Is Nothing Then m_schEvtID = New cField("viewSchedule", "x_schEvtID", "schEvtID", "tblSchedule.schEvtID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  882.                 Return m_schEvtID
  883.             End Get
  884.         End Property
  885.  
  886.         ' schPartsID
  887.         Private m_schPartsID As cField
  888.  
  889.         Public ReadOnly Property schPartsID() As cField
  890.             Get
  891.                 If m_schPartsID Is Nothing Then m_schPartsID = New cField("viewSchedule", "x_schPartsID", "schPartsID", "tblSchedule.schPartsID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  892.                 Return m_schPartsID
  893.             End Get
  894.         End Property
  895.  
  896.         ' schCallTime
  897.         Private m_schCallTime As cField
  898.  
  899.         Public ReadOnly Property schCallTime() As cField
  900.             Get
  901.                 If m_schCallTime Is Nothing Then m_schCallTime = New cField("viewSchedule", "x_schCallTime", "schCallTime", "tblSchedule.schCallTime", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  902.                 Return m_schCallTime
  903.             End Get
  904.         End Property
  905.  
  906.         ' schStartTime
  907.         Private m_schStartTime As cField
  908.  
  909.         Public ReadOnly Property schStartTime() As cField
  910.             Get
  911.                 If m_schStartTime Is Nothing Then m_schStartTime = New cField("viewSchedule", "x_schStartTime", "schStartTime", "tblSchedule.schStartTime", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  912.                 Return m_schStartTime
  913.             End Get
  914.         End Property
  915.  
  916.         ' schEndTime
  917.         Private m_schEndTime As cField
  918.  
  919.         Public ReadOnly Property schEndTime() As cField
  920.             Get
  921.                 If m_schEndTime Is Nothing Then m_schEndTime = New cField("viewSchedule", "x_schEndTime", "schEndTime", "tblSchedule.schEndTime", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  922.                 Return m_schEndTime
  923.             End Get
  924.         End Property
  925.  
  926.         ' schOutTime
  927.         Private m_schOutTime As cField
  928.  
  929.         Public ReadOnly Property schOutTime() As cField
  930.             Get
  931.                 If m_schOutTime Is Nothing Then m_schOutTime = New cField("viewSchedule", "x_schOutTime", "schOutTime", "tblSchedule.schOutTime", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  932.                 Return m_schOutTime
  933.             End Get
  934.         End Property
  935.  
  936.         ' schLocID
  937.         Private m_schLocID As cField
  938.  
  939.         Public ReadOnly Property schLocID() As cField
  940.             Get
  941.                 If m_schLocID Is Nothing Then m_schLocID = New cField("viewSchedule", "x_schLocID", "schLocID", "tblSchedule.schLocID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  942.                 Return m_schLocID
  943.             End Get
  944.         End Property
  945.  
  946.         ' schEmpID
  947.         Private m_schEmpID As cField
  948.  
  949.         Public ReadOnly Property schEmpID() As cField
  950.             Get
  951.                 If m_schEmpID Is Nothing Then m_schEmpID = New cField("viewSchedule", "x_schEmpID", "schEmpID", "tblSchedule.schEmpID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  952.                 Return m_schEmpID
  953.             End Get
  954.         End Property
  955.  
  956.         ' schPosID
  957.         Private m_schPosID As cField
  958.  
  959.         Public ReadOnly Property schPosID() As cField
  960.             Get
  961.                 If m_schPosID Is Nothing Then m_schPosID = New cField("viewSchedule", "x_schPosID", "schPosID", "tblSchedule.schPosID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  962.                 Return m_schPosID
  963.             End Get
  964.         End Property
  965.  
  966.         ' schTypID
  967.         Private m_schTypID As cField
  968.  
  969.         Public ReadOnly Property schTypID() As cField
  970.             Get
  971.                 If m_schTypID Is Nothing Then m_schTypID = New cField("viewSchedule", "x_schTypID", "schTypID", "tblSchedule.schTypID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  972.                 Return m_schTypID
  973.             End Get
  974.         End Property
  975.  
  976.         ' schNotes
  977.         Private m_schNotes As cField
  978.  
  979.         Public ReadOnly Property schNotes() As cField
  980.             Get
  981.                 If m_schNotes Is Nothing Then m_schNotes = New cField("viewSchedule", "x_schNotes", "schNotes", "tblSchedule.schNotes", 203, OleDbType.LongVarWChar, EW_DATATYPE_MEMO,  0)
  982.                 Return m_schNotes
  983.             End Get
  984.         End Property
  985.  
  986.         ' schActualStart
  987.         Private m_schActualStart As cField
  988.  
  989.         Public ReadOnly Property schActualStart() As cField
  990.             Get
  991.                 If m_schActualStart Is Nothing Then m_schActualStart = New cField("viewSchedule", "x_schActualStart", "schActualStart", "tblSchedule.schActualStart", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  992.                 Return m_schActualStart
  993.             End Get
  994.         End Property
  995.  
  996.         ' schActualEnd
  997.         Private m_schActualEnd As cField
  998.  
  999.         Public ReadOnly Property schActualEnd() As cField
  1000.             Get
  1001.                 If m_schActualEnd Is Nothing Then m_schActualEnd = New cField("viewSchedule", "x_schActualEnd", "schActualEnd", "tblSchedule.schActualEnd", 7, OleDbType.Date, EW_DATATYPE_DATE,  4)
  1002.                 Return m_schActualEnd
  1003.             End Get
  1004.         End Property
  1005.  
  1006.         ' schDateCreated
  1007.         Private m_schDateCreated As cField
  1008.  
  1009.         Public ReadOnly Property schDateCreated() As cField
  1010.             Get
  1011.                 If m_schDateCreated Is Nothing Then m_schDateCreated = New cField("viewSchedule", "x_schDateCreated", "schDateCreated", "tblSchedule.schDateCreated", 7, OleDbType.Date, EW_DATATYPE_DATE,  6)
  1012.                 Return m_schDateCreated
  1013.             End Get
  1014.         End Property
  1015.  
  1016.         ' schStatus
  1017.         Private m_schStatus As cField
  1018.  
  1019.         Public ReadOnly Property schStatus() As cField
  1020.             Get
  1021.                 If m_schStatus Is Nothing Then m_schStatus = New cField("viewSchedule", "x_schStatus", "schStatus", "tblSchedule.schStatus", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1022.                 Return m_schStatus
  1023.             End Get
  1024.         End Property
  1025.  
  1026.         ' Table level events
  1027.         ' Recordset Selecting event
  1028.         Public Sub Recordset_Selecting(ByRef filter As String) 
  1029.  
  1030.             ' Enter your code here    
  1031.         End Sub
  1032.  
  1033.         ' Recordset Selected event
  1034.         Public Sub Recordset_Selected(rs As DbDataReader)
  1035.  
  1036.             'HttpContext.Current.Response.Write("Recordset Selected")
  1037.         End Sub
  1038.  
  1039.         ' Recordset Searching event
  1040.         Public Sub Recordset_Searching(ByRef filter As String)
  1041.  
  1042.             ' Enter your code here
  1043.         End Sub
  1044.  
  1045.         ' Row_Selecting event
  1046.         Public Sub Row_Selecting(ByRef filter As String)
  1047.  
  1048.             ' Enter your code here    
  1049.         End Sub
  1050.  
  1051.         ' Row Selected event
  1052.         Public Sub Row_Selected(rs As DbDataReader)
  1053.  
  1054.             'HttpContext.Current.Response.Write("Row Selected")
  1055.         End Sub
  1056.  
  1057.         ' Row Rendering event
  1058.         Public Sub Row_Rendering()
  1059.  
  1060.             ' Enter your code here    
  1061.         End Sub
  1062.  
  1063.         ' Row Rendered event
  1064.         Public Sub Row_Rendered()
  1065.  
  1066.             ' To view properties of field class, use:
  1067.             ' HttpContext.Current.Response.Write(<FieldName>.AsString())
  1068.  
  1069.         End Sub
  1070.  
  1071.         ' Row Inserting event
  1072.         Public Function Row_Inserting(ByRef rs As OrderedDictionary) As Boolean
  1073.  
  1074.             ' Enter your code here
  1075.             ' To cancel, set return value to False and error message to CancelMessage
  1076.  
  1077.             Return True
  1078.         End Function
  1079.  
  1080.         ' Row Inserted event
  1081.         Public Sub Row_Inserted(rs As OrderedDictionary)
  1082.  
  1083.             'HttpContext.Current.Response.Write("Row Inserted")
  1084.         End Sub
  1085.  
  1086.         ' Row Updating event
  1087.         Public Function Row_Updating(rsold As OrderedDictionary, ByRef rsnew As OrderedDictionary) As Boolean
  1088.  
  1089.             ' Enter your code here
  1090.             ' To cancel, set return value to False and error message to CancelMessage
  1091.  
  1092.             Return True
  1093.         End Function
  1094.  
  1095.         ' Row Updated event
  1096.         Public Sub Row_Updated(rsold As OrderedDictionary, rsnew As OrderedDictionary)
  1097.  
  1098.             'HttpContext.Current.Response.Write("Row Updated")
  1099.         End Sub
  1100.  
  1101.         ' Recordset Deleting event
  1102.         Public Function Row_Deleting(rs As OrderedDictionary) As Boolean
  1103.  
  1104.             ' Enter your code here
  1105.             ' To cancel, set return value to False and error message to CancelMessage
  1106.  
  1107.             Return True
  1108.         End Function
  1109.  
  1110.         ' Recordset Deleted event
  1111.         Public Sub Row_Deleted(rs As OrderedDictionary)
  1112.  
  1113.             'HttpContext.Current.Response.Write("Row Deleted")
  1114.         End Sub
  1115.  
  1116.         ' Email Sending event
  1117.         Public Function Email_Sending(ByRef Email As cEmail, Args As Hashtable) As Boolean
  1118.  
  1119.             'HttpContext.Current.Response.Write(Email.AsString())
  1120.             'HttpContext.Current.Response.End()
  1121.  
  1122.             Return True
  1123.         End Function
  1124.  
  1125.         ' Class terminate
  1126.         Public Sub Dispose() Implements IDisposable.Dispose
  1127.             If m_schSchID IsNot Nothing Then m_schSchID.Dispose()
  1128.             If m_schDate IsNot Nothing Then m_schDate.Dispose()
  1129.             If m_schEvtID IsNot Nothing Then m_schEvtID.Dispose()
  1130.             If m_schPartsID IsNot Nothing Then m_schPartsID.Dispose()
  1131.             If m_schCallTime IsNot Nothing Then m_schCallTime.Dispose()
  1132.             If m_schStartTime IsNot Nothing Then m_schStartTime.Dispose()
  1133.             If m_schEndTime IsNot Nothing Then m_schEndTime.Dispose()
  1134.             If m_schOutTime IsNot Nothing Then m_schOutTime.Dispose()
  1135.             If m_schLocID IsNot Nothing Then m_schLocID.Dispose()
  1136.             If m_schEmpID IsNot Nothing Then m_schEmpID.Dispose()
  1137.             If m_schPosID IsNot Nothing Then m_schPosID.Dispose()
  1138.             If m_schTypID IsNot Nothing Then m_schTypID.Dispose()
  1139.             If m_schNotes IsNot Nothing Then m_schNotes.Dispose()
  1140.             If m_schActualStart IsNot Nothing Then m_schActualStart.Dispose()
  1141.             If m_schActualEnd IsNot Nothing Then m_schActualEnd.Dispose()
  1142.             If m_schDateCreated IsNot Nothing Then m_schDateCreated.Dispose()
  1143.             If m_schStatus IsNot Nothing Then m_schStatus.Dispose()
  1144.         End Sub
  1145.     End Class
  1146. End Class
  1147.