home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblScheduleupdate.aspx.vb < prev    next >
Text File  |  2014-11-26  |  71KB  |  1,683 lines

  1. Imports System.Data
  2. Imports System.Data.Common
  3. Imports System.Xml
  4. Imports System.IO
  5. Imports System.Data.OleDb
  6.  
  7. '
  8. ' ASP.NET code-behind class (Page)
  9. '
  10.  
  11. Partial Class tblScheduleupdate
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblSchedule_update As ctblSchedule_update
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblSchedule_update
  21.         Inherits AspNetMakerPage
  22.         Implements IDisposable        
  23.  
  24.         ' Used by system generated functions
  25.         Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
  26.  
  27.         Private arwrk As Object
  28.  
  29.         Private armultiwrk() As String        
  30.  
  31.         ' Page URL
  32.         Public ReadOnly Property PageUrl() As String
  33.             Get
  34.                 Dim Url As String = ew_CurrentPage() & "?"
  35.                 If tblSchedule.UseTokenInUrl Then Url = Url & "t=" & tblSchedule.TableVar & "&" ' Add page token
  36.                 Return Url    
  37.             End Get
  38.         End Property
  39.  
  40.         ' Validate page request
  41.         Public Function IsPageRequest() As Boolean
  42.             Dim Result As Boolean
  43.             If tblSchedule.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (tblSchedule.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (tblSchedule.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' tblSchedule
  57.         Public Property tblSchedule() As ctblSchedule
  58.             Get                
  59.                 Return ParentPage.tblSchedule
  60.             End Get
  61.             Set(ByVal v As ctblSchedule)
  62.                 ParentPage.tblSchedule = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' tblSchedule
  67.         Public Property tblEmployees() As ctblEmployees
  68.             Get                
  69.                 Return ParentPage.tblEmployees
  70.             End Get
  71.             Set(ByVal v As ctblEmployees)
  72.                 ParentPage.tblEmployees = v    
  73.             End Set    
  74.         End Property
  75.  
  76.         '
  77.         '  Constructor
  78.         '  - init objects
  79.         '  - open connection
  80.         '
  81.         Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)                
  82.             m_ParentPage = APage
  83.             m_Page = Me    
  84.             m_PageID = "update"
  85.             m_PageObjName = "tblSchedule_update"
  86.             m_PageObjTypeName = "ctblSchedule_update"
  87.  
  88.             ' Table Name
  89.             m_TableName = "tblSchedule"
  90.  
  91.             ' Initialize table object
  92.             tblSchedule = New ctblSchedule(Me)
  93.             tblEmployees = New ctblEmployees(Me)
  94.  
  95.             ' Connect to database
  96.             Conn = New cConnection()
  97.         End Sub
  98.  
  99.         '
  100.         '  Subroutine Page_Init
  101.         '  - called before page main
  102.         '  - check Security
  103.         '  - set up response header
  104.         '  - call page load events
  105.         '
  106.         Public Sub Page_Init()
  107.             Security = New cAdvancedSecurity(Me)
  108.             If Not Security.IsLoggedIn() Then Security.AutoLogin()
  109.             If Not Security.IsLoggedIn() Then
  110.                 Security.SaveLastUrl()
  111.                 Page_Terminate("login.aspx")
  112.             End If
  113.  
  114.             ' Table Permission loading event
  115.             Security.TablePermission_Loading()
  116.             Security.LoadCurrentUserLevel(TableName)
  117.  
  118.             ' Table Permission loaded event
  119.             Security.TablePermission_Loaded()
  120.             If Not Security.CanEdit Then
  121.                 Security.SaveLastUrl()
  122.                 Page_Terminate("tblSchedulelist.aspx")
  123.             End If
  124.  
  125.             ' User ID loading event
  126.             Security.UserID_Loading()
  127.             If Security.IsLoggedIn() Then Call Security.LoadUserID()
  128.  
  129.             ' User ID loaded event
  130.             Security.UserID_Loaded()
  131.             If Security.IsLoggedIn() And ew_Empty(Security.CurrentUserID) Then
  132.                 Message = "You do not have the right permission to view the page"
  133.                 Page_Terminate("tblSchedulelist.aspx")
  134.             End If
  135.  
  136.             ' Global page loading event (in ewglobal*.vb)
  137.             ParentPage.Page_Loading()
  138.  
  139.             ' Page load event, used in current page
  140.             Page_Load()
  141.         End Sub
  142.  
  143.         '
  144.         '  Class terminate
  145.         '  - clean up page object
  146.         '
  147.         Public Sub Dispose() Implements IDisposable.Dispose
  148.             Page_Terminate("")
  149.         End Sub
  150.  
  151.         '
  152.         '  Sub Page_Terminate
  153.         '  - called when exit page
  154.         '  - clean up connection and objects
  155.         '  - if URL specified, redirect to URL
  156.         '
  157.         Sub Page_Terminate(url As String)
  158.  
  159.             ' Page unload event, used in current page
  160.             Page_Unload()
  161.  
  162.             ' Global page unloaded event (in ewglobal*.vb)
  163.             ParentPage.Page_Unloaded()
  164.  
  165.             ' Close connection
  166.             Conn.Dispose()
  167.             Security = Nothing
  168.             tblSchedule.Dispose()
  169.             tblEmployees.Dispose()
  170.  
  171.             ' Go to URL if specified
  172.             If url <> "" Then
  173.                 HttpContext.Current.Response.Clear()
  174.                 HttpContext.Current.Response.Redirect(url)
  175.             End If
  176.         End Sub
  177.  
  178.     Public arRecKeys() As String
  179.  
  180.     Public sDisabled As String
  181.  
  182.     Public lTotalRecs As Integer
  183.  
  184.     '
  185.     ' Page main processing
  186.     '
  187.     Sub Page_Main()
  188.         Dim sKeyName As String
  189.         Dim sKey As String
  190.         Dim nKeySelected As Integer = 0
  191.         Dim bUpdateSelected
  192.  
  193.         ' Try to load keys from list form
  194.         If HttpContext.Current.Request.RequestType = "POST" Then
  195.             If ew_Post("key_m") <> "" Then ' Key count > 0
  196.                 arRecKeys = HttpContext.Current.Request.Form.GetValues("key_m")
  197.                 nKeySelected = arRecKeys.Length
  198.                 LoadMultiUpdateValues() ' Load initial values to form
  199.             End If
  200.         End If
  201.  
  202.         ' Try to load key from update form
  203.         If nKeySelected = 0 Then
  204.             Array.Resize(arRecKeys, 1)
  205.  
  206.             ' Create form object
  207.             ObjForm = New cFormObj
  208.             If ObjForm.GetValue("a_update") <> "" Then
  209.  
  210.                 ' Get action
  211.                 tblSchedule.CurrentAction = ObjForm.GetValue("a_update")
  212.  
  213.                 ' Get record keys
  214.                 sKeyName = "k" & Convert.ToString(nKeySelected+1) & "_key"
  215.                 sKey = ObjForm.GetValue(sKeyName)
  216.                 Do While sKey <> ""
  217.                     If nKeySelected > 0 Then                        
  218.                         Array.Resize(arRecKeys, nKeySelected + 1)
  219.                     End If
  220.                     arRecKeys(nKeySelected) = sKey
  221.                     nKeySelected = nKeySelected + 1
  222.                     sKeyName = "k" & Convert.ToString(nKeySelected+1) & "_key"
  223.                     sKey = ObjForm.GetValue(sKeyName)
  224.                 Loop
  225.                 LoadFormValues() ' Get form values
  226.  
  227.                 ' Validate Form
  228.                 If Not ValidateForm() Then
  229.                     tblSchedule.CurrentAction = "I" ' Form error, reset action
  230.                     Message = ParentPage.gsFormError
  231.                 End If
  232.             End If
  233.         End If
  234.         If nKeySelected <= 0 Then Page_Terminate("tblSchedulelist.aspx") ' No records selected, return to list
  235.         Select Case tblSchedule.CurrentAction
  236.             Case "U" ' Update
  237.                 If UpdateRows() Then ' Update Records based on key
  238.                     Message = "Update succeeded" ' Set update success message
  239.                 Page_Terminate(tblSchedule.ReturnUrl) ' Return to caller
  240.                 Else
  241.                     RestoreFormValues() ' Restore form values
  242.                 End If
  243.         End Select
  244.  
  245.         ' Render row
  246.         tblSchedule.RowType = EW_ROWTYPE_EDIT ' Render edit
  247.  
  248.         ' Render row
  249.         RenderRow()
  250.     End Sub
  251.  
  252.     ' 
  253.     ' Load initial values to form if field values are identical in all selected records
  254.     '
  255.     Sub LoadMultiUpdateValues()        
  256.         Dim i As Integer = 1
  257.         Try
  258.             tblSchedule.CurrentFilter = BuildKeyFilter()
  259.  
  260.             ' Load recordset
  261.             Dim Rs As OleDbDataReader = LoadRecordset()
  262.             Do While Rs.Read()
  263.                 If i = 1 Then
  264.                     tblSchedule.schDate.DbValue = Rs("schDate")
  265.                     tblSchedule.schEvtID.DbValue = Rs("schEvtID")
  266.                     tblSchedule.schPartsID.DbValue = Rs("schPartsID")
  267.                     tblSchedule.schCallTime.DbValue = Rs("schCallTime")
  268.                     tblSchedule.schStartTime.DbValue = Rs("schStartTime")
  269.                     tblSchedule.schEndTime.DbValue = Rs("schEndTime")
  270.                     tblSchedule.schOutTime.DbValue = Rs("schOutTime")
  271.                     tblSchedule.schLocID.DbValue = Rs("schLocID")
  272.                     tblSchedule.schEmpID.DbValue = Rs("schEmpID")
  273.                     tblSchedule.schPosID.DbValue = Rs("schPosID")
  274.                     tblSchedule.schTypID.DbValue = Rs("schTypID")
  275.                     tblSchedule.schDepID.DbValue = Rs("schDepID")
  276.                     tblSchedule.schNotes.DbValue = Rs("schNotes")
  277.                     tblSchedule.schRate.DbValue = Rs("schRate")
  278.                     tblSchedule.schActualStart.DbValue = Rs("schActualStart")
  279.                     tblSchedule.schActualEnd.DbValue = Rs("schActualEnd")
  280.                     tblSchedule.schDateCreated.DbValue = Rs("schDateCreated")
  281.                     tblSchedule.schDoubleBooked.DbValue = Rs("schDoubleBooked")
  282.                         tblSchedule.schStatus.DbValue = Rs("schStatus")
  283.                         tblSchedule.schDayOfWeek.DbValue = Rs("schDayOfWeek")
  284.                     Else
  285.                         If Not ew_CompareValue(tblSchedule.schDate.DbValue, Rs("schDate")) Then
  286.                             tblSchedule.schDate.CurrentValue = System.DBNull.Value
  287.                         End If
  288.                         If Not ew_CompareValue(tblSchedule.schEvtID.DbValue, Rs("schEvtID")) Then
  289.                             tblSchedule.schEvtID.CurrentValue = System.DBNull.Value
  290.                         End If
  291.                         If Not ew_CompareValue(tblSchedule.schPartsID.DbValue, Rs("schPartsID")) Then
  292.                             tblSchedule.schPartsID.CurrentValue = System.DBNull.Value
  293.                         End If
  294.                         If Not ew_CompareValue(tblSchedule.schCallTime.DbValue, Rs("schCallTime")) Then
  295.                             tblSchedule.schCallTime.CurrentValue = System.DBNull.Value
  296.                         End If
  297.                         If Not ew_CompareValue(tblSchedule.schStartTime.DbValue, Rs("schStartTime")) Then
  298.                             tblSchedule.schStartTime.CurrentValue = System.DBNull.Value
  299.                         End If
  300.                         If Not ew_CompareValue(tblSchedule.schEndTime.DbValue, Rs("schEndTime")) Then
  301.                             tblSchedule.schEndTime.CurrentValue = System.DBNull.Value
  302.                         End If
  303.                         If Not ew_CompareValue(tblSchedule.schOutTime.DbValue, Rs("schOutTime")) Then
  304.                             tblSchedule.schOutTime.CurrentValue = System.DBNull.Value
  305.                         End If
  306.                         If Not ew_CompareValue(tblSchedule.schLocID.DbValue, Rs("schLocID")) Then
  307.                             tblSchedule.schLocID.CurrentValue = System.DBNull.Value
  308.                         End If
  309.                         If Not ew_CompareValue(tblSchedule.schEmpID.DbValue, Rs("schEmpID")) Then
  310.                             tblSchedule.schEmpID.CurrentValue = System.DBNull.Value
  311.                         End If
  312.                         If Not ew_CompareValue(tblSchedule.schPosID.DbValue, Rs("schPosID")) Then
  313.                             tblSchedule.schPosID.CurrentValue = System.DBNull.Value
  314.                         End If
  315.                         If Not ew_CompareValue(tblSchedule.schTypID.DbValue, Rs("schTypID")) Then
  316.                             tblSchedule.schTypID.CurrentValue = System.DBNull.Value
  317.                         End If
  318.                         If Not ew_CompareValue(tblSchedule.schDepID.DbValue, Rs("schDepID")) Then
  319.                             tblSchedule.schDepID.CurrentValue = System.DBNull.Value
  320.                         End If
  321.                         If Not ew_CompareValue(tblSchedule.schNotes.DbValue, Rs("schNotes")) Then
  322.                             tblSchedule.schNotes.CurrentValue = System.DBNull.Value
  323.                         End If
  324.                         If Not ew_CompareValue(tblSchedule.schRate.DbValue, Rs("schRate")) Then
  325.                             tblSchedule.schRate.CurrentValue = System.DBNull.Value
  326.                         End If
  327.                         If Not ew_CompareValue(tblSchedule.schActualStart.DbValue, Rs("schActualStart")) Then
  328.                             tblSchedule.schActualStart.CurrentValue = System.DBNull.Value
  329.                         End If
  330.                         If Not ew_CompareValue(tblSchedule.schActualEnd.DbValue, Rs("schActualEnd")) Then
  331.                             tblSchedule.schActualEnd.CurrentValue = System.DBNull.Value
  332.                         End If
  333.                         If Not ew_CompareValue(tblSchedule.schDateCreated.DbValue, Rs("schDateCreated")) Then
  334.                             tblSchedule.schDateCreated.CurrentValue = System.DBNull.Value
  335.                         End If
  336.                         If Not ew_CompareValue(tblSchedule.schDoubleBooked.DbValue, Rs("schDoubleBooked")) Then
  337.                             tblSchedule.schDoubleBooked.CurrentValue = System.DBNull.Value
  338.                         End If
  339.                         If Not ew_CompareValue(tblSchedule.schStatus.DbValue, Rs("schStatus")) Then
  340.                             tblSchedule.schStatus.CurrentValue = System.DBNull.Value
  341.                         End If
  342.                         If Not ew_CompareValue(tblSchedule.schDayOfWeek.DbValue, Rs("schDayOfWeek")) Then
  343.                             tblSchedule.schDayOfWeek.CurrentValue = System.DBNull.Value
  344.                         End If
  345.                     End If
  346.                 i = i + 1
  347.             Loop
  348.             Rs.Close()
  349.             Rs.Dispose()
  350.         Catch
  351.             If EW_DEBUG_ENABLED Then Throw
  352.         End Try
  353.     End Sub
  354.  
  355.     '
  356.     '  Build filter for all keys
  357.     '
  358.     Function BuildKeyFilter()
  359.         Dim sKey As String
  360.         Dim sWrkFilter As String = "", sFilter As String
  361.         For i As Integer = 0 to arRecKeys.GetUpperBound(0)
  362.             sKey = arRecKeys(i).Trim()
  363.             If SetupKeyValues(sKey) Then
  364.                 sFilter = tblSchedule.KeyFilter
  365.                 If sWrkFilter <> "" Then sWrkFilter = sWrkFilter & " OR "
  366.                 sWrkFilter = sWrkFilter & sFilter
  367.             Else
  368.                 sWrkFilter = "0=1"
  369.                 Exit For
  370.             End If
  371.         Next
  372.         BuildKeyFilter = sWrkFilter
  373.     End Function
  374.  
  375.     '
  376.     '  Set up key value
  377.     '
  378.     Function SetupKeyValues(key As String) As Boolean
  379.         Dim sKeyFld As String, arKeyFlds() As String
  380.         Dim sWrkFilter As String, sFilter As String
  381.         sKeyFld = key
  382.         If Not IsNumeric(sKeyFld) Then Return False
  383.         tblSchedule.schSchID.CurrentValue = sKeyFld ' Set up key value
  384.         Return True
  385.     End Function
  386.  
  387.     '
  388.     ' Update all selected rows
  389.     '
  390.     Function UpdateRows() As Boolean
  391.         Dim sKey As String = "", sThisKey As String, sSql As String
  392.         Dim RsOld As ArrayList, RsNew As ArrayList
  393.         Conn.BeginTrans() ' Begin transaction
  394.  
  395.         ' Get old recordset
  396.         tblSchedule.CurrentFilter = BuildKeyFilter()
  397.         sSql = tblSchedule.SQL
  398.         RsOld = Conn.GetRows(sSql)
  399.  
  400.         ' Update all rows
  401.         For i As Integer = 0 to arRecKeys.GetUpperBound(0)
  402.             sThisKey = arRecKeys(i).Trim()
  403.             If SetupKeyValues(sThisKey) Then
  404.                 tblSchedule.SendEmail = False ' Do not send email on update success
  405.                 UpdateRows = EditRow() ' Update this row
  406.             Else
  407.                 UpdateRows = False
  408.             End If
  409.             If Not UpdateRows Then Exit For ' Update failed
  410.             If sKey <> "" Then sKey = sKey & ", "
  411.             sKey = sKey & sThisKey
  412.         Next
  413.         If UpdateRows Then
  414.             Conn.CommitTrans() ' Commit transaction
  415.  
  416.             ' Get new recordset
  417.             RsNew = Conn.GetRows(sSql)
  418.         Else
  419.             Conn.RollbackTrans() ' Rollback transaction            
  420.         End If
  421.     End Function
  422.  
  423.     '
  424.     ' Get upload file
  425.     '
  426.     Sub GetUploadFiles()
  427.  
  428.         ' Get upload data
  429.     End Sub
  430.  
  431.     '
  432.     ' Load default values
  433.     '
  434.     Sub LoadDefaultValues()
  435.     End Sub
  436.  
  437.     '
  438.     ' Load form values
  439.     '
  440.     Sub LoadFormValues()
  441.         tblSchedule.schDate.FormValue = ObjForm.GetValue("x_schDate")
  442.         tblSchedule.schDate.CurrentValue = ew_UnFormatDateTime(tblSchedule.schDate.CurrentValue, 6)
  443.         tblSchedule.schDate.MultiUpdate = ObjForm.GetValue("u_schDate")
  444.         tblSchedule.schDate.OldValue = ObjForm.GetValue("o_schDate")
  445.         tblSchedule.schEvtID.FormValue = ObjForm.GetValue("x_schEvtID")
  446.         tblSchedule.schEvtID.MultiUpdate = ObjForm.GetValue("u_schEvtID")
  447.         tblSchedule.schEvtID.OldValue = ObjForm.GetValue("o_schEvtID")
  448.         tblSchedule.schPartsID.FormValue = ObjForm.GetValue("x_schPartsID")
  449.         tblSchedule.schPartsID.MultiUpdate = ObjForm.GetValue("u_schPartsID")
  450.         tblSchedule.schPartsID.OldValue = ObjForm.GetValue("o_schPartsID")
  451.         tblSchedule.schCallTime.FormValue = ObjForm.GetValue("x_schCallTime")
  452.         tblSchedule.schCallTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schCallTime.CurrentValue, 3)
  453.         tblSchedule.schCallTime.MultiUpdate = ObjForm.GetValue("u_schCallTime")
  454.         tblSchedule.schCallTime.OldValue = ObjForm.GetValue("o_schCallTime")
  455.         tblSchedule.schStartTime.FormValue = ObjForm.GetValue("x_schStartTime")
  456.         tblSchedule.schStartTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schStartTime.CurrentValue, 3)
  457.         tblSchedule.schStartTime.MultiUpdate = ObjForm.GetValue("u_schStartTime")
  458.         tblSchedule.schStartTime.OldValue = ObjForm.GetValue("o_schStartTime")
  459.         tblSchedule.schEndTime.FormValue = ObjForm.GetValue("x_schEndTime")
  460.         tblSchedule.schEndTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schEndTime.CurrentValue, 3)
  461.         tblSchedule.schEndTime.MultiUpdate = ObjForm.GetValue("u_schEndTime")
  462.         tblSchedule.schEndTime.OldValue = ObjForm.GetValue("o_schEndTime")
  463.         tblSchedule.schOutTime.FormValue = ObjForm.GetValue("x_schOutTime")
  464.         tblSchedule.schOutTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schOutTime.CurrentValue, 3)
  465.         tblSchedule.schOutTime.MultiUpdate = ObjForm.GetValue("u_schOutTime")
  466.         tblSchedule.schOutTime.OldValue = ObjForm.GetValue("o_schOutTime")
  467.         tblSchedule.schLocID.FormValue = ObjForm.GetValue("x_schLocID")
  468.         tblSchedule.schLocID.MultiUpdate = ObjForm.GetValue("u_schLocID")
  469.         tblSchedule.schLocID.OldValue = ObjForm.GetValue("o_schLocID")
  470.         tblSchedule.schEmpID.FormValue = ObjForm.GetValue("x_schEmpID")
  471.         tblSchedule.schEmpID.MultiUpdate = ObjForm.GetValue("u_schEmpID")
  472.         tblSchedule.schEmpID.OldValue = ObjForm.GetValue("o_schEmpID")
  473.         tblSchedule.schPosID.FormValue = ObjForm.GetValue("x_schPosID")
  474.         tblSchedule.schPosID.MultiUpdate = ObjForm.GetValue("u_schPosID")
  475.         tblSchedule.schPosID.OldValue = ObjForm.GetValue("o_schPosID")
  476.         tblSchedule.schTypID.FormValue = ObjForm.GetValue("x_schTypID")
  477.         tblSchedule.schTypID.MultiUpdate = ObjForm.GetValue("u_schTypID")
  478.         tblSchedule.schTypID.OldValue = ObjForm.GetValue("o_schTypID")
  479.         tblSchedule.schDepID.FormValue = ObjForm.GetValue("x_schDepID")
  480.         tblSchedule.schDepID.MultiUpdate = ObjForm.GetValue("u_schDepID")
  481.         tblSchedule.schDepID.OldValue = ObjForm.GetValue("o_schDepID")
  482.         tblSchedule.schNotes.FormValue = ObjForm.GetValue("x_schNotes")
  483.         tblSchedule.schNotes.MultiUpdate = ObjForm.GetValue("u_schNotes")
  484.         tblSchedule.schNotes.OldValue = ObjForm.GetValue("o_schNotes")
  485.         tblSchedule.schRate.FormValue = ObjForm.GetValue("x_schRate")
  486.         tblSchedule.schRate.MultiUpdate = ObjForm.GetValue("u_schRate")
  487.         tblSchedule.schRate.OldValue = ObjForm.GetValue("o_schRate")
  488.         tblSchedule.schActualStart.FormValue = ObjForm.GetValue("x_schActualStart")
  489.         tblSchedule.schActualStart.CurrentValue = ew_UnFormatDateTime(tblSchedule.schActualStart.CurrentValue, 3)
  490.         tblSchedule.schActualStart.MultiUpdate = ObjForm.GetValue("u_schActualStart")
  491.         tblSchedule.schActualStart.OldValue = ObjForm.GetValue("o_schActualStart")
  492.         tblSchedule.schActualEnd.FormValue = ObjForm.GetValue("x_schActualEnd")
  493.         tblSchedule.schActualEnd.CurrentValue = ew_UnFormatDateTime(tblSchedule.schActualEnd.CurrentValue, 3)
  494.         tblSchedule.schActualEnd.MultiUpdate = ObjForm.GetValue("u_schActualEnd")
  495.         tblSchedule.schActualEnd.OldValue = ObjForm.GetValue("o_schActualEnd")
  496.         tblSchedule.schDateCreated.FormValue = ObjForm.GetValue("x_schDateCreated")
  497.             tblSchedule.schDateCreated.CurrentValue = ew_UnFormatDateTime(tblSchedule.schDateCreated.CurrentValue, 4)
  498.         tblSchedule.schDateCreated.MultiUpdate = ObjForm.GetValue("u_schDateCreated")
  499.         tblSchedule.schDateCreated.OldValue = ObjForm.GetValue("o_schDateCreated")
  500.         tblSchedule.schDoubleBooked.FormValue = ObjForm.GetValue("x_schDoubleBooked")
  501.         tblSchedule.schDoubleBooked.MultiUpdate = ObjForm.GetValue("u_schDoubleBooked")
  502.         tblSchedule.schDoubleBooked.OldValue = ObjForm.GetValue("o_schDoubleBooked")
  503.             tblSchedule.schStatus.FormValue = ObjForm.GetValue("x_schStatus")
  504.             tblSchedule.schStatus.MultiUpdate = ObjForm.GetValue("u_schStatus")
  505.             tblSchedule.schStatus.OldValue = ObjForm.GetValue("o_schStatus")
  506.             tblSchedule.schDayOfWeek.FormValue = ObjForm.GetValue("x_schDayOfWeek")
  507.             tblSchedule.schDayOfWeek.MultiUpdate = ObjForm.GetValue("u_schDayOfWeek")
  508.             tblSchedule.schDayOfWeek.OldValue = ObjForm.GetValue("o_schDayOfWeek")
  509.             tblSchedule.schSchID.FormValue = ObjForm.GetValue("x_schSchID")
  510.     End Sub
  511.  
  512.     '
  513.     ' Restore form values
  514.     '
  515.     Sub RestoreFormValues()
  516.         tblSchedule.schDate.CurrentValue = tblSchedule.schDate.FormValue
  517.         tblSchedule.schDate.CurrentValue = ew_UnFormatDateTime(tblSchedule.schDate.CurrentValue, 6)
  518.         tblSchedule.schEvtID.CurrentValue = tblSchedule.schEvtID.FormValue
  519.         tblSchedule.schPartsID.CurrentValue = tblSchedule.schPartsID.FormValue
  520.         tblSchedule.schCallTime.CurrentValue = tblSchedule.schCallTime.FormValue
  521.         tblSchedule.schCallTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schCallTime.CurrentValue, 3)
  522.         tblSchedule.schStartTime.CurrentValue = tblSchedule.schStartTime.FormValue
  523.         tblSchedule.schStartTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schStartTime.CurrentValue, 3)
  524.         tblSchedule.schEndTime.CurrentValue = tblSchedule.schEndTime.FormValue
  525.         tblSchedule.schEndTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schEndTime.CurrentValue, 3)
  526.         tblSchedule.schOutTime.CurrentValue = tblSchedule.schOutTime.FormValue
  527.         tblSchedule.schOutTime.CurrentValue = ew_UnFormatDateTime(tblSchedule.schOutTime.CurrentValue, 3)
  528.         tblSchedule.schLocID.CurrentValue = tblSchedule.schLocID.FormValue
  529.         tblSchedule.schEmpID.CurrentValue = tblSchedule.schEmpID.FormValue
  530.         tblSchedule.schPosID.CurrentValue = tblSchedule.schPosID.FormValue
  531.         tblSchedule.schTypID.CurrentValue = tblSchedule.schTypID.FormValue
  532.         tblSchedule.schDepID.CurrentValue = tblSchedule.schDepID.FormValue
  533.         tblSchedule.schNotes.CurrentValue = tblSchedule.schNotes.FormValue
  534.         tblSchedule.schRate.CurrentValue = tblSchedule.schRate.FormValue
  535.         tblSchedule.schActualStart.CurrentValue = tblSchedule.schActualStart.FormValue
  536.         tblSchedule.schActualStart.CurrentValue = ew_UnFormatDateTime(tblSchedule.schActualStart.CurrentValue, 3)
  537.         tblSchedule.schActualEnd.CurrentValue = tblSchedule.schActualEnd.FormValue
  538.         tblSchedule.schActualEnd.CurrentValue = ew_UnFormatDateTime(tblSchedule.schActualEnd.CurrentValue, 3)
  539.         tblSchedule.schDateCreated.CurrentValue = tblSchedule.schDateCreated.FormValue
  540.             tblSchedule.schDateCreated.CurrentValue = ew_UnFormatDateTime(tblSchedule.schDateCreated.CurrentValue, 4)
  541.         tblSchedule.schDoubleBooked.CurrentValue = tblSchedule.schDoubleBooked.FormValue
  542.             tblSchedule.schStatus.CurrentValue = tblSchedule.schStatus.FormValue
  543.             tblSchedule.schDayOfWeek.CurrentValue = tblSchedule.schDayOfWeek.FormValue
  544.             tblSchedule.schSchID.CurrentValue = tblSchedule.schSchID.FormValue
  545.     End Sub
  546.  
  547.     '
  548.     ' Load recordset
  549.     '
  550.     Function LoadRecordset() As OleDbDataReader
  551.  
  552.         ' Recordset Selecting event
  553.         tblSchedule.Recordset_Selecting(tblSchedule.CurrentFilter)
  554.  
  555.         ' Load list page SQL
  556.         Dim sSql As String = tblSchedule.ListSQL
  557.  
  558.         ' Write SQL for debug
  559.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  560.  
  561.         ' Count
  562.         lTotalRecs = -1        
  563.         Try            
  564.             If sSql.StartsWith("SELECT * FROM ", StringComparison.InvariantCultureIgnoreCase) AndAlso _                
  565.                 ew_Empty(tblSchedule.SqlGroupBy) AndAlso _
  566.                 ew_Empty(tblSchedule.SqlHaving) Then
  567.                 Dim sCntSql As String = tblSchedule.SelectCountSQL
  568.  
  569.                 ' Write SQL for debug
  570.                 If EW_DEBUG_ENABLED Then ew_Write("<br>" & sCntSql)
  571.                 lTotalRecs = Conn.ExecuteScalar(sCntSql)
  572.             End If            
  573.         Catch
  574.         End Try
  575.  
  576.         ' Load recordset
  577.         Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  578.         If lTotalRecs < 0 AndAlso Rs.HasRows Then
  579.             lTotalRecs = 0
  580.             While Rs.Read()
  581.                 lTotalRecs = lTotalRecs + 1
  582.             End While
  583.             Rs.Close()        
  584.             Rs = Conn.GetDataReader(sSql)
  585.         End If
  586.  
  587.         ' Recordset Selected event
  588.         tblSchedule.Recordset_Selected(Rs)
  589.         Return Rs
  590.     End Function
  591.  
  592.     '
  593.     ' Render row values based on field settings
  594.     '
  595.     Sub RenderRow()
  596.  
  597.         ' Row Rendering event
  598.         tblSchedule.Row_Rendering()
  599.  
  600.         '
  601.         '  Common render codes for all row types
  602.         '
  603.         ' schDate
  604.  
  605.         tblSchedule.schDate.CellCssStyle = ""
  606.         tblSchedule.schDate.CellCssClass = ""
  607.  
  608.         ' schEvtID
  609.         tblSchedule.schEvtID.CellCssStyle = ""
  610.         tblSchedule.schEvtID.CellCssClass = ""
  611.  
  612.         ' schPartsID
  613.         tblSchedule.schPartsID.CellCssStyle = ""
  614.         tblSchedule.schPartsID.CellCssClass = ""
  615.  
  616.         ' schCallTime
  617.         tblSchedule.schCallTime.CellCssStyle = ""
  618.         tblSchedule.schCallTime.CellCssClass = ""
  619.  
  620.         ' schStartTime
  621.         tblSchedule.schStartTime.CellCssStyle = ""
  622.         tblSchedule.schStartTime.CellCssClass = ""
  623.  
  624.         ' schEndTime
  625.         tblSchedule.schEndTime.CellCssStyle = ""
  626.         tblSchedule.schEndTime.CellCssClass = ""
  627.  
  628.         ' schOutTime
  629.         tblSchedule.schOutTime.CellCssStyle = ""
  630.         tblSchedule.schOutTime.CellCssClass = ""
  631.  
  632.         ' schLocID
  633.         tblSchedule.schLocID.CellCssStyle = ""
  634.         tblSchedule.schLocID.CellCssClass = ""
  635.  
  636.         ' schEmpID
  637.         tblSchedule.schEmpID.CellCssStyle = ""
  638.         tblSchedule.schEmpID.CellCssClass = ""
  639.  
  640.         ' schPosID
  641.         tblSchedule.schPosID.CellCssStyle = ""
  642.         tblSchedule.schPosID.CellCssClass = ""
  643.  
  644.         ' schTypID
  645.         tblSchedule.schTypID.CellCssStyle = ""
  646.         tblSchedule.schTypID.CellCssClass = ""
  647.  
  648.         ' schDepID
  649.         tblSchedule.schDepID.CellCssStyle = ""
  650.         tblSchedule.schDepID.CellCssClass = ""
  651.  
  652.         ' schNotes
  653.         tblSchedule.schNotes.CellCssStyle = ""
  654.         tblSchedule.schNotes.CellCssClass = ""
  655.  
  656.         ' schRate
  657.         tblSchedule.schRate.CellCssStyle = ""
  658.         tblSchedule.schRate.CellCssClass = ""
  659.  
  660.         ' schActualStart
  661.         tblSchedule.schActualStart.CellCssStyle = ""
  662.         tblSchedule.schActualStart.CellCssClass = ""
  663.  
  664.         ' schActualEnd
  665.         tblSchedule.schActualEnd.CellCssStyle = ""
  666.         tblSchedule.schActualEnd.CellCssClass = ""
  667.  
  668.         ' schDateCreated
  669.         tblSchedule.schDateCreated.CellCssStyle = ""
  670.         tblSchedule.schDateCreated.CellCssClass = ""
  671.  
  672.         ' schDoubleBooked
  673.         tblSchedule.schDoubleBooked.CellCssStyle = ""
  674.         tblSchedule.schDoubleBooked.CellCssClass = ""
  675.  
  676.             ' schStatus
  677.             tblSchedule.schStatus.CellCssStyle = ""
  678.             tblSchedule.schStatus.CellCssClass = ""
  679.  
  680.             ' schDayOfWeek
  681.             tblSchedule.schDayOfWeek.CellCssStyle = ""
  682.             tblSchedule.schDayOfWeek.CellCssClass = ""
  683.  
  684.             '
  685.         '  View  Row
  686.         '
  687.  
  688.         If tblSchedule.RowType = EW_ROWTYPE_VIEW Then ' View row
  689.  
  690.             ' schDate
  691.             tblSchedule.schDate.ViewValue = tblSchedule.schDate.CurrentValue
  692.             tblSchedule.schDate.ViewValue = ew_FormatDateTime(tblSchedule.schDate.ViewValue, 6)
  693.             tblSchedule.schDate.CssStyle = ""
  694.             tblSchedule.schDate.CssClass = ""
  695.             tblSchedule.schDate.ViewCustomAttributes = ""
  696.  
  697.             ' schEvtID
  698.             If ew_NotEmpty(tblSchedule.schEvtID.CurrentValue) Then
  699.                     sSqlWrk = "SELECT [evtDescription] FROM [tblEvents] WHERE [evtID] = " & ew_AdjustSql(tblSchedule.schEvtID.CurrentValue) & " AND [evtIsActive]=True"
  700.                 sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  701.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  702.                 If RsWrk.Read() Then
  703.                     tblSchedule.schEvtID.ViewValue = RsWrk("evtDescription")
  704.                 Else
  705.                     tblSchedule.schEvtID.ViewValue = tblSchedule.schEvtID.CurrentValue
  706.                 End If
  707.                 Conn.CloseTempDataReader()
  708.             Else
  709.                 tblSchedule.schEvtID.ViewValue = System.DBNull.Value
  710.             End If
  711.             tblSchedule.schEvtID.CssStyle = ""
  712.             tblSchedule.schEvtID.CssClass = ""
  713.             tblSchedule.schEvtID.ViewCustomAttributes = ""
  714.  
  715.             ' schPartsID
  716.             If ew_NotEmpty(tblSchedule.schPartsID.CurrentValue) Then
  717.                     sSqlWrk = "SELECT [prtDescription] FROM [tblParts] WHERE [prtID] = " & ew_AdjustSql(tblSchedule.schPartsID.CurrentValue) & " AND [prtIsActive]=True"
  718.                 sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  719.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  720.                 If RsWrk.Read() Then
  721.                     tblSchedule.schPartsID.ViewValue = RsWrk("prtDescription")
  722.                 Else
  723.                     tblSchedule.schPartsID.ViewValue = tblSchedule.schPartsID.CurrentValue
  724.                 End If
  725.                 Conn.CloseTempDataReader()
  726.             Else
  727.                 tblSchedule.schPartsID.ViewValue = System.DBNull.Value
  728.             End If
  729.             tblSchedule.schPartsID.CssStyle = ""
  730.             tblSchedule.schPartsID.CssClass = ""
  731.             tblSchedule.schPartsID.ViewCustomAttributes = ""
  732.  
  733.             ' schCallTime
  734.             tblSchedule.schCallTime.ViewValue = tblSchedule.schCallTime.CurrentValue
  735.                 tblSchedule.schCallTime.ViewValue = ew_FormatDateTime(tblSchedule.schCallTime.ViewValue, 14)
  736.             tblSchedule.schCallTime.CssStyle = ""
  737.             tblSchedule.schCallTime.CssClass = ""
  738.             tblSchedule.schCallTime.ViewCustomAttributes = ""
  739.  
  740.             ' schStartTime
  741.             tblSchedule.schStartTime.ViewValue = tblSchedule.schStartTime.CurrentValue
  742.                 tblSchedule.schStartTime.ViewValue = ew_FormatDateTime(tblSchedule.schStartTime.ViewValue, 14)
  743.             tblSchedule.schStartTime.CssStyle = ""
  744.             tblSchedule.schStartTime.CssClass = ""
  745.             tblSchedule.schStartTime.ViewCustomAttributes = ""
  746.  
  747.             ' schEndTime
  748.             tblSchedule.schEndTime.ViewValue = tblSchedule.schEndTime.CurrentValue
  749.                 tblSchedule.schEndTime.ViewValue = ew_FormatDateTime(tblSchedule.schEndTime.ViewValue, 14)
  750.             tblSchedule.schEndTime.CssStyle = ""
  751.             tblSchedule.schEndTime.CssClass = ""
  752.             tblSchedule.schEndTime.ViewCustomAttributes = ""
  753.  
  754.             ' schOutTime
  755.             tblSchedule.schOutTime.ViewValue = tblSchedule.schOutTime.CurrentValue
  756.                 tblSchedule.schOutTime.ViewValue = ew_FormatDateTime(tblSchedule.schOutTime.ViewValue, 14)
  757.             tblSchedule.schOutTime.CssStyle = ""
  758.             tblSchedule.schOutTime.CssClass = ""
  759.             tblSchedule.schOutTime.ViewCustomAttributes = ""
  760.  
  761.             ' schLocID
  762.             If ew_NotEmpty(tblSchedule.schLocID.CurrentValue) Then
  763.                     sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(tblSchedule.schLocID.CurrentValue) & " AND [locIsActive]=True"
  764.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  765.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  766.                 If RsWrk.Read() Then
  767.                     tblSchedule.schLocID.ViewValue = RsWrk("locDescription")
  768.                 Else
  769.                     tblSchedule.schLocID.ViewValue = tblSchedule.schLocID.CurrentValue
  770.                 End If
  771.                 Conn.CloseTempDataReader()
  772.             Else
  773.                 tblSchedule.schLocID.ViewValue = System.DBNull.Value
  774.             End If
  775.             tblSchedule.schLocID.CssStyle = ""
  776.             tblSchedule.schLocID.CssClass = ""
  777.             tblSchedule.schLocID.ViewCustomAttributes = ""
  778.  
  779.             ' schEmpID
  780.             If ew_NotEmpty(tblSchedule.schEmpID.CurrentValue) Then
  781.                     sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(tblSchedule.schEmpID.CurrentValue) & " AND [empIsActive]=True"
  782.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  783.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  784.                 If RsWrk.Read() Then
  785.                     tblSchedule.schEmpID.ViewValue = RsWrk("empName")
  786.                 Else
  787.                     tblSchedule.schEmpID.ViewValue = tblSchedule.schEmpID.CurrentValue
  788.                 End If
  789.                 Conn.CloseTempDataReader()
  790.             Else
  791.                 tblSchedule.schEmpID.ViewValue = System.DBNull.Value
  792.             End If
  793.             tblSchedule.schEmpID.CssStyle = ""
  794.             tblSchedule.schEmpID.CssClass = ""
  795.             tblSchedule.schEmpID.ViewCustomAttributes = ""
  796.  
  797.             ' schPosID
  798.             If ew_NotEmpty(tblSchedule.schPosID.CurrentValue) Then
  799.                     sSqlWrk = "SELECT [posDescription] FROM [tblPositions] WHERE [posID] = " & ew_AdjustSql(tblSchedule.schPosID.CurrentValue) & " AND [posIsActive]=True"
  800.                 sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  801.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  802.                 If RsWrk.Read() Then
  803.                     tblSchedule.schPosID.ViewValue = RsWrk("posDescription")
  804.                 Else
  805.                     tblSchedule.schPosID.ViewValue = tblSchedule.schPosID.CurrentValue
  806.                 End If
  807.                 Conn.CloseTempDataReader()
  808.             Else
  809.                 tblSchedule.schPosID.ViewValue = System.DBNull.Value
  810.             End If
  811.             tblSchedule.schPosID.CssStyle = ""
  812.             tblSchedule.schPosID.CssClass = ""
  813.             tblSchedule.schPosID.ViewCustomAttributes = ""
  814.  
  815.             ' schTypID
  816.             If ew_NotEmpty(tblSchedule.schTypID.CurrentValue) Then
  817.                     sSqlWrk = "SELECT [typDescription] FROM [tblTypes] WHERE [typID] = " & ew_AdjustSql(tblSchedule.schTypID.CurrentValue) & " AND [typIsActive]=True"
  818.                     sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  819.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  820.                 If RsWrk.Read() Then
  821.                     tblSchedule.schTypID.ViewValue = RsWrk("typDescription")
  822.                 Else
  823.                     tblSchedule.schTypID.ViewValue = tblSchedule.schTypID.CurrentValue
  824.                 End If
  825.                 Conn.CloseTempDataReader()
  826.             Else
  827.                 tblSchedule.schTypID.ViewValue = System.DBNull.Value
  828.             End If
  829.             tblSchedule.schTypID.CssStyle = ""
  830.             tblSchedule.schTypID.CssClass = ""
  831.             tblSchedule.schTypID.ViewCustomAttributes = ""
  832.  
  833.                 ' schDepID
  834.                 If ew_NotEmpty(tblSchedule.schDepID.CurrentValue) Then
  835.                     sSqlWrk = "SELECT [depAcctCode], [depDescription] FROM [tblDepartments] WHERE [depID] = " & ew_AdjustSql(tblSchedule.schDepID.CurrentValue) & " AND [depIsActive]=True"
  836.                     sSqlWrk = sSqlWrk & " ORDER BY [depID] "
  837.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  838.                     If RsWrk.Read() Then
  839.                         tblSchedule.schDepID.ViewValue = RsWrk("depAcctCode")
  840.                         tblSchedule.schDepID.ViewValue = tblSchedule.schDepID.ViewValue & ew_ValueSeparator(0) & RsWrk("depDescription")
  841.                     Else
  842.                         tblSchedule.schDepID.ViewValue = tblSchedule.schDepID.CurrentValue
  843.                     End If
  844.                     Conn.CloseTempDataReader()
  845.                 Else
  846.                     tblSchedule.schDepID.ViewValue = System.DBNull.Value
  847.                 End If
  848.                 tblSchedule.schDepID.CssStyle = ""
  849.                 tblSchedule.schDepID.CssClass = ""
  850.                 tblSchedule.schDepID.ViewCustomAttributes = ""
  851.  
  852.                 '' schDepID
  853.                 'If ew_NotEmpty(tblSchedule.schDepID.CurrentValue) Then
  854.                 '                 sSqlWrk = "SELECT [depDescription] FROM [tblDepartments] WHERE [depID] = " & ew_AdjustSql(tblSchedule.schDepID.CurrentValue) & ""
  855.                 '    sSqlWrk = sSqlWrk & " ORDER BY [depDescription] "
  856.                 '    RsWrk = Conn.GetTempDataReader(sSqlWrk)
  857.                 '    If RsWrk.Read() Then
  858.                 '        tblSchedule.schDepID.ViewValue = RsWrk("depDescription")
  859.                 '    Else
  860.                 '        tblSchedule.schDepID.ViewValue = tblSchedule.schDepID.CurrentValue
  861.                 '    End If
  862.                 '    Conn.CloseTempDataReader()
  863.                 'Else
  864.                 '    tblSchedule.schDepID.ViewValue = System.DBNull.Value
  865.                 'End If
  866.                 'tblSchedule.schDepID.CssStyle = ""
  867.                 'tblSchedule.schDepID.CssClass = ""
  868.                 'tblSchedule.schDepID.ViewCustomAttributes = ""
  869.  
  870.             ' schNotes
  871.             tblSchedule.schNotes.ViewValue = tblSchedule.schNotes.CurrentValue
  872.             tblSchedule.schNotes.CssStyle = ""
  873.             tblSchedule.schNotes.CssClass = ""
  874.             tblSchedule.schNotes.ViewCustomAttributes = ""
  875.  
  876.             ' schRate
  877.             tblSchedule.schRate.ViewValue = tblSchedule.schRate.CurrentValue
  878.             tblSchedule.schRate.CssStyle = ""
  879.             tblSchedule.schRate.CssClass = ""
  880.             tblSchedule.schRate.ViewCustomAttributes = ""
  881.  
  882.             ' schActualStart
  883.             tblSchedule.schActualStart.ViewValue = tblSchedule.schActualStart.CurrentValue
  884.                 tblSchedule.schActualStart.ViewValue = ew_FormatDateTime(tblSchedule.schActualStart.ViewValue, 14)
  885.             tblSchedule.schActualStart.CssStyle = ""
  886.             tblSchedule.schActualStart.CssClass = ""
  887.             tblSchedule.schActualStart.ViewCustomAttributes = ""
  888.  
  889.             ' schActualEnd
  890.             tblSchedule.schActualEnd.ViewValue = tblSchedule.schActualEnd.CurrentValue
  891.                 tblSchedule.schActualEnd.ViewValue = ew_FormatDateTime(tblSchedule.schActualEnd.ViewValue, 14)
  892.             tblSchedule.schActualEnd.CssStyle = ""
  893.             tblSchedule.schActualEnd.CssClass = ""
  894.             tblSchedule.schActualEnd.ViewCustomAttributes = ""
  895.  
  896.             ' schDateCreated
  897.             tblSchedule.schDateCreated.ViewValue = tblSchedule.schDateCreated.CurrentValue
  898.                 tblSchedule.schDateCreated.ViewValue = ew_FormatDateTime(tblSchedule.schDateCreated.ViewValue, 4)
  899.             tblSchedule.schDateCreated.CssStyle = ""
  900.             tblSchedule.schDateCreated.CssClass = ""
  901.             tblSchedule.schDateCreated.ViewCustomAttributes = ""
  902.  
  903.             ' schDoubleBooked
  904.             If Convert.ToString(tblSchedule.schDoubleBooked.CurrentValue) = "1" Then
  905.                 tblSchedule.schDoubleBooked.ViewValue = "Yes"
  906.             Else
  907.                 tblSchedule.schDoubleBooked.ViewValue = "No"
  908.             End If
  909.             tblSchedule.schDoubleBooked.CssStyle = ""
  910.             tblSchedule.schDoubleBooked.CssClass = ""
  911.             tblSchedule.schDoubleBooked.ViewCustomAttributes = ""
  912.  
  913.                 ' schStatus
  914.             If ew_NotEmpty(tblSchedule.schStatus.CurrentValue) Then
  915.                     sSqlWrk = "SELECT [stDescription] FROM [tblScheduleStatus] WHERE [stID] = " & ew_AdjustSql(tblSchedule.schStatus.CurrentValue) & " AND [stIsActive]=True"
  916.                 sSqlWrk = sSqlWrk & " ORDER BY [stDescription] "
  917.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  918.                 If RsWrk.Read() Then
  919.                     tblSchedule.schStatus.ViewValue = RsWrk("stDescription")
  920.                 Else
  921.                     tblSchedule.schStatus.ViewValue = tblSchedule.schStatus.CurrentValue
  922.                 End If
  923.                 Conn.CloseTempDataReader()
  924.             Else
  925.                 tblSchedule.schStatus.ViewValue = System.DBNull.Value
  926.             End If
  927.             tblSchedule.schStatus.CssStyle = ""
  928.             tblSchedule.schStatus.CssClass = ""
  929.             tblSchedule.schStatus.ViewCustomAttributes = ""
  930.  
  931.                 ' schDayOfWeek
  932.                 If ew_NotEmpty(tblSchedule.schDayOfWeek.CurrentValue) Then
  933.                     Select Case tblSchedule.schDayOfWeek.CurrentValue
  934.                         Case "1"
  935.                             tblSchedule.schDayOfWeek.ViewValue = "Sun"
  936.                         Case "2"
  937.                             tblSchedule.schDayOfWeek.ViewValue = "Mon"
  938.                         Case "3"
  939.                             tblSchedule.schDayOfWeek.ViewValue = "Tue"
  940.                         Case "4"
  941.                             tblSchedule.schDayOfWeek.ViewValue = "Wed"
  942.                         Case "5"
  943.                             tblSchedule.schDayOfWeek.ViewValue = "Thu"
  944.                         Case "6"
  945.                             tblSchedule.schDayOfWeek.ViewValue = "Fri"
  946.                         Case "7"
  947.                             tblSchedule.schDayOfWeek.ViewValue = "Sat"
  948.                     End Select
  949.                 Else
  950.                     tblSchedule.schDayOfWeek.ViewValue = System.DBNull.Value
  951.                 End If
  952.                 tblSchedule.schDayOfWeek.CssStyle = ""
  953.                 tblSchedule.schDayOfWeek.CssClass = ""
  954.                 tblSchedule.schDayOfWeek.ViewCustomAttributes = ""
  955.  
  956.                 ' View refer script
  957.             ' schDate
  958.  
  959.             tblSchedule.schDate.HrefValue = ""
  960.  
  961.             ' schEvtID
  962.             tblSchedule.schEvtID.HrefValue = ""
  963.  
  964.             ' schPartsID
  965.             tblSchedule.schPartsID.HrefValue = ""
  966.  
  967.             ' schCallTime
  968.             tblSchedule.schCallTime.HrefValue = ""
  969.  
  970.             ' schStartTime
  971.             tblSchedule.schStartTime.HrefValue = ""
  972.  
  973.             ' schEndTime
  974.             tblSchedule.schEndTime.HrefValue = ""
  975.  
  976.             ' schOutTime
  977.             tblSchedule.schOutTime.HrefValue = ""
  978.  
  979.             ' schLocID
  980.             tblSchedule.schLocID.HrefValue = ""
  981.  
  982.             ' schEmpID
  983.             tblSchedule.schEmpID.HrefValue = ""
  984.  
  985.             ' schPosID
  986.             tblSchedule.schPosID.HrefValue = ""
  987.  
  988.             ' schTypID
  989.             tblSchedule.schTypID.HrefValue = ""
  990.  
  991.             ' schDepID
  992.             tblSchedule.schDepID.HrefValue = ""
  993.  
  994.             ' schNotes
  995.             tblSchedule.schNotes.HrefValue = ""
  996.  
  997.             ' schRate
  998.             tblSchedule.schRate.HrefValue = ""
  999.  
  1000.             ' schActualStart
  1001.             tblSchedule.schActualStart.HrefValue = ""
  1002.  
  1003.             ' schActualEnd
  1004.             tblSchedule.schActualEnd.HrefValue = ""
  1005.  
  1006.             ' schDateCreated
  1007.             tblSchedule.schDateCreated.HrefValue = ""
  1008.  
  1009.             ' schDoubleBooked
  1010.             tblSchedule.schDoubleBooked.HrefValue = ""
  1011.  
  1012.                 ' schStatus
  1013.                 tblSchedule.schStatus.HrefValue = ""
  1014.  
  1015.                 ' schDayOfWeek
  1016.                 tblSchedule.schDayOfWeek.HrefValue = ""
  1017.  
  1018.                 '
  1019.         '  Edit Row
  1020.         '
  1021.  
  1022.         ElseIf tblSchedule.RowType = EW_ROWTYPE_EDIT Then ' Edit row
  1023.  
  1024.             ' schDate
  1025.             tblSchedule.schDate.EditCustomAttributes = ""
  1026.             tblSchedule.schDate.EditValue = ew_FormatDateTime(tblSchedule.schDate.CurrentValue, 6)
  1027.  
  1028.             ' schEvtID
  1029.             tblSchedule.schEvtID.EditCustomAttributes = ""
  1030.             sSqlWrk = "SELECT [evtID], [evtDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblEvents]"
  1031.                 sWhereWrk = "[evtIsActive]=True"
  1032.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1033.             sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  1034.             arwrk = Conn.GetRows(sSqlWrk)
  1035.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1036.             tblSchedule.schEvtID.EditValue = arwrk
  1037.  
  1038.             ' schPartsID
  1039.             tblSchedule.schPartsID.EditCustomAttributes = ""
  1040.             sSqlWrk = "SELECT [prtID], [prtDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblParts]"
  1041.                 sWhereWrk = "[prtIsActive]=True"
  1042.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1043.             sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  1044.             arwrk = Conn.GetRows(sSqlWrk)
  1045.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1046.             tblSchedule.schPartsID.EditValue = arwrk
  1047.  
  1048.             ' schCallTime
  1049.             tblSchedule.schCallTime.EditCustomAttributes = ""
  1050.                 tblSchedule.schCallTime.EditValue = ew_FormatDateTime(tblSchedule.schCallTime.CurrentValue, 4)
  1051.  
  1052.             ' schStartTime
  1053.             tblSchedule.schStartTime.EditCustomAttributes = ""
  1054.                 tblSchedule.schStartTime.EditValue = ew_FormatDateTime(tblSchedule.schStartTime.CurrentValue, 4)
  1055.  
  1056.             ' schEndTime
  1057.             tblSchedule.schEndTime.EditCustomAttributes = ""
  1058.                 tblSchedule.schEndTime.EditValue = ew_FormatDateTime(tblSchedule.schEndTime.CurrentValue, 4)
  1059.  
  1060.             ' schOutTime
  1061.             tblSchedule.schOutTime.EditCustomAttributes = ""
  1062.                 tblSchedule.schOutTime.EditValue = ew_FormatDateTime(tblSchedule.schOutTime.CurrentValue, 4)
  1063.  
  1064.             ' schLocID
  1065.             tblSchedule.schLocID.EditCustomAttributes = ""
  1066.             sSqlWrk = "SELECT [locID], [locDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLocations]"
  1067.                 sWhereWrk = "[locIsActive]=True"
  1068.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1069.             sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  1070.             arwrk = Conn.GetRows(sSqlWrk)
  1071.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1072.             tblSchedule.schLocID.EditValue = arwrk
  1073.  
  1074.             ' schEmpID
  1075.             tblSchedule.schEmpID.EditCustomAttributes = ""
  1076.             If Not Security.IsAdmin And Security.IsLoggedIn() Then ' Non system admin
  1077.                 tblSchedule.schEmpID.CurrentValue = Security.CurrentUserID
  1078.             If ew_NotEmpty(tblSchedule.schEmpID.CurrentValue) Then
  1079.                         sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(tblSchedule.schEmpID.CurrentValue) & " AND [empIsActive]=True"
  1080.                         sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  1081.                 RsWrk = Conn.GetTempDataReader(sSqlWrk)
  1082.                 If RsWrk.Read() Then
  1083.                     tblSchedule.schEmpID.EditValue = RsWrk("empName")
  1084.                 Else
  1085.                     tblSchedule.schEmpID.EditValue = tblSchedule.schEmpID.CurrentValue
  1086.                 End If
  1087.                 Conn.CloseTempDataReader()
  1088.             Else
  1089.                 tblSchedule.schEmpID.EditValue = System.DBNull.Value
  1090.             End If
  1091.             tblSchedule.schEmpID.CssStyle = ""
  1092.             tblSchedule.schEmpID.CssClass = ""
  1093.             tblSchedule.schEmpID.ViewCustomAttributes = ""
  1094.             Else
  1095.             sSqlWrk = "SELECT [empID], [empName], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblEmployees]"
  1096.                     sWhereWrk = "[empIsActive]=True"
  1097.             sWhereWrk = tblEmployees.AddUserIDFilter(sWhereWrk)
  1098.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1099.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  1100.             arwrk = Conn.GetRows(sSqlWrk)
  1101.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1102.             tblSchedule.schEmpID.EditValue = arwrk
  1103.             End If
  1104.  
  1105.             ' schPosID
  1106.             tblSchedule.schPosID.EditCustomAttributes = ""
  1107.             sSqlWrk = "SELECT [posID], [posDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblPositions]"
  1108.                 sWhereWrk = "[posIsActive]=True"
  1109.             If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1110.             sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  1111.             arwrk = Conn.GetRows(sSqlWrk)
  1112.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1113.             tblSchedule.schPosID.EditValue = arwrk
  1114.  
  1115.             ' schTypID
  1116.             tblSchedule.schTypID.EditCustomAttributes = ""
  1117.             sSqlWrk = "SELECT [typID], [typDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblTypes]"
  1118.                 sWhereWrk = "[typIsActive]=True"
  1119.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1120.             sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  1121.             arwrk = Conn.GetRows(sSqlWrk)
  1122.             arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1123.             tblSchedule.schTypID.EditValue = arwrk
  1124.  
  1125.                 ' schDepID
  1126.                 tblSchedule.schDepID.EditCustomAttributes = ""
  1127.                 sSqlWrk = "SELECT [depID], [depAcctCode], [depDescription], '' AS SelectFilterFld FROM [tblDepartments]"
  1128.                 sWhereWrk = "[depIsActive]=True"
  1129.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1130.                 sSqlWrk = sSqlWrk & " ORDER BY [depID] "
  1131.                 arwrk = Conn.GetRows(sSqlWrk)
  1132.                 arwrk.Insert(0, New Object() {"", "Please Select", ""})
  1133.                 tblSchedule.schDepID.EditValue = arwrk
  1134.  
  1135.                 '' schDepID
  1136.                 'tblSchedule.schDepID.EditCustomAttributes = ""
  1137.                 'sSqlWrk = "SELECT [depID], [depDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblDepartments]"
  1138.                 'sWhereWrk = ""
  1139.                 'If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1140.                 'sSqlWrk = sSqlWrk & " ORDER BY [depDescription] "
  1141.                 'arwrk = Conn.GetRows(sSqlWrk)
  1142.                 'arwrk.Insert(0, New Object(){"", "Please Select"}) 
  1143.                 'tblSchedule.schDepID.EditValue = arwrk
  1144.  
  1145.             ' schNotes
  1146.             tblSchedule.schNotes.EditCustomAttributes = ""
  1147.             tblSchedule.schNotes.EditValue = ew_HtmlEncode(tblSchedule.schNotes.CurrentValue)
  1148.  
  1149.             ' schRate
  1150.             tblSchedule.schRate.EditCustomAttributes = ""
  1151.             tblSchedule.schRate.EditValue = ew_HtmlEncode(tblSchedule.schRate.CurrentValue)
  1152.  
  1153.             ' schActualStart
  1154.             tblSchedule.schActualStart.EditCustomAttributes = ""
  1155.                 tblSchedule.schActualStart.EditValue = ew_FormatDateTime(tblSchedule.schActualStart.CurrentValue, 4)
  1156.  
  1157.             ' schActualEnd
  1158.             tblSchedule.schActualEnd.EditCustomAttributes = ""
  1159.                 tblSchedule.schActualEnd.EditValue = ew_FormatDateTime(tblSchedule.schActualEnd.CurrentValue, 4)
  1160.  
  1161.             ' schDateCreated
  1162.             ' schDoubleBooked
  1163.  
  1164.             tblSchedule.schDoubleBooked.EditCustomAttributes = ""
  1165.  
  1166.                 ' schStatus
  1167.                 tblSchedule.schStatus.EditCustomAttributes = ""
  1168.                 sSqlWrk = "SELECT [stID], [stDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblScheduleStatus]"
  1169.                 sWhereWrk = "[stIsActive]=True"
  1170.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  1171.                 sSqlWrk = sSqlWrk & " ORDER BY [stDescription] "
  1172.                 arwrk = Conn.GetRows(sSqlWrk)
  1173.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  1174.                 tblSchedule.schStatus.EditValue = arwrk
  1175.  
  1176.                 ' schDayOfWeek
  1177.                 tblSchedule.schDayOfWeek.EditCustomAttributes = ""
  1178.                 arwrk = New ArrayList
  1179.                 arwrk.Add(New String() {"1", "Sun"})
  1180.                 arwrk.Add(New String() {"2", "Mon"})
  1181.                 arwrk.Add(New String() {"3", "Tue"})
  1182.                 arwrk.Add(New String() {"4", "Wed"})
  1183.                 arwrk.Add(New String() {"5", "Thu"})
  1184.                 arwrk.Add(New String() {"6", "Fri"})
  1185.                 arwrk.Add(New String() {"7", "Sat"})
  1186.                 arwrk.Insert(0, New String() {"", "Please Select"})
  1187.                 tblSchedule.schDayOfWeek.EditValue = arwrk
  1188.  
  1189.                 ' Edit refer script
  1190.             ' schDate
  1191.  
  1192.             tblSchedule.schDate.HrefValue = ""
  1193.  
  1194.             ' schEvtID
  1195.             tblSchedule.schEvtID.HrefValue = ""
  1196.  
  1197.             ' schPartsID
  1198.             tblSchedule.schPartsID.HrefValue = ""
  1199.  
  1200.             ' schCallTime
  1201.             tblSchedule.schCallTime.HrefValue = ""
  1202.  
  1203.             ' schStartTime
  1204.             tblSchedule.schStartTime.HrefValue = ""
  1205.  
  1206.             ' schEndTime
  1207.             tblSchedule.schEndTime.HrefValue = ""
  1208.  
  1209.             ' schOutTime
  1210.             tblSchedule.schOutTime.HrefValue = ""
  1211.  
  1212.             ' schLocID
  1213.             tblSchedule.schLocID.HrefValue = ""
  1214.  
  1215.             ' schEmpID
  1216.             tblSchedule.schEmpID.HrefValue = ""
  1217.  
  1218.             ' schPosID
  1219.             tblSchedule.schPosID.HrefValue = ""
  1220.  
  1221.             ' schTypID
  1222.             tblSchedule.schTypID.HrefValue = ""
  1223.  
  1224.             ' schDepID
  1225.             tblSchedule.schDepID.HrefValue = ""
  1226.  
  1227.             ' schNotes
  1228.             tblSchedule.schNotes.HrefValue = ""
  1229.  
  1230.             ' schRate
  1231.             tblSchedule.schRate.HrefValue = ""
  1232.  
  1233.             ' schActualStart
  1234.             tblSchedule.schActualStart.HrefValue = ""
  1235.  
  1236.             ' schActualEnd
  1237.             tblSchedule.schActualEnd.HrefValue = ""
  1238.  
  1239.             ' schDateCreated
  1240.             tblSchedule.schDateCreated.HrefValue = ""
  1241.  
  1242.             ' schDoubleBooked
  1243.             tblSchedule.schDoubleBooked.HrefValue = ""
  1244.  
  1245.             ' schStatus
  1246.             tblSchedule.schStatus.HrefValue = ""
  1247.  
  1248.                 ' schDayOfWeek
  1249.                 tblSchedule.schDayOfWeek.HrefValue = ""
  1250.  
  1251.             End If
  1252.  
  1253.         ' Row Rendered event
  1254.         tblSchedule.Row_Rendered()
  1255.     End Sub
  1256.  
  1257.     '
  1258.     ' Validate form
  1259.     '
  1260.     Function ValidateForm() As Boolean
  1261.  
  1262.         ' Initialize
  1263.         ParentPage.gsFormError = ""
  1264.         Dim lUpdateCnt As Integer = 0
  1265.         If tblSchedule.schDate.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1266.         If tblSchedule.schEvtID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1267.         If tblSchedule.schPartsID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1268.         If tblSchedule.schCallTime.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1269.         If tblSchedule.schStartTime.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1270.         If tblSchedule.schEndTime.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1271.         If tblSchedule.schOutTime.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1272.         If tblSchedule.schLocID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1273.         If tblSchedule.schEmpID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1274.         If tblSchedule.schPosID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1275.         If tblSchedule.schTypID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1276.         If tblSchedule.schDepID.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1277.         If tblSchedule.schNotes.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1278.         If tblSchedule.schRate.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1279.         If tblSchedule.schActualStart.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1280.         If tblSchedule.schActualEnd.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1281.         If tblSchedule.schDateCreated.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1282.         If tblSchedule.schDoubleBooked.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1283.             If tblSchedule.schStatus.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1284.             If tblSchedule.schDayOfWeek.MultiUpdate = "1" Then lUpdateCnt = lUpdateCnt + 1
  1285.             If lUpdateCnt = 0 Then
  1286.                 ParentPage.gsFormError = "No field selected for update"
  1287.                 Return False
  1288.             End If
  1289.  
  1290.         ' Check if validation required
  1291.             'If Not EW_SERVER_VALIDATE Then Return (ParentPage.gsFormError = "")
  1292.             'If tblSchedule.schDate.MultiUpdate <> "" Then
  1293.             '    If ew_Empty(tblSchedule.schDate.FormValue) Then
  1294.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1295.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Date"
  1296.             '    End If
  1297.             'End If
  1298.             'If tblSchedule.schDate.MultiUpdate <> "" Then
  1299.             '    If Not ew_CheckUSDate(tblSchedule.schDate.FormValue) Then
  1300.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1301.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Date"
  1302.             '    End If
  1303.             'End If
  1304.             'If tblSchedule.schEvtID.MultiUpdate <> "" Then
  1305.             '    If ew_Empty(tblSchedule.schEvtID.FormValue) Then
  1306.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1307.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Event"
  1308.             '    End If
  1309.             'End If
  1310.             'If tblSchedule.schPartsID.MultiUpdate <> "" Then
  1311.             '    If ew_Empty(tblSchedule.schPartsID.FormValue) Then
  1312.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1313.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Part"
  1314.             '    End If
  1315.             'End If
  1316.             'If tblSchedule.schCallTime.MultiUpdate <> "" Then
  1317.             '    If Not ew_CheckUSDate(tblSchedule.schCallTime.FormValue) Then
  1318.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1319.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Call Time"
  1320.             '    End If
  1321.             'End If
  1322.             'If tblSchedule.schStartTime.MultiUpdate <> "" Then
  1323.             '    If Not ew_CheckUSDate(tblSchedule.schStartTime.FormValue) Then
  1324.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1325.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Start Time"
  1326.             '    End If
  1327.             'End If
  1328.             'If tblSchedule.schEndTime.MultiUpdate <> "" Then
  1329.             '    If Not ew_CheckUSDate(tblSchedule.schEndTime.FormValue) Then
  1330.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1331.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - End Time"
  1332.             '    End If
  1333.             'End If
  1334.             'If tblSchedule.schOutTime.MultiUpdate <> "" Then
  1335.             '    If Not ew_CheckUSDate(tblSchedule.schOutTime.FormValue) Then
  1336.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1337.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Out Time"
  1338.             '    End If
  1339.             'End If
  1340.             'If tblSchedule.schLocID.MultiUpdate <> "" Then
  1341.             '    If ew_Empty(tblSchedule.schLocID.FormValue) Then
  1342.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1343.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Location"
  1344.             '    End If
  1345.             'End If
  1346.             'If tblSchedule.schEmpID.MultiUpdate <> "" Then
  1347.             '    If ew_Empty(tblSchedule.schEmpID.FormValue) Then
  1348.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1349.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Employee"
  1350.             '    End If
  1351.             'End If
  1352.             'If tblSchedule.schPosID.MultiUpdate <> "" Then
  1353.             '    If ew_Empty(tblSchedule.schPosID.FormValue) Then
  1354.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1355.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Position"
  1356.             '    End If
  1357.             'End If
  1358.             'If tblSchedule.schTypID.MultiUpdate <> "" Then
  1359.             '    If ew_Empty(tblSchedule.schTypID.FormValue) Then
  1360.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1361.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Type"
  1362.             '    End If
  1363.             'End If
  1364.             'If tblSchedule.schDepID.MultiUpdate <> "" Then
  1365.             '    If ew_Empty(tblSchedule.schDepID.FormValue) Then
  1366.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1367.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Department"
  1368.             '    End If
  1369.             'End If
  1370.             'If tblSchedule.schRate.MultiUpdate <> "" Then
  1371.             '    If Not ew_CheckNumber(tblSchedule.schRate.FormValue) Then
  1372.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1373.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect floating point number - Rate"
  1374.             '    End If
  1375.             'End If
  1376.             'If tblSchedule.schActualStart.MultiUpdate <> "" Then
  1377.             '    If Not ew_CheckUSDate(tblSchedule.schActualStart.FormValue) Then
  1378.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1379.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Actual Start"
  1380.             '    End If
  1381.             'End If
  1382.             'If tblSchedule.schActualEnd.MultiUpdate <> "" Then
  1383.             '    If Not ew_CheckUSDate(tblSchedule.schActualEnd.FormValue) Then
  1384.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1385.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect date, format = mm/dd/yyyy - Actual End"
  1386.             '    End If
  1387.             'End If
  1388.             'If tblSchedule.schStatus.MultiUpdate <> "" Then
  1389.             '    If ew_Empty(tblSchedule.schStatus.FormValue) Then
  1390.             '        If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1391.             '        ParentPage.gsFormError = ParentPage.gsFormError & "Please enter required field - Status"
  1392.             '    End If
  1393.             'End If
  1394.  
  1395.             Dim tlc As New AspNetMaker7_tfpssnet
  1396.             If tblSchedule.schCallTime.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schCallTime.FormValue)
  1397.             If tblSchedule.schStartTime.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schStartTime.FormValue)
  1398.             If tblSchedule.schEndTime.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schEndTime.FormValue)
  1399.             If tblSchedule.schOutTime.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schOutTime.FormValue)
  1400.             If tblSchedule.schActualStart.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schActualStart.FormValue)
  1401.             If tblSchedule.schActualEnd.FormValue <> "" Then tlc.tlcCheckTime(tblSchedule.schActualEnd.FormValue)
  1402.  
  1403.             If tblSchedule.schCallTime.MultiUpdate <> "" Then
  1404.                 If Not ew_CheckTime(tblSchedule.schCallTime.FormValue) And tblSchedule.schCallTime.FormValue <> "" Then
  1405.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1406.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Call Time"
  1407.                 End If
  1408.             End If
  1409.             If tblSchedule.schStartTime.MultiUpdate <> "" Then
  1410.                 If Not ew_CheckTime(tblSchedule.schStartTime.FormValue) And tblSchedule.schStartTime.FormValue <> "" Then
  1411.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1412.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Start Time"
  1413.                 End If
  1414.             End If
  1415.             If tblSchedule.schEndTime.MultiUpdate <> "" Then
  1416.                 If Not ew_CheckTime(tblSchedule.schEndTime.FormValue) And tblSchedule.schEndTime.FormValue <> "" Then
  1417.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1418.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - End Time"
  1419.                 End If
  1420.             End If
  1421.             If tblSchedule.schOutTime.MultiUpdate <> "" Then
  1422.                 If Not ew_CheckTime(tblSchedule.schOutTime.FormValue) And tblSchedule.schOutTime.FormValue <> "" Then
  1423.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1424.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Out Time"
  1425.                 End If
  1426.             End If
  1427.             If tblSchedule.schActualStart.MultiUpdate <> "" Then
  1428.                 If Not ew_CheckTime(tblSchedule.schActualStart.FormValue) And tblSchedule.schActualStart.FormValue <> "" Then
  1429.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1430.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Actual Start"
  1431.                 End If
  1432.             End If
  1433.             If tblSchedule.schActualEnd.MultiUpdate <> "" Then
  1434.                 If Not ew_CheckTime(tblSchedule.schActualEnd.FormValue) And tblSchedule.schActualEnd.FormValue <> "" Then
  1435.                     If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1436.                     ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Actual End"
  1437.                 End If
  1438.             End If
  1439.  
  1440.             ' Return validate result
  1441.             Dim Valid As Boolean = (ParentPage.gsFormError = "")
  1442.  
  1443.             ' Form_CustomValidate event
  1444.             Dim sFormCustomError As String = ""
  1445.             Valid = Valid And Form_CustomValidate(sFormCustomError)
  1446.             If sFormCustomError <> "" Then
  1447.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  1448.                 ParentPage.gsFormError = ParentPage.gsFormError & sFormCustomError
  1449.             End If
  1450.             Return Valid
  1451.         End Function
  1452.  
  1453.     '
  1454.     ' Update record based on key values
  1455.     '
  1456.     Function EditRow() As Boolean
  1457.         Dim RsEdit As OleDbDataReader, RsChk As OleDbDataReader
  1458.         Dim sSql As String, sFilter As String
  1459.         Dim sSqlChk As String, sFilterChk As String
  1460.         Dim bUpdateRow As Boolean
  1461.         Dim RsOld As OrderedDictionary
  1462.         Dim sIdxErrMsg As String
  1463.         Dim Rs As New OrderedDictionary
  1464.             Dim tlcsub As New AspNetMaker7_tfpssnet
  1465.             sFilter = tblSchedule.KeyFilter
  1466.         tblSchedule.CurrentFilter  = sFilter
  1467.         sSql = tblSchedule.SQL
  1468.         Try
  1469.             RsEdit = Conn.GetDataReader(sSql) 
  1470.         Catch e As Exception
  1471.             If EW_DEBUG_ENABLED Then Throw
  1472.             Message = e.Message
  1473.             RsEdit.Close()
  1474.             EditRow = False
  1475.         End Try
  1476.         If Not RsEdit.Read() Then
  1477.             RsEdit.Close()
  1478.             EditRow = False ' Update Failed
  1479.         Else
  1480.             RsOld = Conn.GetRow(RsEdit)
  1481.             RsEdit.Close()
  1482.  
  1483.             ' schDate
  1484.                         If tblSchedule.schDate.MultiUpdate = "1" Then
  1485.             tblSchedule.schDate.SetDbValue(ew_UnFormatDateTime(tblSchedule.schDate.CurrentValue, 6), System.DBNull.Value)
  1486.                     Rs("schDate") = tblSchedule.schDate.DbValue
  1487.  
  1488.                     tblSchedule.schDayOfWeek.SetDbValue(tblSchedule.schDayOfWeek.CurrentValue, System.DBNull.Value)
  1489.                     Rs("schDayOfWeek") = tblSchedule.schDayOfWeek.DbValue
  1490.  
  1491.             End If
  1492.  
  1493.             ' schEvtID
  1494.                         If tblSchedule.schEvtID.MultiUpdate = "1" Then
  1495.             tblSchedule.schEvtID.SetDbValue(tblSchedule.schEvtID.CurrentValue, System.DBNull.Value)
  1496.             Rs("schEvtID") = tblSchedule.schEvtID.DbValue
  1497.             End If
  1498.  
  1499.             ' schPartsID
  1500.                         If tblSchedule.schPartsID.MultiUpdate = "1" Then
  1501.             tblSchedule.schPartsID.SetDbValue(tblSchedule.schPartsID.CurrentValue, System.DBNull.Value)
  1502.             Rs("schPartsID") = tblSchedule.schPartsID.DbValue
  1503.             End If
  1504.  
  1505.             ' schCallTime
  1506.                 If tblSchedule.schCallTime.MultiUpdate = "1" Then
  1507.                     tblSchedule.schCallTime.SetDbValue(ew_UnFormatDateTime(tblSchedule.schCallTime.CurrentValue, 4), System.DBNull.Value)
  1508.                     Rs("schCallTime") = tblSchedule.schCallTime.DbValue
  1509.                 End If
  1510.  
  1511.                 ' schStartTime
  1512.                 If tblSchedule.schStartTime.MultiUpdate = "1" Then
  1513.                     tblSchedule.schStartTime.SetDbValue(ew_UnFormatDateTime(tblSchedule.schStartTime.CurrentValue, 4), System.DBNull.Value)
  1514.                     Rs("schStartTime") = tblSchedule.schStartTime.DbValue
  1515.                 End If
  1516.  
  1517.                 ' schEndTime
  1518.                 If tblSchedule.schEndTime.MultiUpdate = "1" Then
  1519.                     tblSchedule.schEndTime.SetDbValue(ew_UnFormatDateTime(tblSchedule.schEndTime.CurrentValue, 4), System.DBNull.Value)
  1520.                     Rs("schEndTime") = tblSchedule.schEndTime.DbValue
  1521.                 End If
  1522.  
  1523.                 ' schOutTime
  1524.                 If tblSchedule.schOutTime.MultiUpdate = "1" Then
  1525.                     tblSchedule.schOutTime.SetDbValue(ew_UnFormatDateTime(tblSchedule.schOutTime.CurrentValue, 4), System.DBNull.Value)
  1526.                     Rs("schOutTime") = tblSchedule.schOutTime.DbValue
  1527.                 End If
  1528.  
  1529.                 ' schLocID
  1530.                 If tblSchedule.schLocID.MultiUpdate = "1" Then
  1531.                     tblSchedule.schLocID.SetDbValue(tblSchedule.schLocID.CurrentValue, System.DBNull.Value)
  1532.                     Rs("schLocID") = tblSchedule.schLocID.DbValue
  1533.                 End If
  1534.  
  1535.                 ' schEmpID
  1536.                 If tblSchedule.schEmpID.MultiUpdate = "1" Then
  1537.                     tblSchedule.schEmpID.SetDbValue(tblSchedule.schEmpID.CurrentValue, System.DBNull.Value)
  1538.                     Rs("schEmpID") = tblSchedule.schEmpID.DbValue
  1539.                     Rs("schRate") = tlcsub.tlcGetEmployeeRate(tblSchedule.schEmpID.DbValue)
  1540.                 End If
  1541.  
  1542.                 ' schPosID
  1543.                 If tblSchedule.schPosID.MultiUpdate = "1" Then
  1544.                     tblSchedule.schPosID.SetDbValue(tblSchedule.schPosID.CurrentValue, System.DBNull.Value)
  1545.                     Rs("schPosID") = tblSchedule.schPosID.DbValue
  1546.                 End If
  1547.  
  1548.                 ' schTypID
  1549.                 If tblSchedule.schTypID.MultiUpdate = "1" Then
  1550.                     tblSchedule.schTypID.SetDbValue(tblSchedule.schTypID.CurrentValue, System.DBNull.Value)
  1551.                     Rs("schTypID") = tblSchedule.schTypID.DbValue
  1552.                 End If
  1553.  
  1554.                 ' schDepID
  1555.                 If tblSchedule.schDepID.MultiUpdate = "1" Then
  1556.                     tblSchedule.schDepID.SetDbValue(tblSchedule.schDepID.CurrentValue, System.DBNull.Value)
  1557.                     Rs("schDepID") = tblSchedule.schDepID.DbValue
  1558.                 End If
  1559.  
  1560.                 ' schNotes
  1561.                 If tblSchedule.schNotes.MultiUpdate = "1" Then
  1562.                     tblSchedule.schNotes.SetDbValue(tblSchedule.schNotes.CurrentValue, System.DBNull.Value)
  1563.                     Rs("schNotes") = tblSchedule.schNotes.DbValue
  1564.                 End If
  1565.  
  1566.                 ' schRate
  1567.                 If tblSchedule.schRate.MultiUpdate = "1" Then
  1568.                     tblSchedule.schRate.SetDbValue(tblSchedule.schRate.CurrentValue, System.DBNull.Value)
  1569.                     'Rs("schRate") = tblSchedule.schRate.DbValue
  1570.                     Rs("schRate") = tlcsub.tlcGetEmployeeRate(tblSchedule.schEmpID.DbValue)
  1571.                 End If
  1572.  
  1573.                 ' schActualStart
  1574.                 If tblSchedule.schActualStart.MultiUpdate = "1" Then
  1575.                     tblSchedule.schActualStart.SetDbValue(ew_UnFormatDateTime(tblSchedule.schActualStart.CurrentValue, 4), System.DBNull.Value)
  1576.                     Rs("schActualStart") = tblSchedule.schActualStart.DbValue
  1577.                 End If
  1578.  
  1579.                 ' schActualEnd
  1580.                 If tblSchedule.schActualEnd.MultiUpdate = "1" Then
  1581.                     tblSchedule.schActualEnd.SetDbValue(ew_UnFormatDateTime(tblSchedule.schActualEnd.CurrentValue, 4), System.DBNull.Value)
  1582.                     Rs("schActualEnd") = tblSchedule.schActualEnd.DbValue
  1583.                 End If
  1584.  
  1585.                 ' schDateCreated
  1586.                 If tblSchedule.schDateCreated.MultiUpdate = "1" Then
  1587.                     tblSchedule.schDateCreated.DbValue = ew_CurrentDateTime()
  1588.                     Rs("schDateCreated") = tblSchedule.schDateCreated.DbValue
  1589.                 End If
  1590.  
  1591.                 ' schDoubleBooked
  1592.                 If tblSchedule.schDoubleBooked.MultiUpdate = "1" Then
  1593.                     tblSchedule.schDoubleBooked.SetDbValue((tblSchedule.schDoubleBooked.CurrentValue <> "" And Not IsDBNull(tblSchedule.schDoubleBooked.CurrentValue)), System.DBNull.Value)
  1594.                     Rs("schDoubleBooked") = tblSchedule.schDoubleBooked.DbValue
  1595.                 End If
  1596.  
  1597.                 ' schStatus
  1598.                 If tblSchedule.schStatus.MultiUpdate = "1" Then
  1599.                     tblSchedule.schStatus.SetDbValue(tblSchedule.schStatus.CurrentValue, System.DBNull.Value)
  1600.                     Rs("schStatus") = tblSchedule.schStatus.DbValue
  1601.                 End If
  1602.  
  1603.                 ' schDayOfWeek
  1604.                 If tblSchedule.schDayOfWeek.MultiUpdate = "1" Then
  1605.                     tblSchedule.schDayOfWeek.SetDbValue(tblSchedule.schDayOfWeek.CurrentValue, System.DBNull.Value)
  1606.                     Rs("schDayOfWeek") = tblSchedule.schDayOfWeek.DbValue
  1607.                 End If
  1608.  
  1609.                 ' Row Updating event
  1610.                 bUpdateRow = tblSchedule.Row_Updating(RsOld, Rs)
  1611.                 If bUpdateRow Then
  1612.                     Try
  1613.                         tblSchedule.Update(Rs)
  1614.                         EditRow = True
  1615.                     Catch e As Exception
  1616.                         If EW_DEBUG_ENABLED Then Throw
  1617.                         Message = e.Message
  1618.                         EditRow = False
  1619.                     End Try
  1620.                 Else
  1621.                     If tblSchedule.CancelMessage <> "" Then
  1622.                         Message = tblSchedule.CancelMessage
  1623.                         tblSchedule.CancelMessage = ""
  1624.                     Else
  1625.                         Message = "Update cancelled"
  1626.                     End If
  1627.                     EditRow = False
  1628.                 End If
  1629.                 End If
  1630.  
  1631.                 ' Row Updated event
  1632.                 If EditRow Then
  1633.                     tblSchedule.Row_Updated(RsOld, Rs)
  1634.                 End If
  1635.         End Function
  1636.  
  1637.         ' Page Load event
  1638.         Public Sub Page_Load()
  1639.  
  1640.             'HttpContext.Current.Response.Write("Page Load")
  1641.         End Sub
  1642.  
  1643.         ' Page Unload event
  1644.         Public Sub Page_Unload()
  1645.  
  1646.             'HttpContext.Current.Response.Write("Page Unload")
  1647.         End Sub
  1648.  
  1649.     ' Form Custom Validate event
  1650.     Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  1651.  
  1652.         'Return error message in CustomError
  1653.         Return True
  1654.     End Function
  1655.     End Class
  1656.  
  1657.     '
  1658.     ' ASP.NET Page_Load event
  1659.     '
  1660.  
  1661.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  1662.         Response.Buffer = EW_RESPONSE_BUFFER
  1663.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  1664.  
  1665.         ' Page init
  1666.         tblSchedule_update = New ctblSchedule_update(Me)        
  1667.         tblSchedule_update.Page_Init()
  1668.  
  1669.         ' Page main processing
  1670.         tblSchedule_update.Page_Main()
  1671.     End Sub
  1672.  
  1673.     '
  1674.     ' ASP.NET Page_Unload event
  1675.     '
  1676.  
  1677.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  1678.  
  1679.         ' Dispose page object
  1680.         If tblSchedule_update IsNot Nothing Then tblSchedule_update.Dispose()
  1681.     End Sub
  1682. End Class
  1683.