home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / App_Code / tblScheduleinfo.vb < prev    next >
Text File  |  2014-01-07  |  42KB  |  1,286 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 tblSchedule As ctblSchedule
  12.  
  13.     ' Define table class
  14.     Class ctblSchedule
  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 "tblSchedule"
  38.             End Get
  39.         End Property
  40.  
  41.         ' Table name
  42.         Public ReadOnly Property TableName() As String
  43.             Get
  44.                 Return "tblSchedule"
  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 "tblSchedule_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 * 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 And ew_Session("tfpssnet_Status_UserLevel") <> 4 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 And ew_Session("tfpssnet_Status_UserLevel") <> 4 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 And ew_Session("tfpssnet_Status_UserLevel") <> 4 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 "[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 "tblSchedulelist.aspx"
  388.                 End If
  389.             End Get
  390.         End Property
  391.  
  392.         ' View URL
  393.         Public Function ViewUrl() As String
  394.             Return KeyUrl("tblScheduleview.aspx", UrlParm(""))
  395.         End Function
  396.  
  397.         ' Add URL
  398.         Public Function AddUrl() As String
  399.             AddUrl = "tblScheduleadd.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("tblScheduleedit.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("tblScheduleadd.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("tblScheduledelete.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=tblSchedule"
  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.             schDepID.DbValue = RsRow("schDepID")
  505.             schNotes.DbValue = RsRow("schNotes")
  506.             schRate.DbValue = RsRow("schRate")
  507.             schActualStart.DbValue = RsRow("schActualStart")
  508.             schActualEnd.DbValue = RsRow("schActualEnd")
  509.             schDateCreated.DbValue = RsRow("schDateCreated")
  510.             schDoubleBooked.DbValue = IIf(ew_ConvertToBool(RsRow("schDoubleBooked")), "1", "0")
  511.             schStatus.DbValue = RsRow("schStatus")
  512.             schDayOfWeek.DbValue = RsRow("schDayOfWeek")
  513.         End Sub
  514.  
  515.         ' Render list row values
  516.         Public Sub RenderListRow()
  517.  
  518.             ' Row Rendering event
  519.             Row_Rendering()
  520.  
  521.             ' schDate
  522.             schDate.ViewValue = schDate.CurrentValue
  523.             schDate.ViewValue = ew_FormatDateTime(schDate.ViewValue, 6)
  524.             schDate.CssStyle = ""
  525.             schDate.CssClass = ""
  526.             schDate.ViewCustomAttributes = ""
  527.  
  528.             ' schEvtID
  529.             If ew_NotEmpty(schEvtID.CurrentValue) Then
  530.                 sSqlWrk = "SELECT [evtDescription] FROM [tblEvents] WHERE [evtID] = " & ew_AdjustSql(schEvtID.CurrentValue) & ""
  531.                 sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  532.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  533.                 If RsWrk.Read() Then
  534.                     schEvtID.ViewValue = RsWrk("evtDescription")
  535.                 Else
  536.                     schEvtID.ViewValue = schEvtID.CurrentValue
  537.                 End If
  538.                 Conn.CloseTempDataReader()
  539.             Else
  540.                 schEvtID.ViewValue = System.DBNull.Value
  541.             End If
  542.             schEvtID.CssStyle = ""
  543.             schEvtID.CssClass = ""
  544.             schEvtID.ViewCustomAttributes = ""
  545.  
  546.             ' schPartsID
  547.             If ew_NotEmpty(schPartsID.CurrentValue) Then
  548.                 sSqlWrk = "SELECT [prtDescription] FROM [tblParts] WHERE [prtID] = " & ew_AdjustSql(schPartsID.CurrentValue) & ""
  549.                 sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  550.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  551.                 If RsWrk.Read() Then
  552.                     schPartsID.ViewValue = RsWrk("prtDescription")
  553.                 Else
  554.                     schPartsID.ViewValue = schPartsID.CurrentValue
  555.                 End If
  556.                 Conn.CloseTempDataReader()
  557.             Else
  558.                 schPartsID.ViewValue = System.DBNull.Value
  559.             End If
  560.             schPartsID.CssStyle = ""
  561.             schPartsID.CssClass = ""
  562.             schPartsID.ViewCustomAttributes = ""
  563.  
  564.             ' schCallTime
  565.             schCallTime.ViewValue = schCallTime.CurrentValue
  566.             schCallTime.ViewValue = ew_FormatDateTime(schCallTime.ViewValue, 14)
  567.             schCallTime.CssStyle = ""
  568.             schCallTime.CssClass = ""
  569.             schCallTime.ViewCustomAttributes = ""
  570.  
  571.             ' schStartTime
  572.             schStartTime.ViewValue = schStartTime.CurrentValue
  573.             schStartTime.ViewValue = ew_FormatDateTime(schStartTime.ViewValue, 14)
  574.             schStartTime.CssStyle = ""
  575.             schStartTime.CssClass = ""
  576.             schStartTime.ViewCustomAttributes = ""
  577.  
  578.             ' schEndTime
  579.             schEndTime.ViewValue = schEndTime.CurrentValue
  580.             schEndTime.ViewValue = ew_FormatDateTime(schEndTime.ViewValue, 14)
  581.             schEndTime.CssStyle = ""
  582.             schEndTime.CssClass = ""
  583.             schEndTime.ViewCustomAttributes = ""
  584.  
  585.             ' schOutTime
  586.             schOutTime.ViewValue = schOutTime.CurrentValue
  587.             schOutTime.ViewValue = ew_FormatDateTime(schOutTime.ViewValue, 14)
  588.             schOutTime.CssStyle = ""
  589.             schOutTime.CssClass = ""
  590.             schOutTime.ViewCustomAttributes = ""
  591.  
  592.             ' schLocID
  593.             If ew_NotEmpty(schLocID.CurrentValue) Then
  594.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(schLocID.CurrentValue) & ""
  595.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  596.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  597.                 If RsWrk.Read() Then
  598.                     schLocID.ViewValue = RsWrk("locDescription")
  599.                 Else
  600.                     schLocID.ViewValue = schLocID.CurrentValue
  601.                 End If
  602.                 Conn.CloseTempDataReader()
  603.             Else
  604.                 schLocID.ViewValue = System.DBNull.Value
  605.             End If
  606.             schLocID.CssStyle = ""
  607.             schLocID.CssClass = ""
  608.             schLocID.ViewCustomAttributes = ""
  609.  
  610.             ' schEmpID
  611.             If ew_NotEmpty(schEmpID.CurrentValue) Then
  612.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(schEmpID.CurrentValue) & ""
  613.                 sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  614.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  615.                 If RsWrk.Read() Then
  616.                     schEmpID.ViewValue = RsWrk("empName")
  617.                 Else
  618.                     schEmpID.ViewValue = schEmpID.CurrentValue
  619.                 End If
  620.                 Conn.CloseTempDataReader()
  621.             Else
  622.                 schEmpID.ViewValue = System.DBNull.Value
  623.             End If
  624.             schEmpID.CssStyle = ""
  625.             schEmpID.CssClass = ""
  626.             schEmpID.ViewCustomAttributes = ""
  627.  
  628.             ' schPosID
  629.             If ew_NotEmpty(schPosID.CurrentValue) Then
  630.                 sSqlWrk = "SELECT [posDescription] FROM [tblPositions] WHERE [posID] = " & ew_AdjustSql(schPosID.CurrentValue) & ""
  631.                 sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  632.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  633.                 If RsWrk.Read() Then
  634.                     schPosID.ViewValue = RsWrk("posDescription")
  635.                 Else
  636.                     schPosID.ViewValue = schPosID.CurrentValue
  637.                 End If
  638.                 Conn.CloseTempDataReader()
  639.             Else
  640.                 schPosID.ViewValue = System.DBNull.Value
  641.             End If
  642.             schPosID.CssStyle = ""
  643.             schPosID.CssClass = ""
  644.             schPosID.ViewCustomAttributes = ""
  645.  
  646.             ' schTypID
  647.             If ew_NotEmpty(schTypID.CurrentValue) Then
  648.                 sSqlWrk = "SELECT [typDescription] FROM [tblTypes] WHERE [typID] = " & ew_AdjustSql(schTypID.CurrentValue) & ""
  649.                 sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  650.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  651.                 If RsWrk.Read() Then
  652.                     schTypID.ViewValue = RsWrk("typDescription")
  653.                 Else
  654.                     schTypID.ViewValue = schTypID.CurrentValue
  655.                 End If
  656.                 Conn.CloseTempDataReader()
  657.             Else
  658.                 schTypID.ViewValue = System.DBNull.Value
  659.             End If
  660.             schTypID.CssStyle = ""
  661.             schTypID.CssClass = ""
  662.             schTypID.ViewCustomAttributes = ""
  663.  
  664.             ' schActualStart
  665.             schActualStart.ViewValue = schActualStart.CurrentValue
  666.             schActualStart.ViewValue = ew_FormatDateTime(schActualStart.ViewValue, 14)
  667.             schActualStart.CssStyle = ""
  668.             schActualStart.CssClass = ""
  669.             schActualStart.ViewCustomAttributes = ""
  670.  
  671.             ' schActualEnd
  672.             schActualEnd.ViewValue = schActualEnd.CurrentValue
  673.             schActualEnd.ViewValue = ew_FormatDateTime(schActualEnd.ViewValue, 14)
  674.             schActualEnd.CssStyle = ""
  675.             schActualEnd.CssClass = ""
  676.             schActualEnd.ViewCustomAttributes = ""
  677.  
  678.             ' schDoubleBooked
  679.             If Convert.ToString(schDoubleBooked.CurrentValue) = "1" Then
  680.                 schDoubleBooked.ViewValue = "Yes"
  681.             Else
  682.                 schDoubleBooked.ViewValue = "No"
  683.             End If
  684.             schDoubleBooked.CssStyle = ""
  685.             schDoubleBooked.CssClass = ""
  686.             schDoubleBooked.ViewCustomAttributes = ""
  687.  
  688.             ' schStatus
  689.             If ew_NotEmpty(schStatus.CurrentValue) Then
  690.                 sSqlWrk = "SELECT [stDescription] FROM [tblScheduleStatus] WHERE [stID] = " & ew_AdjustSql(schStatus.CurrentValue) & ""
  691.                 sSqlWrk = sSqlWrk & " ORDER BY [stDescription] "
  692.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  693.                 If RsWrk.Read() Then
  694.                     schStatus.ViewValue = RsWrk("stDescription")
  695.                 Else
  696.                     schStatus.ViewValue = schStatus.CurrentValue
  697.                 End If
  698.                 Conn.CloseTempDataReader()
  699.             Else
  700.                 schStatus.ViewValue = System.DBNull.Value
  701.             End If
  702.             schStatus.CssStyle = ""
  703.             schStatus.CssClass = ""
  704.             schStatus.ViewCustomAttributes = ""
  705.  
  706.             ' schDayOfWeek
  707.             If ew_NotEmpty(schDayOfWeek.CurrentValue) Then
  708.                 Select Case schDayOfWeek.CurrentValue
  709.                     Case "1"
  710.                         schDayOfWeek.ViewValue = "Sun"
  711.                     Case "2"
  712.                         schDayOfWeek.ViewValue = "Mon"
  713.                     Case "3"
  714.                         schDayOfWeek.ViewValue = "Tues"
  715.                     Case "4"
  716.                         schDayOfWeek.ViewValue = "Wed"
  717.                     Case "5"
  718.                         schDayOfWeek.ViewValue = "Thu"
  719.                     Case "6"
  720.                         schDayOfWeek.ViewValue = "Fri"
  721.                     Case "7"
  722.                         schDayOfWeek.ViewValue = "Sat"
  723.                 End Select
  724.             Else
  725.                 schDayOfWeek.ViewValue = System.DBNull.Value
  726.             End If
  727.             schDayOfWeek.CssStyle = ""
  728.             schDayOfWeek.CssClass = ""
  729.             schDayOfWeek.ViewCustomAttributes = ""
  730.  
  731.             ' schNotes
  732.             schNotes.ViewValue = schActualEnd.CurrentValue
  733.             schNotes.CssStyle = ""
  734.             schNotes.CssClass = ""
  735.             schNotes.ViewCustomAttributes = ""
  736.  
  737.             ' schDate
  738.             schDate.HrefValue = ""
  739.  
  740.             ' schEvtID
  741.             schEvtID.HrefValue = ""
  742.  
  743.             ' schPartsID
  744.             schPartsID.HrefValue = ""
  745.  
  746.             ' schCallTime
  747.             schCallTime.HrefValue = ""
  748.  
  749.             ' schStartTime
  750.             schStartTime.HrefValue = ""
  751.  
  752.             ' schEndTime
  753.             schEndTime.HrefValue = ""
  754.  
  755.             ' schOutTime
  756.             schOutTime.HrefValue = ""
  757.  
  758.             ' schLocID
  759.             schLocID.HrefValue = ""
  760.  
  761.             ' schEmpID
  762.             schEmpID.HrefValue = ""
  763.  
  764.             ' schPosID
  765.             schPosID.HrefValue = ""
  766.  
  767.             ' schTypID
  768.             schTypID.HrefValue = ""
  769.  
  770.             ' schActualStart
  771.             schActualStart.HrefValue = ""
  772.  
  773.             ' schActualEnd
  774.             schActualEnd.HrefValue = ""
  775.  
  776.             ' schDoubleBooked
  777.             schDoubleBooked.HrefValue = ""
  778.  
  779.             ' schStatus
  780.             schStatus.HrefValue = ""
  781.  
  782.             ' schDayOfWeek
  783.             schDayOfWeek.HrefValue = ""
  784.  
  785.             ' schNotes
  786.             schNotes.HrefValue = ""
  787.  
  788.             ' Row Rendered event
  789.             Row_Rendered()
  790.         End Sub
  791.  
  792.         ' Add user ID filter
  793.         Public Function AddUserIDFilter(sFilter As String) As String
  794.             Dim sFilterWrk As String
  795.             sFilterWrk = Security.UserIDList
  796.             If Not Security.IsAdmin AndAlso sFilterWrk <> "" Then
  797.                 sFilterWrk = "[schEmpID] IN (" & sFilterWrk & ")"
  798.                 If sFilter <> "" Then sFilterWrk = "(" & sFilter & ") AND (" & sFilterWrk & ")"
  799.             Else
  800.                 sFilterWrk = sFilter
  801.             End If
  802.             Return sFilterWrk
  803.         End Function        
  804.  
  805.         ' Get user ID subquery
  806.         Public Function GetUserIDSubquery(ByRef fld As Object, ByRef masterfld As Object) As String
  807.             Dim sWrk As String = ""
  808.             Dim sSql As String = "SELECT " & masterfld.FldExpression & " FROM [tblSchedule] WHERE " & AddUserIDFilter("")            
  809.             If EW_USE_SUBQUERY_FOR_MASTER_USER_ID Then ' Use subquery
  810.                 sWrk = sSql
  811.             Else ' List all values
  812.                 Dim RsUser As OleDbDataReader = Conn.GetTempDataReader(sSql)
  813.                 Try
  814.                     Do While RsUser.Read()
  815.                         If sWrk <> "" Then sWrk = sWrk & ","
  816.                         sWrk = sWrk & ew_QuotedValue(RsUser(0), masterfld.FldDataType)
  817.                     Loop
  818.                 Finally
  819.                     Conn.CloseTempDataReader()
  820.                 End Try
  821.             End If
  822.             If sWrk <> "" Then
  823.                 sWrk = fld.FldExpression & " IN (" & sWrk & ")"
  824.             End If
  825.             Return sWrk
  826.         End Function
  827.  
  828.         Public CurrentAction As String ' Current action
  829.  
  830.         Public EventCancelled As Boolean ' Event cancelled
  831.  
  832.         Public CancelMessage As String ' Cancel message
  833.  
  834.         ' Row Type
  835.         Public RowType As Integer    
  836.  
  837.         Public CssClass As String = "" ' CSS class
  838.  
  839.         Public CssStyle As String = "" ' CSS style
  840.  
  841.         Public RowClientEvents As String = "" ' Row client events
  842.  
  843.         ' Row Attribute
  844.         Public ReadOnly Property RowAttributes() As String
  845.             Get
  846.                 Dim sAtt As String = ""
  847.                 If ew_NotEmpty(CssStyle) Then
  848.                     sAtt = sAtt & " style=""" & CssStyle.Trim() & """"
  849.                 End If
  850.                 If ew_NotEmpty(CssClass) Then
  851.                     sAtt = sAtt & " class=""" & CssClass.Trim() & """"
  852.                 End If
  853.                 If m_Export = "" Then
  854.                     If ew_NotEmpty(RowClientEvents) Then
  855.                         sAtt = sAtt & " " & RowClientEvents.Trim()
  856.                     End If
  857.                 End If
  858.                 Return sAtt
  859.             End Get
  860.         End Property
  861.  
  862.         ' Export
  863.         Private m_Export As String
  864.  
  865.         Public Property Export() As String
  866.             Get
  867.                 Return m_Export
  868.             End Get
  869.             Set(ByVal Value As String)
  870.                 m_Export = Value
  871.             End Set
  872.         End Property
  873.  
  874.         ' Export Original Value
  875.         Public ExportOriginalValue As Boolean = EW_EXPORT_ORIGINAL_VALUE
  876.  
  877.         ' Export All
  878.         Public ExportAll As Boolean = EW_EXPORT_ALL
  879.  
  880.         ' Send Email
  881.         Public SendEmail As Boolean
  882.  
  883.         ' Custom Inner Html
  884.         Public TableCustomInnerHtml As Object
  885.  
  886.         '
  887.         '  Field objects
  888.         '        
  889.         Public Function FieldByName(Name As String) As Object
  890.             If Name = "schSchID" Then Return schSchID
  891.             If Name = "schDate" Then Return schDate
  892.             If Name = "schEvtID" Then Return schEvtID
  893.             If Name = "schPartsID" Then Return schPartsID
  894.             If Name = "schCallTime" Then Return schCallTime
  895.             If Name = "schStartTime" Then Return schStartTime
  896.             If Name = "schEndTime" Then Return schEndTime
  897.             If Name = "schOutTime" Then Return schOutTime
  898.             If Name = "schLocID" Then Return schLocID
  899.             If Name = "schEmpID" Then Return schEmpID
  900.             If Name = "schPosID" Then Return schPosID
  901.             If Name = "schTypID" Then Return schTypID
  902.             If Name = "schDepID" Then Return schDepID
  903.             If Name = "schNotes" Then Return schNotes
  904.             If Name = "schRate" Then Return schRate
  905.             If Name = "schActualStart" Then Return schActualStart
  906.             If Name = "schActualEnd" Then Return schActualEnd
  907.             If Name = "schDateCreated" Then Return schDateCreated
  908.             If Name = "schDoubleBooked" Then Return schDoubleBooked
  909.             If Name = "schStatus" Then Return schStatus
  910.             If Name = "schDayOfWeek" Then Return schDayOfWeek
  911.             Return Nothing
  912.         End Function
  913.  
  914.         ' schSchID
  915.         Private m_schSchID As cField
  916.  
  917.         Public ReadOnly Property schSchID() As cField
  918.             Get
  919.                 If m_schSchID Is Nothing Then m_schSchID = New cField("tblSchedule", "x_schSchID", "schSchID", "[schSchID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  920.                 Return m_schSchID
  921.             End Get
  922.         End Property
  923.  
  924.         ' schDate
  925.         Private m_schDate As cField
  926.  
  927.         Public ReadOnly Property schDate() As cField
  928.             Get
  929.                 If m_schDate Is Nothing Then m_schDate = New cField("tblSchedule", "x_schDate", "schDate", "[schDate]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  6)
  930.                 Return m_schDate
  931.             End Get
  932.         End Property
  933.  
  934.         ' schEvtID
  935.         Private m_schEvtID As cField
  936.  
  937.         Public ReadOnly Property schEvtID() As cField
  938.             Get
  939.                 If m_schEvtID Is Nothing Then m_schEvtID = New cField("tblSchedule", "x_schEvtID", "schEvtID", "[schEvtID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  940.                 Return m_schEvtID
  941.             End Get
  942.         End Property
  943.  
  944.         ' schPartsID
  945.         Private m_schPartsID As cField
  946.  
  947.         Public ReadOnly Property schPartsID() As cField
  948.             Get
  949.                 If m_schPartsID Is Nothing Then m_schPartsID = New cField("tblSchedule", "x_schPartsID", "schPartsID", "[schPartsID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  950.                 Return m_schPartsID
  951.             End Get
  952.         End Property
  953.  
  954.         ' schCallTime
  955.         Private m_schCallTime As cField
  956.  
  957.         Public ReadOnly Property schCallTime() As cField
  958.             Get
  959.                 If m_schCallTime Is Nothing Then m_schCallTime = New cField("tblSchedule", "x_schCallTime", "schCallTime", "[schCallTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  960.                 Return m_schCallTime
  961.             End Get
  962.         End Property
  963.  
  964.         ' schStartTime
  965.         Private m_schStartTime As cField
  966.  
  967.         Public ReadOnly Property schStartTime() As cField
  968.             Get
  969.                 If m_schStartTime Is Nothing Then m_schStartTime = New cField("tblSchedule", "x_schStartTime", "schStartTime", "[schStartTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  970.                 Return m_schStartTime
  971.             End Get
  972.         End Property
  973.  
  974.         ' schEndTime
  975.         Private m_schEndTime As cField
  976.  
  977.         Public ReadOnly Property schEndTime() As cField
  978.             Get
  979.                 If m_schEndTime Is Nothing Then m_schEndTime = New cField("tblSchedule", "x_schEndTime", "schEndTime", "[schEndTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  980.                 Return m_schEndTime
  981.             End Get
  982.         End Property
  983.  
  984.         ' schOutTime
  985.         Private m_schOutTime As cField
  986.  
  987.         Public ReadOnly Property schOutTime() As cField
  988.             Get
  989.                 If m_schOutTime Is Nothing Then m_schOutTime = New cField("tblSchedule", "x_schOutTime", "schOutTime", "[schOutTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  990.                 Return m_schOutTime
  991.             End Get
  992.         End Property
  993.  
  994.         ' schLocID
  995.         Private m_schLocID As cField
  996.  
  997.         Public ReadOnly Property schLocID() As cField
  998.             Get
  999.                 If m_schLocID Is Nothing Then m_schLocID = New cField("tblSchedule", "x_schLocID", "schLocID", "[schLocID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1000.                 Return m_schLocID
  1001.             End Get
  1002.         End Property
  1003.  
  1004.         ' schEmpID
  1005.         Private m_schEmpID As cField
  1006.  
  1007.         Public ReadOnly Property schEmpID() As cField
  1008.             Get
  1009.                 If m_schEmpID Is Nothing Then m_schEmpID = New cField("tblSchedule", "x_schEmpID", "schEmpID", "[schEmpID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1010.                 Return m_schEmpID
  1011.             End Get
  1012.         End Property
  1013.  
  1014.         ' schPosID
  1015.         Private m_schPosID As cField
  1016.  
  1017.         Public ReadOnly Property schPosID() As cField
  1018.             Get
  1019.                 If m_schPosID Is Nothing Then m_schPosID = New cField("tblSchedule", "x_schPosID", "schPosID", "[schPosID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1020.                 Return m_schPosID
  1021.             End Get
  1022.         End Property
  1023.  
  1024.         ' schTypID
  1025.         Private m_schTypID As cField
  1026.  
  1027.         Public ReadOnly Property schTypID() As cField
  1028.             Get
  1029.                 If m_schTypID Is Nothing Then m_schTypID = New cField("tblSchedule", "x_schTypID", "schTypID", "[schTypID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1030.                 Return m_schTypID
  1031.             End Get
  1032.         End Property
  1033.  
  1034.         ' schDepID
  1035.         Private m_schDepID As cField
  1036.  
  1037.         Public ReadOnly Property schDepID() As cField
  1038.             Get
  1039.                 If m_schDepID Is Nothing Then m_schDepID = New cField("tblSchedule", "x_schDepID", "schDepID", "[schDepID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER,  0)
  1040.                 Return m_schDepID
  1041.             End Get
  1042.         End Property
  1043.  
  1044.         ' schNotes
  1045.         Private m_schNotes As cField
  1046.  
  1047.         Public ReadOnly Property schNotes() As cField
  1048.             Get
  1049.                 If m_schNotes Is Nothing Then m_schNotes = New cField("tblSchedule", "x_schNotes", "schNotes", "[schNotes]", 203, OleDbType.LongVarWChar, EW_DATATYPE_MEMO,  0)
  1050.                 Return m_schNotes
  1051.             End Get
  1052.         End Property
  1053.  
  1054.         ' schRate
  1055.         Private m_schRate As cField
  1056.  
  1057.         Public ReadOnly Property schRate() As cField
  1058.             Get
  1059.                 If m_schRate Is Nothing Then m_schRate = New cField("tblSchedule", "x_schRate", "schRate", "[schRate]", 6, OleDbType.Currency, EW_DATATYPE_NUMBER,  0)
  1060.                 Return m_schRate
  1061.             End Get
  1062.         End Property
  1063.  
  1064.         ' schActualStart
  1065.         Private m_schActualStart As cField
  1066.  
  1067.         Public ReadOnly Property schActualStart() As cField
  1068.             Get
  1069.                 If m_schActualStart Is Nothing Then m_schActualStart = New cField("tblSchedule", "x_schActualStart", "schActualStart", "[schActualStart]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  1070.                 Return m_schActualStart
  1071.             End Get
  1072.         End Property
  1073.  
  1074.         ' schActualEnd
  1075.         Private m_schActualEnd As cField
  1076.  
  1077.         Public ReadOnly Property schActualEnd() As cField
  1078.             Get
  1079.                 If m_schActualEnd Is Nothing Then m_schActualEnd = New cField("tblSchedule", "x_schActualEnd", "schActualEnd", "[schActualEnd]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  4)
  1080.                 Return m_schActualEnd
  1081.             End Get
  1082.         End Property
  1083.  
  1084.         ' schDateCreated
  1085.         Private m_schDateCreated As cField
  1086.  
  1087.         Public ReadOnly Property schDateCreated() As cField
  1088.             Get
  1089.                 If m_schDateCreated Is Nothing Then m_schDateCreated = New cField("tblSchedule", "x_schDateCreated", "schDateCreated", "[schDateCreated]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE,  6)
  1090.                 Return m_schDateCreated
  1091.             End Get
  1092.         End Property
  1093.  
  1094.         ' schDoubleBooked
  1095.         Private m_schDoubleBooked As cField
  1096.  
  1097.         Public ReadOnly Property schDoubleBooked() As cField
  1098.             Get
  1099.                 If m_schDoubleBooked Is Nothing Then m_schDoubleBooked = New cField("tblSchedule", "x_schDoubleBooked", "schDoubleBooked", "[schDoubleBooked]", 11, OleDbType.Boolean, EW_DATATYPE_BOOLEAN,  0)
  1100.                 Return m_schDoubleBooked
  1101.             End Get
  1102.         End Property
  1103.  
  1104.         ' schStatus
  1105.         Private m_schStatus As cField
  1106.  
  1107.         Public ReadOnly Property schStatus() As cField
  1108.             Get
  1109.                 If m_schStatus Is Nothing Then m_schStatus = New cField("tblSchedule", "x_schStatus", "schStatus", "[schStatus]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  1110.                 Return m_schStatus
  1111.             End Get
  1112.         End Property
  1113.  
  1114.         ' schDayOfWeek
  1115.         Private m_schDayOfWeek As cField
  1116.  
  1117.         Public ReadOnly Property schDayOfWeek() As cField
  1118.             Get
  1119.                 If m_schDayOfWeek Is Nothing Then m_schDayOfWeek = New cField("tblSchedule", "x_schDayOfWeek", "schDayOfWeek", "[schDayOfWeek]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  1120.                 Return m_schDayOfWeek
  1121.             End Get
  1122.         End Property
  1123.  
  1124.         ' Table level events
  1125.         ' Recordset Selecting event
  1126.         Public Sub Recordset_Selecting(ByRef filter As String) 
  1127.  
  1128.             ' Enter your code here    
  1129.         End Sub
  1130.  
  1131.         ' Recordset Selected event
  1132.         Public Sub Recordset_Selected(rs As DbDataReader)
  1133.  
  1134.             'HttpContext.Current.Response.Write("Recordset Selected")
  1135.         End Sub
  1136.  
  1137.         ' Recordset Searching event
  1138.         Public Sub Recordset_Searching(ByRef filter As String)
  1139.  
  1140.             ' Enter your code here
  1141.         End Sub
  1142.  
  1143.         ' Row_Selecting event
  1144.         Public Sub Row_Selecting(ByRef filter As String)
  1145.  
  1146.             ' Enter your code here    
  1147.         End Sub
  1148.  
  1149.         ' Row Selected event
  1150.         Public Sub Row_Selected(rs As DbDataReader)
  1151.  
  1152.             'HttpContext.Current.Response.Write("Row Selected")
  1153.         End Sub
  1154.  
  1155.         ' Row Rendering event
  1156.         Public Sub Row_Rendering()
  1157.  
  1158.             ' Enter your code here    
  1159.         End Sub
  1160.  
  1161.         ' Row Rendered event
  1162.         Public Sub Row_Rendered()
  1163.  
  1164.             ' To view properties of field class, use:
  1165.             ' HttpContext.Current.Response.Write(<FieldName>.AsString())
  1166.  
  1167.         End Sub
  1168.  
  1169.         ' Row Inserting event
  1170.         Public Function Row_Inserting(ByRef rs As OrderedDictionary) As Boolean
  1171.  
  1172.             ' Enter your code here
  1173.             ' To cancel, set return value to False and error message to CancelMessage
  1174.  
  1175.             Dim tmpTime As DateTime
  1176.  
  1177.             tmpTime = ew_FormatDateTime(rs("schDate"), 6) & " " & ew_FormatDateTime(rs("schStartTime"), 14)
  1178.             rs("schStartTime") = tmpTime
  1179.  
  1180.             tmpTime = ew_FormatDateTime(rs("schDate"), 6) & " " & ew_FormatDateTime(rs("schEndTime"), 14)
  1181.             rs("schEndTime") = tmpTime
  1182.  
  1183.             tmpTime = ew_FormatDateTime(rs("schDate"), 6) & " " & ew_FormatDateTime(rs("schCallTime"), 14)
  1184.             rs("schCallTime") = tmpTime
  1185.  
  1186.             tmpTime = ew_FormatDateTime(rs("schDate"), 6) & " " & ew_FormatDateTime(rs("schOutTime"), 14)
  1187.             rs("schOutTime") = tmpTime
  1188.  
  1189.             Return True
  1190.         End Function
  1191.  
  1192.         ' Row Inserted event
  1193.         Public Sub Row_Inserted(rs As OrderedDictionary)
  1194.  
  1195.             'HttpContext.Current.Response.Write("Row Inserted")
  1196.         End Sub
  1197.  
  1198.         ' Row Updating event
  1199.         Public Function Row_Updating(rsold As OrderedDictionary, ByRef rsnew As OrderedDictionary) As Boolean
  1200.  
  1201.             ' Enter your code here
  1202.             ' To cancel, set return value to False and error message to CancelMessage
  1203.             Dim tmpTime As DateTime, tmpSchDate As String
  1204.  
  1205.             If IsDBNull(rsnew("schDate")) Or rsnew("schDate") = Nothing Then
  1206.                 tmpSchDate = ew_FormatDateTime(rsold("schDate"), 6)
  1207.             Else
  1208.                 tmpSchDate = ew_FormatDateTime(rsnew("schDate"), 6)
  1209.             End If
  1210.             If ew_FormatDateTime(rsnew("schStartTime"), 14) <> "" Then
  1211.                 tmpTime = tmpSchDate & " " & ew_FormatDateTime(rsnew("schStartTime"), 14)
  1212.                 rsnew("schStartTime") = tmpTime
  1213.             End If
  1214.             If ew_FormatDateTime(rsnew("schEndTime"), 14) <> "" Then
  1215.                 tmpTime = tmpSchDate & " " & ew_FormatDateTime(rsnew("schEndTime"), 14)
  1216.                 rsnew("schEndTime") = tmpTime
  1217.             End If
  1218.             If ew_FormatDateTime(rsnew("schCallTime"), 14) <> "" Then
  1219.                 tmpTime = tmpSchDate & " " & ew_FormatDateTime(rsnew("schCallTime"), 14)
  1220.                 rsnew("schCallTime") = tmpTime
  1221.             End If
  1222.             If ew_FormatDateTime(rsnew("schOutTime"), 14) <> "" Then
  1223.                 tmpTime = tmpSchDate & " " & ew_FormatDateTime(rsnew("schOutTime"), 14)
  1224.                 rsnew("schOutTime") = tmpTime
  1225.             End If
  1226.  
  1227.             Return True
  1228.         End Function
  1229.  
  1230.         ' Row Updated event
  1231.         Public Sub Row_Updated(rsold As OrderedDictionary, rsnew As OrderedDictionary)
  1232.  
  1233.             'HttpContext.Current.Response.Write("Row Updated")
  1234.         End Sub
  1235.  
  1236.         ' Recordset Deleting event
  1237.         Public Function Row_Deleting(rs As OrderedDictionary) As Boolean
  1238.  
  1239.             ' Enter your code here
  1240.             ' To cancel, set return value to False and error message to CancelMessage
  1241.  
  1242.             Return True
  1243.         End Function
  1244.  
  1245.         ' Recordset Deleted event
  1246.         Public Sub Row_Deleted(rs As OrderedDictionary)
  1247.  
  1248.             'HttpContext.Current.Response.Write("Row Deleted")
  1249.         End Sub
  1250.  
  1251.         ' Email Sending event
  1252.         Public Function Email_Sending(ByRef Email As cEmail, Args As Hashtable) As Boolean
  1253.  
  1254.             'HttpContext.Current.Response.Write(Email.AsString())
  1255.             'HttpContext.Current.Response.End()
  1256.  
  1257.             Return True
  1258.         End Function
  1259.  
  1260.         ' Class terminate
  1261.         Public Sub Dispose() Implements IDisposable.Dispose
  1262.             If m_schSchID IsNot Nothing Then m_schSchID.Dispose()
  1263.             If m_schDate IsNot Nothing Then m_schDate.Dispose()
  1264.             If m_schEvtID IsNot Nothing Then m_schEvtID.Dispose()
  1265.             If m_schPartsID IsNot Nothing Then m_schPartsID.Dispose()
  1266.             If m_schCallTime IsNot Nothing Then m_schCallTime.Dispose()
  1267.             If m_schStartTime IsNot Nothing Then m_schStartTime.Dispose()
  1268.             If m_schEndTime IsNot Nothing Then m_schEndTime.Dispose()
  1269.             If m_schOutTime IsNot Nothing Then m_schOutTime.Dispose()
  1270.             If m_schLocID IsNot Nothing Then m_schLocID.Dispose()
  1271.             If m_schEmpID IsNot Nothing Then m_schEmpID.Dispose()
  1272.             If m_schPosID IsNot Nothing Then m_schPosID.Dispose()
  1273.             If m_schTypID IsNot Nothing Then m_schTypID.Dispose()
  1274.             If m_schDepID IsNot Nothing Then m_schDepID.Dispose()
  1275.             If m_schNotes IsNot Nothing Then m_schNotes.Dispose()
  1276.             If m_schRate IsNot Nothing Then m_schRate.Dispose()
  1277.             If m_schActualStart IsNot Nothing Then m_schActualStart.Dispose()
  1278.             If m_schActualEnd IsNot Nothing Then m_schActualEnd.Dispose()
  1279.             If m_schDateCreated IsNot Nothing Then m_schDateCreated.Dispose()
  1280.             If m_schDoubleBooked IsNot Nothing Then m_schDoubleBooked.Dispose()
  1281.             If m_schStatus IsNot Nothing Then m_schStatus.Dispose()
  1282.             If m_schDayOfWeek IsNot Nothing Then m_schDayOfWeek.Dispose()
  1283.         End Sub
  1284.     End Class
  1285. End Class
  1286.