home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / App_Code / askScheduleReportinfo.vb < prev    next >
Text File  |  2010-08-24  |  39KB  |  1,022 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 askScheduleReport As caskScheduleReport
  12.  
  13.     ' Define table class
  14.     Class caskScheduleReport
  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 "askScheduleReport"
  38.             End Get
  39.         End Property
  40.  
  41.         ' Table name
  42.         Public ReadOnly Property TableName() As String
  43.             Get
  44.                 Return "askScheduleReport"
  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 "askScheduleReport_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, ByVal 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(ByVal ofld, ByVal 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.schEmpID 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 ""
  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(ByVal where As String, ByVal 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.                 sSort = SessionOrderBy
  223.                 Return ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, sFilter, sSort)
  224.             End Get
  225.         End Property
  226.  
  227.         ' Return table SQL with list page filter
  228.         Public ReadOnly Property ListSQL() As String
  229.             Get
  230.                 Dim sFilter As String, sSort As String
  231.                 sFilter = SessionWhere
  232.                 If CurrentFilter <> "" Then
  233.                     If sFilter <> "" Then
  234.                         sFilter = "(" & sFilter & ") AND (" & CurrentFilter & ")"
  235.                     Else
  236.                         sFilter = CurrentFilter
  237.                     End If
  238.                 End If
  239.                 sSort = SessionOrderBy
  240.                 Return ew_BuildSelectSql(SqlSelect, SqlWhere, SqlGroupBy, SqlHaving, SqlOrderBy, sFilter, sSort)
  241.             End Get
  242.         End Property
  243.  
  244.         ' Return SQL for record count
  245.         Public ReadOnly Property SelectCountSQL() As String
  246.             Get
  247.                 Dim sFilter As String = SessionWhere
  248.                 If CurrentFilter <> "" Then
  249.                     If sFilter <> "" Then
  250.                         sFilter = "(" & sFilter & ") AND (" & CurrentFilter & ")"
  251.                     Else
  252.                         sFilter = CurrentFilter
  253.                     End If
  254.                 End If
  255.                 Return ew_BuildSelectSql("SELECT COUNT(*) FROM " & SqlSelect.Substring(14), SqlWhere, "", "", "", sFilter, "")
  256.             End Get
  257.         End Property
  258.  
  259.         ' Insert
  260.         Public Function Insert(ByRef Rs As OrderedDictionary) As Integer
  261.             Dim Sql As String = ""
  262.             Dim names As String = ""
  263.             Dim values As String = ""
  264.             Dim value As Object
  265.             Dim fld As cField
  266.             For Each f As DictionaryEntry In Rs
  267.                 fld = FieldByName(f.Key)
  268.                 If fld IsNot Nothing Then
  269.                     names = names & fld.FldExpression & ","
  270.                     values = values & EW_DB_SQLPARAM_SYMBOL
  271.                     If EW_DB_SQLPARAM_SYMBOL <> "?" Then values = values & fld.FldVar
  272.                     values = values & ","
  273.                 End If
  274.             Next f
  275.             If names.EndsWith(",") Then names = names.Remove(names.Length - 1)
  276.             If values.EndsWith(",") Then values = values.Remove(values.Length - 1)
  277.             If names = "" Then Return -1
  278.             Sql = "INSERT INTO tblSchedule (" & names & ") VALUES (" & values & ")"
  279.             Dim command As OleDbCommand = Conn.GetCommand(Sql)
  280.             For Each f As DictionaryEntry In Rs
  281.                 fld = FieldByName(f.Key)
  282.                 If fld IsNot Nothing Then
  283.                     value = f.Value
  284.                     command.Parameters.Add(fld.FldVar, fld.FldDbType).Value = value
  285.                 End If
  286.             Next
  287.             Return command.ExecuteNonQuery()
  288.         End Function
  289.  
  290.         ' Update
  291.         Public Function Update(ByRef Rs As OrderedDictionary) As Integer
  292.             Dim Sql As String = ""
  293.             Dim values As String = ""
  294.             Dim value As Object
  295.             Dim fld As cField
  296.             For Each f As DictionaryEntry In Rs
  297.                 fld = FieldByName(f.Key)
  298.                 If fld IsNot Nothing Then
  299.                     values = values & fld.FldExpression & "=" & EW_DB_SQLPARAM_SYMBOL
  300.                     If EW_DB_SQLPARAM_SYMBOL <> "?" Then values = values & fld.FldVar
  301.                     values = values & ","
  302.                 End If
  303.             Next f
  304.             If values.EndsWith(",") Then values = values.Remove(values.Length - 1)
  305.             If values = "" Then Return -1
  306.             Sql = "UPDATE tblSchedule SET " & values
  307.             If CurrentFilter <> "" Then Sql = Sql & " WHERE " & CurrentFilter
  308.             Dim command As OleDbCommand = Conn.GetCommand(Sql)
  309.             For Each f As DictionaryEntry In Rs
  310.                 fld = FieldByName(f.Key)
  311.                 If fld IsNot Nothing Then
  312.                     value = f.Value
  313.                     command.Parameters.Add(fld.FldVar, fld.FldDbType).Value = value
  314.                 End If
  315.             Next
  316.             Return command.ExecuteNonQuery()
  317.         End Function
  318.  
  319.         ' Delete
  320.         Public Function Delete(ByRef Rs As OrderedDictionary) As Integer
  321.             Dim Sql As String
  322.             Dim fld As cField
  323.             Sql = "DELETE FROM tblSchedule WHERE "
  324.             fld = FieldByName("schSchID")
  325.             Sql = Sql & fld.FldExpression & "=" & ew_QuotedValue(Rs("schSchID"), EW_DATATYPE_NUMBER) & " AND "
  326.             If Sql.EndsWith(" AND ") Then Sql = Sql.Remove(Sql.Length - 5)
  327.             If CurrentFilter <> "" Then Sql = Sql & " AND " & CurrentFilter
  328.             Return Conn.Execute(Sql)
  329.         End Function
  330.  
  331.         ' Key filter for table
  332.         Private ReadOnly Property SqlKeyFilter() As String
  333.             Get
  334.                 Return "tblSchedule.schSchID = @schSchID@"
  335.             End Get
  336.         End Property
  337.  
  338.         ' Return Key filter for table
  339.         Public ReadOnly Property KeyFilter() As String
  340.             Get
  341.                 Dim sKeyFilter As String
  342.                 sKeyFilter = SqlKeyFilter
  343.                 If Not IsNumeric(schSchID.CurrentValue) Then
  344.                     sKeyFilter = "0=1" ' Invalid key
  345.                 End If
  346.                 sKeyFilter = sKeyFilter.Replace("@schSchID@", ew_AdjustSql(schSchID.CurrentValue)) ' Replace key value
  347.                 Return sKeyFilter
  348.             End Get
  349.         End Property
  350.  
  351.         ' Return URL
  352.         Public ReadOnly Property ReturnUrl() As String
  353.             Get ' Get referer URL automatically
  354.                 If HttpContext.Current.Request.ServerVariables("HTTP_REFERER") IsNot Nothing Then
  355.                     If ew_ReferPage() <> ew_CurrentPage() AndAlso ew_ReferPage() <> "login.aspx" Then ' Referer not same page or login page
  356.                         Dim url As String = HttpContext.Current.Request.ServerVariables("HTTP_REFERER")
  357.                         If url.Contains("?a=") Then ' Remove action
  358.                             Dim p1 As Integer = url.LastIndexOf("?a=")
  359.                             Dim p2 As Integer = url.IndexOf("&", p1)
  360.                             If p2 > -1 Then
  361.                                 url = url.Substring(0, p1 + 1) & url.Substring(p2 + 1)
  362.                             Else
  363.                                 url = url.Substring(0, p1)
  364.                             End If
  365.                         End If
  366.                         ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL) = url ' Save to Session
  367.                     End If
  368.                 End If
  369.                 If ew_NotEmpty(ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL)) Then
  370.                     Return ew_Session(EW_PROJECT_NAME & "_" & TableVar & "_" & EW_TABLE_RETURN_URL)
  371.                 Else
  372.                     Return "askScheduleReportlist.aspx"
  373.                 End If
  374.             End Get
  375.         End Property
  376.  
  377.         ' View URL
  378.         Public Function ViewUrl() As String
  379.             Return KeyUrl("askScheduleReportview.aspx", UrlParm(""))
  380.         End Function
  381.  
  382.         ' Add URL
  383.         Public Function AddUrl() As String
  384.             AddUrl = "askScheduleReportadd.aspx"
  385.             Dim sUrlParm As String
  386.             sUrlParm = UrlParm("")
  387.             If sUrlParm <> "" Then AddUrl = AddUrl & "?" & sUrlParm
  388.         End Function
  389.  
  390.         ' Edit URL
  391.         Public Function EditUrl() As String
  392.             Return KeyUrl("askScheduleReportedit.aspx", UrlParm(""))
  393.         End Function
  394.  
  395.         ' Inline edit URL
  396.         Public Function InlineEditUrl() As String
  397.             Return KeyUrl(ew_CurrentPage(), UrlParm("a=edit"))
  398.         End Function
  399.  
  400.         ' Copy URL
  401.         Public Function CopyUrl() As String
  402.             Return KeyUrl("askScheduleReportadd.aspx", UrlParm(""))
  403.         End Function
  404.  
  405.         ' Inline copy URL
  406.         Public Function InlineCopyUrl() As String
  407.             Return KeyUrl(ew_CurrentPage(), UrlParm("a=copy"))
  408.         End Function
  409.  
  410.         ' Delete URL
  411.         Public Function DeleteUrl() As String
  412.             Return KeyUrl("askScheduleReportdelete.aspx", UrlParm(""))
  413.         End Function
  414.  
  415.         ' Key URL
  416.         Public Function KeyUrl(ByVal url As String, ByVal parm As String) As String
  417.             Dim sUrl As String
  418.             sUrl = url & "?"
  419.             If parm <> "" Then sUrl = sUrl & parm & "&"
  420.             If Not IsDBNull(schSchID.CurrentValue) Then
  421.                 sUrl = sUrl & "schSchID=" & schSchID.CurrentValue
  422.             Else
  423.                 Return "javascript:alert('Invalid Record! Key is null');"
  424.             End If
  425.             Return sUrl
  426.         End Function
  427.  
  428.         ' URL parm
  429.         Function UrlParm(ByVal parm As String) As String
  430.             Dim OutStr As String = ""
  431.             If UseTokenInUrl Then
  432.                 OutStr = "t=askScheduleReport"
  433.             End If
  434.             If parm <> "" Then
  435.                 If OutStr <> "" Then OutStr = OutStr & "&"
  436.                 OutStr = OutStr & parm
  437.             End If
  438.             Return OutStr
  439.         End Function
  440.  
  441.         ' Sort URL
  442.         Public Function SortUrl(ByRef fld As cField) As String
  443.             Dim OutStr As String = ""
  444.             If CurrentAction <> "" OrElse Export <> "" OrElse (fld.FldType = 201 OrElse fld.FldType = 203 OrElse fld.FldType = 205) Then
  445.                 OutStr = ""
  446.             Else
  447.                 OutStr = ew_CurrentPage()
  448.                 Dim sUrlParm As String
  449.                 sUrlParm = UrlParm("order=" & HttpContext.Current.Server.UrlEncode(fld.FldName) & "&ordertype=" & fld.ReverseSort)
  450.                 OutStr = OutStr & "?" & sUrlParm
  451.             End If
  452.             Return OutStr
  453.         End Function
  454.  
  455.         ' Load rows based on filter
  456.         Public Function LoadRs(ByVal sFilter As String) As OleDbDataReader
  457.             Dim RsRows As OleDbDataReader
  458.  
  459.             ' Set up filter (SQL WHERE clause)
  460.             CurrentFilter = sFilter
  461.             Dim sSql As String = SQL()
  462.             Try
  463.                 RsRows = Conn.GetDataReader(sSql)
  464.                 If RsRows.HasRows Then
  465.                     Return RsRows
  466.                 Else
  467.                     RsRows.Close()
  468.                     RsRows.Dispose()
  469.                 End If
  470.             Catch
  471.             End Try
  472.             Return Nothing
  473.         End Function
  474.  
  475.         ' Load row values from recordset
  476.         Public Sub LoadListRowValues(ByRef RsRow As OleDbDataReader)
  477.             schSchID.DbValue = RsRow("schSchID")
  478.             schDate.DbValue = RsRow("schDate")
  479.             schEvtID.DbValue = RsRow("schEvtID")
  480.             schPartsID.DbValue = RsRow("schPartsID")
  481.             schCallTime.DbValue = RsRow("schCallTime")
  482.             schStartTime.DbValue = RsRow("schStartTime")
  483.             schEndTime.DbValue = RsRow("schEndTime")
  484.             schOutTime.DbValue = RsRow("schOutTime")
  485.             schLocID.DbValue = RsRow("schLocID")
  486.             schEmpID.DbValue = RsRow("schEmpID")
  487.             schPosID.DbValue = RsRow("schPosID")
  488.             schTypID.DbValue = RsRow("schTypID")
  489.             schDepID.DbValue = RsRow("schDepID")
  490.             schNotes.DbValue = RsRow("schNotes")
  491.         End Sub
  492.  
  493.         ' Render list row values
  494.         Public Sub RenderListRow()
  495.  
  496.             ' Row Rendering event
  497.             Row_Rendering()
  498.  
  499.             ' schDate
  500.             schDate.ViewValue = schDate.CurrentValue
  501.             schDate.ViewValue = ew_FormatDateTime(schDate.ViewValue, 6)
  502.             schDate.CssStyle = ""
  503.             schDate.CssClass = ""
  504.             schDate.ViewCustomAttributes = ""
  505.  
  506.             ' schEvtID
  507.             If ew_NotEmpty(schEvtID.CurrentValue) Then
  508.                 sSqlWrk = "SELECT [evtDescription] FROM [tblEvents] WHERE [evtID] = " & ew_AdjustSql(schEvtID.CurrentValue) & ""
  509.                 sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  510.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  511.                 If RsWrk.Read() Then
  512.                     schEvtID.ViewValue = RsWrk("evtDescription")
  513.                 Else
  514.                     schEvtID.ViewValue = schEvtID.CurrentValue
  515.                 End If
  516.                 Conn.CloseTempDataReader()
  517.             Else
  518.                 schEvtID.ViewValue = System.DBNull.Value
  519.             End If
  520.             schEvtID.CssStyle = ""
  521.             schEvtID.CssClass = ""
  522.             schEvtID.ViewCustomAttributes = ""
  523.  
  524.             ' schPartsID
  525.             If ew_NotEmpty(schPartsID.CurrentValue) Then
  526.                 sSqlWrk = "SELECT [prtDescription] FROM [tblParts] WHERE [prtID] = " & ew_AdjustSql(schPartsID.CurrentValue) & ""
  527.                 sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  528.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  529.                 If RsWrk.Read() Then
  530.                     schPartsID.ViewValue = RsWrk("prtDescription")
  531.                 Else
  532.                     schPartsID.ViewValue = schPartsID.CurrentValue
  533.                 End If
  534.                 Conn.CloseTempDataReader()
  535.             Else
  536.                 schPartsID.ViewValue = System.DBNull.Value
  537.             End If
  538.             schPartsID.CssStyle = ""
  539.             schPartsID.CssClass = ""
  540.             schPartsID.ViewCustomAttributes = ""
  541.  
  542.             ' schLocID
  543.             If ew_NotEmpty(schLocID.CurrentValue) Then
  544.                 sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(schLocID.CurrentValue) & ""
  545.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  546.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  547.                 If RsWrk.Read() Then
  548.                     schLocID.ViewValue = RsWrk("locDescription")
  549.                 Else
  550.                     schLocID.ViewValue = schLocID.CurrentValue
  551.                 End If
  552.                 Conn.CloseTempDataReader()
  553.             Else
  554.                 schLocID.ViewValue = System.DBNull.Value
  555.             End If
  556.             schLocID.CssStyle = ""
  557.             schLocID.CssClass = ""
  558.             schLocID.ViewCustomAttributes = ""
  559.  
  560.             ' schCallTime
  561.             schCallTime.ViewValue = schCallTime.CurrentValue
  562.             schCallTime.ViewValue = ew_FormatDateTime(schCallTime.ViewValue, 4)
  563.             schCallTime.CssStyle = ""
  564.             schCallTime.CssClass = ""
  565.             schCallTime.ViewCustomAttributes = ""
  566.  
  567.             ' schStartTime
  568.             schStartTime.ViewValue = schStartTime.CurrentValue
  569.             schStartTime.ViewValue = ew_FormatDateTime(schStartTime.ViewValue, 4)
  570.             schStartTime.CssStyle = ""
  571.             schStartTime.CssClass = ""
  572.             schStartTime.ViewCustomAttributes = ""
  573.  
  574.             ' schEndTime
  575.             schEndTime.ViewValue = schEndTime.CurrentValue
  576.             schEndTime.ViewValue = ew_FormatDateTime(schEndTime.ViewValue, 4)
  577.             schEndTime.CssStyle = ""
  578.             schEndTime.CssClass = ""
  579.             schEndTime.ViewCustomAttributes = ""
  580.  
  581.             ' schOutTime
  582.             schOutTime.ViewValue = schOutTime.CurrentValue
  583.             schOutTime.ViewValue = ew_FormatDateTime(schOutTime.ViewValue, 4)
  584.             schOutTime.CssStyle = ""
  585.             schOutTime.CssClass = ""
  586.             schOutTime.ViewCustomAttributes = ""
  587.  
  588.             ' schEmpID
  589.             If ew_NotEmpty(schEmpID.CurrentValue) Then
  590.                 sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(schEmpID.CurrentValue) & ""
  591.                 sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  592.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  593.                 If RsWrk.Read() Then
  594.                     schEmpID.ViewValue = RsWrk("empName")
  595.                 Else
  596.                     schEmpID.ViewValue = schEmpID.CurrentValue
  597.                 End If
  598.                 Conn.CloseTempDataReader()
  599.             Else
  600.                 schEmpID.ViewValue = System.DBNull.Value
  601.             End If
  602.             schEmpID.CssStyle = ""
  603.             schEmpID.CssClass = ""
  604.             schEmpID.ViewCustomAttributes = ""
  605.  
  606.             ' schPosID
  607.             If ew_NotEmpty(schPosID.CurrentValue) Then
  608.                 sSqlWrk = "SELECT [posDescription] FROM [tblPositions] WHERE [posID] = " & ew_AdjustSql(schPosID.CurrentValue) & ""
  609.                 sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  610.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  611.                 If RsWrk.Read() Then
  612.                     schPosID.ViewValue = RsWrk("posDescription")
  613.                 Else
  614.                     schPosID.ViewValue = schPosID.CurrentValue
  615.                 End If
  616.                 Conn.CloseTempDataReader()
  617.             Else
  618.                 schPosID.ViewValue = System.DBNull.Value
  619.             End If
  620.             schPosID.CssStyle = ""
  621.             schPosID.CssClass = ""
  622.             schPosID.ViewCustomAttributes = ""
  623.  
  624.             ' schTypID
  625.             If ew_NotEmpty(schTypID.CurrentValue) Then
  626.                 sSqlWrk = "SELECT [typDescription] FROM [tblTypes] WHERE [typID] = " & ew_AdjustSql(schTypID.CurrentValue) & ""
  627.                 sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  628.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  629.                 If RsWrk.Read() Then
  630.                     schTypID.ViewValue = RsWrk("typDescription")
  631.                 Else
  632.                     schTypID.ViewValue = schTypID.CurrentValue
  633.                 End If
  634.                 Conn.CloseTempDataReader()
  635.             Else
  636.                 schTypID.ViewValue = System.DBNull.Value
  637.             End If
  638.             schTypID.CssStyle = ""
  639.             schTypID.CssClass = ""
  640.             schTypID.ViewCustomAttributes = ""
  641.  
  642.  
  643.             ' schDate
  644.             schDate.HrefValue = ""
  645.  
  646.             ' schEvtID
  647.             schEvtID.HrefValue = ""
  648.  
  649.             ' schPartsID
  650.             schPartsID.HrefValue = ""
  651.  
  652.             ' schLocID
  653.             schLocID.HrefValue = ""
  654.  
  655.             ' schCallTime
  656.             schCallTime.HrefValue = ""
  657.  
  658.             ' schStartTime
  659.             schStartTime.HrefValue = ""
  660.  
  661.             ' schEndTime
  662.             schEndTime.HrefValue = ""
  663.  
  664.             ' schOutTime
  665.             schOutTime.HrefValue = ""
  666.  
  667.             ' schEmpID
  668.             schEmpID.HrefValue = ""
  669.  
  670.             ' schPosID
  671.             schPosID.HrefValue = ""
  672.  
  673.             ' schTypID
  674.             schTypID.HrefValue = ""
  675.  
  676.             ' schDepID
  677.             schDepID.HrefValue = ""
  678.  
  679.             ' Row Rendered event
  680.             Row_Rendered()
  681.         End Sub
  682.  
  683.         Public CurrentAction As String ' Current action
  684.  
  685.         Public EventCancelled As Boolean ' Event cancelled
  686.  
  687.         Public CancelMessage As String ' Cancel message
  688.  
  689.         ' Row Type
  690.         Public RowType As Integer
  691.  
  692.         Public CssClass As String = "" ' CSS class
  693.  
  694.         Public CssStyle As String = "" ' CSS style
  695.  
  696.         Public RowClientEvents As String = "" ' Row client events
  697.  
  698.         ' Row Attribute
  699.         Public ReadOnly Property RowAttributes() As String
  700.             Get
  701.                 Dim sAtt As String = ""
  702.                 If ew_NotEmpty(CssStyle) Then
  703.                     sAtt = sAtt & " style=""" & CssStyle.Trim() & """"
  704.                 End If
  705.                 If ew_NotEmpty(CssClass) Then
  706.                     sAtt = sAtt & " class=""" & CssClass.Trim() & """"
  707.                 End If
  708.                 If m_Export = "" Then
  709.                     If ew_NotEmpty(RowClientEvents) Then
  710.                         sAtt = sAtt & " " & RowClientEvents.Trim()
  711.                     End If
  712.                 End If
  713.                 Return sAtt
  714.             End Get
  715.         End Property
  716.  
  717.         ' Export
  718.         Private m_Export As String
  719.  
  720.         Public Property Export() As String
  721.             Get
  722.                 Return m_Export
  723.             End Get
  724.             Set(ByVal Value As String)
  725.                 m_Export = Value
  726.             End Set
  727.         End Property
  728.  
  729.         ' Export Original Value
  730.         Public ExportOriginalValue As Boolean = EW_EXPORT_ORIGINAL_VALUE
  731.  
  732.         ' Export All
  733.         Public ExportAll As Boolean = EW_EXPORT_ALL
  734.  
  735.         ' Send Email
  736.         Public SendEmail As Boolean
  737.  
  738.         ' Custom Inner Html
  739.         Public TableCustomInnerHtml As Object
  740.  
  741.         '
  742.         '  Field objects
  743.         '        
  744.         Public Function FieldByName(ByVal Name As String) As Object
  745.             If Name = "schSchID" Then Return schSchID
  746.             If Name = "schDate" Then Return schDate
  747.             If Name = "schEvtID" Then Return schEvtID
  748.             If Name = "schPartsID" Then Return schPartSID
  749.             If Name = "schCallTime" Then Return schCallTime
  750.             If Name = "schStartTime" Then Return schStartTime
  751.             If Name = "schEndTime" Then Return schEndTime
  752.             If Name = "schOutTime" Then Return schOutTime
  753.             If Name = "schLocID" Then Return schLocID
  754.             If Name = "schEmpID" Then Return schEmpID
  755.             If Name = "schPosID" Then Return schPosID
  756.             If Name = "schTypID" Then Return schTypID
  757.             If Name = "schDepID" Then Return schDepID
  758.             If Name = "schDepID" Then Return schDepID
  759.             If Name = "schNotes" Then Return schNotes
  760.             Return Nothing
  761.         End Function
  762.  
  763.         ' schSchID
  764.         Private m_schSchID As cField
  765.  
  766.         Public ReadOnly Property schSchID() As cField
  767.             Get
  768.                 If m_schSchID Is Nothing Then m_schSchID = New cField("askScheduleReport", "x_schSchID", "schSchID", "askScheduleReport.schSchID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  769.                 Return m_schSchID
  770.             End Get
  771.         End Property
  772.  
  773.         ' schDate
  774.         Private m_schDate As cField
  775.  
  776.         Public ReadOnly Property schDate() As cField
  777.             Get
  778.                 If m_schDate Is Nothing Then m_schDate = New cField("askScheduleReport", "x_schDate", "schDate", "askScheduleReport.schDate", 7, OleDbType.Date, EW_DATATYPE_DATE, 6)
  779.                 Return m_schDate
  780.             End Get
  781.         End Property
  782.  
  783.         ' schEvtID
  784.         Private m_schEvtID As cField
  785.  
  786.         Public ReadOnly Property schEvtID() As cField
  787.             Get
  788.                 If m_schEvtID Is Nothing Then m_schEvtID = New cField("askScheduleReport", "x_schEvtID", "schEvtID", "askScheduleReport.schEvtID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  789.                 Return m_schEvtID
  790.             End Get
  791.         End Property
  792.  
  793.         ' schPartsID
  794.         Private m_schPartsID As cField
  795.  
  796.         Public ReadOnly Property schPartsID() As cField
  797.             Get
  798.                 If m_schPartsID Is Nothing Then m_schPartsID = New cField("askScheduleReport", "x_schPartsID", "schPartsID", "askScheduleReport.schPartsID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  799.                 Return m_schPartsID
  800.             End Get
  801.         End Property
  802.  
  803.         ' schLocID
  804.         Private m_schLocID As cField
  805.  
  806.         Public ReadOnly Property schLocID() As cField
  807.             Get
  808.                 If m_schLocID Is Nothing Then m_schLocID = New cField("askScheduleReport", "x_schLocID", "schLocID", "[schLocID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  809.                 Return m_schLocID
  810.             End Get
  811.         End Property
  812.  
  813.         ' schEmpID
  814.         Private m_schEmpID As cField
  815.  
  816.         Public ReadOnly Property schEmpID() As cField
  817.             Get
  818.                 If m_schEmpID Is Nothing Then m_schEmpID = New cField("askScheduleReport", "x_schEmpID", "schEmpID", "askScheduleReport.schEmpID", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  819.                 Return m_schEmpID
  820.             End Get
  821.         End Property
  822.  
  823.         ' schPosID
  824.         Private m_schPosID As cField
  825.  
  826.         Public ReadOnly Property schPosID() As cField
  827.             Get
  828.                 If m_schPosID Is Nothing Then m_schPosID = New cField("askScheduleReport", "x_schPosID", "schPosID", "[schPosID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  829.                 Return m_schPosID
  830.             End Get
  831.         End Property
  832.  
  833.         ' schTypID
  834.         Private m_schTypID As cField
  835.  
  836.         Public ReadOnly Property schTypID() As cField
  837.             Get
  838.                 If m_schTypID Is Nothing Then m_schTypID = New cField("askScheduleReport", "x_schTypID", "schTypID", "[schTypID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  839.                 Return m_schTypID
  840.             End Get
  841.         End Property
  842.  
  843.         ' schDepID
  844.         Private m_schDepID As cField
  845.  
  846.         Public ReadOnly Property schDepID() As cField
  847.             Get
  848.                 If m_schDepID Is Nothing Then m_schDepID = New cField("askScheduleReport", "x_schDepID", "schDepID", "[schDepID]", 3, OleDbType.Integer, EW_DATATYPE_NUMBER, 0)
  849.                 Return m_schDepID
  850.             End Get
  851.         End Property
  852.  
  853.         ' schCallTime
  854.         Private m_schCallTime As cField
  855.  
  856.         Public ReadOnly Property schCallTime() As cField
  857.             Get
  858.                 If m_schCallTime Is Nothing Then m_schCallTime = New cField("askScheduleReport", "x_schCallTime", "schCallTime", "[schCallTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE, 4)
  859.                 Return m_schDate
  860.             End Get
  861.         End Property
  862.  
  863.         ' schStartTime
  864.         Private m_schStartTime As cField
  865.  
  866.         Public ReadOnly Property schStartTime() As cField
  867.             Get
  868.                 If m_schStartTime Is Nothing Then m_schStartTime = New cField("askScheduleReport", "x_schStartTime", "schStartTime", "[schStartTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE, 4)
  869.                 Return m_schDate
  870.             End Get
  871.         End Property
  872.  
  873.         ' schEndTime
  874.         Private m_schEndTime As cField
  875.  
  876.         Public ReadOnly Property schEndTime() As cField
  877.             Get
  878.                 If m_schEndTime Is Nothing Then m_schEndTime = New cField("askScheduleReport", "x_schEndTime", "schEndTime", "[schEndTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE, 4)
  879.                 Return m_schDate
  880.             End Get
  881.         End Property
  882.  
  883.         ' schOutTime
  884.         Private m_schOutTime As cField
  885.  
  886.         Public ReadOnly Property schOutTime() As cField
  887.             Get
  888.                 If m_schOutTime Is Nothing Then m_schOutTime = New cField("askScheduleReport", "x_schOutTime", "schOutTime", "[schOutTime]", 135, OleDbType.DBTimeStamp, EW_DATATYPE_DATE, 4)
  889.                 Return m_schDate
  890.             End Get
  891.         End Property
  892.  
  893.         ' schNotes
  894.         Private m_schNotes As cField
  895.  
  896.         Public ReadOnly Property schNotes() As cField
  897.             Get
  898.                 If m_schNotes Is Nothing Then m_schNotes = New cField("askScheduleReport", "x_schNotes", "schNotes", "[schNotes]", 203, OleDbType.LongVarWChar, EW_DATATYPE_MEMO, 0)
  899.                 Return m_schNotes
  900.             End Get
  901.         End Property
  902.  
  903.  
  904.         ' Table level events
  905.         ' Recordset Selecting event
  906.         Public Sub Recordset_Selecting(ByRef filter As String)
  907.  
  908.             ' Enter your code here    
  909.         End Sub
  910.  
  911.         ' Recordset Selected event
  912.         Public Sub Recordset_Selected(ByVal rs As DbDataReader)
  913.  
  914.             'HttpContext.Current.Response.Write("Recordset Selected")
  915.         End Sub
  916.  
  917.         ' Recordset Searching event
  918.         Public Sub Recordset_Searching(ByRef filter As String)
  919.  
  920.             ' Enter your code here
  921.         End Sub
  922.  
  923.         ' Row_Selecting event
  924.         Public Sub Row_Selecting(ByRef filter As String)
  925.  
  926.             ' Enter your code here    
  927.         End Sub
  928.  
  929.         ' Row Selected event
  930.         Public Sub Row_Selected(ByVal rs As DbDataReader)
  931.  
  932.             'HttpContext.Current.Response.Write("Row Selected")
  933.         End Sub
  934.  
  935.         ' Row Rendering event
  936.         Public Sub Row_Rendering()
  937.  
  938.             ' Enter your code here    
  939.         End Sub
  940.  
  941.         ' Row Rendered event
  942.         Public Sub Row_Rendered()
  943.  
  944.             ' To view properties of field class, use:
  945.             ' HttpContext.Current.Response.Write(<FieldName>.AsString())
  946.  
  947.         End Sub
  948.  
  949.         ' Row Inserting event
  950.         Public Function Row_Inserting(ByRef rs As OrderedDictionary) As Boolean
  951.  
  952.             ' Enter your code here
  953.             ' To cancel, set return value to False and error message to CancelMessage
  954.  
  955.             Return True
  956.         End Function
  957.  
  958.         ' Row Inserted event
  959.         Public Sub Row_Inserted(ByVal rs As OrderedDictionary)
  960.  
  961.             'HttpContext.Current.Response.Write("Row Inserted")
  962.         End Sub
  963.  
  964.         ' Row Updating event
  965.         Public Function Row_Updating(ByVal rsold As OrderedDictionary, ByRef rsnew As OrderedDictionary) As Boolean
  966.  
  967.             ' Enter your code here
  968.             ' To cancel, set return value to False and error message to CancelMessage
  969.  
  970.             Return True
  971.         End Function
  972.  
  973.         ' Row Updated event
  974.         Public Sub Row_Updated(ByVal rsold As OrderedDictionary, ByVal rsnew As OrderedDictionary)
  975.  
  976.             'HttpContext.Current.Response.Write("Row Updated")
  977.         End Sub
  978.  
  979.         ' Recordset Deleting event
  980.         Public Function Row_Deleting(ByVal rs As OrderedDictionary) As Boolean
  981.  
  982.             ' Enter your code here
  983.             ' To cancel, set return value to False and error message to CancelMessage
  984.  
  985.             Return True
  986.         End Function
  987.  
  988.         ' Recordset Deleted event
  989.         Public Sub Row_Deleted(ByVal rs As OrderedDictionary)
  990.  
  991.             'HttpContext.Current.Response.Write("Row Deleted")
  992.         End Sub
  993.  
  994.         ' Email Sending event
  995.         Public Function Email_Sending(ByRef Email As cEmail, ByVal Args As Hashtable) As Boolean
  996.  
  997.             'HttpContext.Current.Response.Write(Email.AsString())
  998.             'HttpContext.Current.Response.End()
  999.  
  1000.             Return True
  1001.         End Function
  1002.  
  1003.         ' Class terminate
  1004.         Public Sub Dispose() Implements IDisposable.Dispose
  1005.             If m_schSchID IsNot Nothing Then m_schSchID.Dispose()
  1006.             If m_schDate IsNot Nothing Then m_schDate.Dispose()
  1007.             If m_schEvtID IsNot Nothing Then m_schEvtID.Dispose()
  1008.             If m_schPartsID IsNot Nothing Then m_schPartsID.Dispose()
  1009.             If m_schCallTime IsNot Nothing Then m_schCallTime.Dispose()
  1010.             If m_schStartTime IsNot Nothing Then m_schStartTime.Dispose()
  1011.             If m_schEndTime IsNot Nothing Then m_schEndTime.Dispose()
  1012.             If m_schOutTime IsNot Nothing Then m_schOutTime.Dispose()
  1013.             If m_schLocID IsNot Nothing Then m_schLocID.Dispose()
  1014.             If m_schEmpID IsNot Nothing Then m_schEmpID.Dispose()
  1015.             If m_schPosID IsNot Nothing Then m_schPosID.Dispose()
  1016.             If m_schTypID IsNot Nothing Then m_schTypID.Dispose()
  1017.             If m_schDepID IsNot Nothing Then m_schDepID.Dispose()
  1018.             If m_schNotes IsNot Nothing Then m_schNotes.Dispose()
  1019.         End Sub
  1020.     End Class
  1021. End Class
  1022.