home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / askScheduleRecurringform.aspx.vb < prev    next >
Text File  |  2014-11-09  |  49KB  |  967 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 askScheduleRecurringform
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public askScheduleRecurring_form As caskScheduleRecurring_form
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class caskScheduleRecurring_form
  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 askScheduleReport.UseTokenInUrl Then Url = Url & "t=" & askScheduleReport.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 askScheduleReport.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (askScheduleReport.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (askScheduleReport.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True
  54.         End Function
  55.  
  56.         ' askScheduleReport
  57.         Public Property askScheduleReport() As caskScheduleReport
  58.             Get
  59.                 Return ParentPage.askScheduleReport
  60.             End Get
  61.             Set(ByVal v As caskScheduleReport)
  62.                 ParentPage.askScheduleReport = v
  63.             End Set
  64.         End Property
  65.  
  66.         ' askScheduleReport
  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.         ' askScheduleReport
  77.         Public Property tblEvents() As ctblEvents
  78.             Get
  79.                 Return ParentPage.tblEvents
  80.             End Get
  81.             Set(ByVal v As ctblEvents)
  82.                 ParentPage.tblEvents = v
  83.             End Set
  84.         End Property
  85.  
  86.         '
  87.         '  Constructor
  88.         '  - init objects
  89.         '  - open connection
  90.         '
  91.         Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)
  92.             m_ParentPage = APage
  93.             m_Page = Me
  94.             m_PageID = "list"
  95.             m_PageObjName = "askScheduleRecurring_form"
  96.             m_PageObjTypeName = "caskScheduleRecurring_form"
  97.  
  98.             ' Table Name
  99.             m_TableName = "askScheduleReport"
  100.  
  101.             ' Initialize table object
  102.             askScheduleReport = New caskScheduleReport(Me)
  103.             tblEmployees = New ctblEmployees(Me)
  104.             tblEvents = New ctblEvents(Me)
  105.  
  106.             ' Connect to database
  107.             Conn = New cConnection()
  108.  
  109.             ' Initialize list options
  110.             ListOptions = New cListOptions
  111.         End Sub
  112.  
  113.         '
  114.         '  Subroutine Page_Init
  115.         '  - called before page main
  116.         '  - check Security
  117.         '  - set up response header
  118.         '  - call page load events
  119.         '
  120.         Public Sub Page_Init()
  121.             Security = New cAdvancedSecurity(Me)
  122.             If Not Security.IsLoggedIn() Then Security.AutoLogin()
  123.             If Not Security.IsLoggedIn() Then
  124.                 Security.SaveLastUrl()
  125.                 Page_Terminate("login.aspx")
  126.             End If
  127.  
  128.             ' Table Permission loading event
  129.             Security.TablePermission_Loading()
  130.             Security.LoadCurrentUserLevel(TableName)
  131.  
  132.             ' Table Permission loaded event
  133.             Security.TablePermission_Loaded()
  134.             If Not Security.CanList Then
  135.                 Security.SaveLastUrl()
  136.                 Page_Terminate("login.aspx")
  137.             End If
  138.  
  139.             ' User ID loading event
  140.             Security.UserID_Loading()
  141.             If Security.IsLoggedIn() Then Call Security.LoadUserID()
  142.  
  143.             ' User ID loaded event
  144.             Security.UserID_Loaded()
  145.             askScheduleReport.Export = ew_Get("export") ' Get export parameter
  146.             ParentPage.gsExport = askScheduleReport.Export ' Get export parameter, used in header
  147.             ParentPage.gsExportFile = askScheduleReport.TableVar ' Get export file, used in header
  148.  
  149.             ' Global page loading event (in ewglobal*.vb)
  150.             ParentPage.Page_Loading()
  151.  
  152.             ' Page load event, used in current page
  153.             Page_Load()
  154.         End Sub
  155.  
  156.         '
  157.         '  Class terminate
  158.         '  - clean up page object
  159.         '
  160.         Public Sub Dispose() Implements IDisposable.Dispose
  161.             Page_Terminate("")
  162.         End Sub
  163.  
  164.         '
  165.         '  Sub Page_Terminate
  166.         '  - called when exit page
  167.         '  - clean up connection and objects
  168.         '  - if URL specified, redirect to URL
  169.         '
  170.         Sub Page_Terminate(ByVal url As String)
  171.  
  172.             ' Page unload event, used in current page
  173.             Page_Unload()
  174.  
  175.             ' Global page unloaded event (in ewglobal*.vb)
  176.             ParentPage.Page_Unloaded()
  177.  
  178.             ' Close connection
  179.             Conn.Dispose()
  180.             Security = Nothing
  181.             askScheduleReport.Dispose()
  182.             tblEmployees.Dispose()
  183.             tblEvents.Dispose()
  184.             ListOptions = Nothing
  185.  
  186.             ' Go to URL if specified
  187.             If url <> "" Then
  188.                 HttpContext.Current.Response.Clear()
  189.                 HttpContext.Current.Response.Redirect(url)
  190.             End If
  191.         End Sub
  192.  
  193.         Public lDisplayRecs As Integer ' Number of display records
  194.  
  195.         Public lStartRec As Integer, lStopRec As Integer, lTotalRecs As Integer, lRecRange As Integer
  196.  
  197.         Public sSrchWhere As String
  198.  
  199.         Public lRecCnt As Integer
  200.  
  201.         Public lEditRowCnt As Integer
  202.  
  203.         Public lRowCnt As Integer, lRowIndex As Integer
  204.  
  205.         Public lOptionCnt As Integer
  206.  
  207.         Public lRecPerRow As Integer, lColCnt As Integer
  208.  
  209.         Public sDeleteConfirmMsg As String ' Delete confirm message
  210.  
  211.         Public sDbMasterFilter As String, sDbDetailFilter As String
  212.  
  213.         Public bMasterRecordExists As Boolean
  214.  
  215.         Public ListOptions As Object
  216.  
  217.         Public sMultiSelectKey As String
  218.  
  219.         Public x_ewPriv As Integer
  220.  
  221.         '
  222.         ' Page main processing
  223.         '
  224.         Public Sub Page_Main()
  225.             If IsPageRequest() Then ' Validate request
  226.                 Dim sDate As String, eDate As String, sPartsID As Integer, sEmployeeID As Long, sEventsID As Long, sCallTime As DateTime, sStartTime As DateTime
  227.                 Dim sEndTime As DateTime, sOutTime As DateTime, sLocID As Integer, sPosID As Integer, sTypID As Integer, sDepID As Integer, sRate As Double
  228.                 Dim sNotes As String, tmpDate As DateTime, tmpCount As Integer, strSQL As String, bUpdateFlag As Boolean, arRecKeys As String(), i As Integer
  229.                 Dim tmpCallTime As String, tmpStartTime As String, tmpEndTime As String, tmpOutTime As String, tmpBiWeekly As String, tmpDayNum As Integer
  230.                 ReDim arRecKeys(42)
  231.  
  232.                 If ew_Get("t") = "e" Then
  233.                     'askScheduleReport.schCallTime.FormValue = ew_Get("x_schCallTime")
  234.                 End If
  235.                 If ew_Get("t") = "u" Then
  236.                     tmpCallTime = ew_Get("x_schCallTime")
  237.                     tmpStartTime = ew_Get("x_schStartTime")
  238.                     tmpEndTime = ew_Get("x_schEndTime")
  239.                     tmpOutTime = ew_Get("x_schOutTime")
  240.                     ' Validate Form
  241.                     If Not ValidateTimes(tmpCallTime, tmpStartTime, tmpEndTime, tmpOutTime) Then
  242.                         Message = ParentPage.gsFormError
  243.                         askScheduleReport.schEvtID.EditValue = ew_Get("x_schEvtID")
  244.                         askScheduleReport.schPartsID.EditValue = ew_Get("x_schPartsID")
  245.                         'askScheduleReport.schCallTime.EditValue = tmpCallTime
  246.                         'askScheduleReport.schStartTime.EditValue = tmpStartTime
  247.                         'askScheduleReport.schEndTime.EditValue = tmpEndTime
  248.                         'askScheduleReport.schOutTime.EditValue = tmpOutTime
  249.                         askScheduleReport.schLocID.EditValue = ew_Get("x_schLocID")
  250.                         askScheduleReport.schEmpID.EditValue = ew_Get("x_schEmpID")
  251.                         askScheduleReport.schPosID.EditValue = ew_Get("x_schPosID")
  252.                         askScheduleReport.schTypID.EditValue = ew_Get("x_schTypID")
  253.                         askScheduleReport.schDepID.EditValue = ew_Get("x_schDepID")
  254.                         askScheduleReport.schNotes.EditValue = ew_Get("x_schNotes")
  255.                         askScheduleReport.RowType = 1
  256.                         ew_Session("x_startDate") = ew_Get("x_startDate")
  257.                         ew_Session("x_endDate") = ew_Get("x_endDate")
  258.                         ew_Session("x_schEvtID") = ew_Get("x_schEvtID")
  259.                         ew_Session("x_schPartsID") = ew_Get("x_schPartsID")
  260.                         ew_Session("x_schCallTime") = tmpCallTime
  261.                         ew_Session("x_schStartTime") = tmpStartTime
  262.                         ew_Session("x_schEndTime") = tmpEndTime
  263.                         ew_Session("x_schOutTime") = tmpOutTime
  264.                         ew_Session("x_schLocID") = ew_Get("x_schLodID")
  265.                         ew_Session("x_schEmpID") = ew_Get("x_schEmpID")
  266.                         ew_Session("x_schPosID") = ew_Get("x_schPosID")
  267.                         ew_Session("x_schTypID") = ew_Get("x_schTypID")
  268.                         ew_Session("x_schDepID") = ew_Get("x_schDepID")
  269.                         ew_Session("x_schNotes") = ew_Get("x_schNotes")
  270.                         ew_Session("biweekly") = ew_Get("x_biweekly")
  271.                         Exit Sub
  272.                     End If
  273.  
  274.                     For i = 1 To 42
  275.                         arRecKeys(i) = ew_Get("key_" & i)
  276.                     Next
  277.  
  278.                     Dim tlcsub As New AspNetMaker7_tfpssnet
  279.                     sDate = ew_Get("x_startDate")
  280.                     eDate = ew_Get("x_endDate")
  281.                     sEventsID = ew_Get("x_schEvtID")
  282.                     sPartsID = ew_Get("x_schPartsID")
  283.                     'sCallTime = ew_Get("x_schCallTime")
  284.                     'sStartTime = ew_Get("x_schStartTime")
  285.                     'sEndTime = ew_Get("x_schEndTime")
  286.                     'sOutTime = ew_Get("x_schOutTime")
  287.                     sCallTime = sDate & " " & tmpCallTime
  288.                     sStartTime = sDate & " " & tmpStartTime
  289.                     sEndTime = sDate & " " & tmpEndTime
  290.                     sOutTime = sDate & " " & tmpOutTime
  291.                     sLocID = ew_Get("x_schLocID")
  292.                     sEmployeeID = ew_Get("x_schEmpID")
  293.                     sPosID = ew_Get("x_schPosID")
  294.                     sTypID = ew_Get("x_schTypID")
  295.                     sDepID = ew_Get("x_schDepID")
  296.                     sNotes = Replace(ew_Get("x_schNotes"), "'", "''")
  297.                     tmpDate = sDate
  298.                     tmpBiWeekly = ew_Get("x_biweekly")
  299.  
  300.                     While tmpDate <= eDate
  301.                         bUpdateFlag = False
  302.                         If tmpBiWeekly <> "Y" Then
  303.                             Select Case tmpDate.DayOfWeek
  304.                                 Case 0  'sunday
  305.                                     If arRecKeys(1) = "1" Then bUpdateFlag = True 'all Sundays
  306.                                     If arRecKeys(8) = "8" Then  '1st Sunday
  307.                                         If tlcsub.tlcGetXDay(0, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  308.                                     End If
  309.                                     If arRecKeys(15) = "15" Then  '2nd Sunday
  310.                                         If tlcsub.tlcGetXDay(0, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  311.                                     End If
  312.                                     If arRecKeys(22) = "22" Then  '3rd Sunday
  313.                                         If tlcsub.tlcGetXDay(0, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  314.                                     End If
  315.                                     If arRecKeys(29) = "29" Then  '4th Sunday
  316.                                         If tlcsub.tlcGetXDay(0, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  317.                                     End If
  318.                                     If arRecKeys(36) = "36" Then  '5th Sunday
  319.                                         If tlcsub.tlcGetXDay(0, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  320.                                     End If
  321.                                 Case 1  'monday
  322.                                     If arRecKeys(2) = "2" Then bUpdateFlag = True
  323.                                     If arRecKeys(9) = "9" Then  '1st Monday
  324.                                         If tlcsub.tlcGetXDay(1, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  325.                                     End If
  326.                                     If arRecKeys(16) = "16" Then  '2nd Monday
  327.                                         If tlcsub.tlcGetXDay(1, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  328.                                     End If
  329.                                     If arRecKeys(23) = "23" Then  '3rd Monday
  330.                                         If tlcsub.tlcGetXDay(1, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  331.                                     End If
  332.                                     If arRecKeys(30) = "30" Then  '4th Monday
  333.                                         If tlcsub.tlcGetXDay(1, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  334.                                     End If
  335.                                     If arRecKeys(37) = "37" Then  '5th Monday
  336.                                         If tlcsub.tlcGetXDay(1, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  337.                                     End If
  338.                                 Case 2  'tuesday
  339.                                     If arRecKeys(3) = "3" Then bUpdateFlag = True
  340.                                     If arRecKeys(10) = "10" Then  '1st Tuesday
  341.                                         If tlcsub.tlcGetXDay(2, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  342.                                     End If
  343.                                     If arRecKeys(17) = "17" Then  '2nd Tuesday
  344.                                         If tlcsub.tlcGetXDay(2, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  345.                                     End If
  346.                                     If arRecKeys(24) = "24" Then  '3rd Tuesday
  347.                                         If tlcsub.tlcGetXDay(2, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  348.                                     End If
  349.                                     If arRecKeys(31) = "31" Then  '4th Tuesday
  350.                                         If tlcsub.tlcGetXDay(2, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  351.                                     End If
  352.                                     If arRecKeys(38) = "38" Then  '5th Tuesday
  353.                                         If tlcsub.tlcGetXDay(2, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  354.                                     End If
  355.                                 Case 3  'wednesday
  356.                                     If arRecKeys(4) = "4" Then bUpdateFlag = True
  357.                                     If arRecKeys(11) = "11" Then  '1st Wednesday
  358.                                         If tlcsub.tlcGetXDay(3, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  359.                                     End If
  360.                                     If arRecKeys(18) = "18" Then  '2nd Wednesday
  361.                                         If tlcsub.tlcGetXDay(3, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  362.                                     End If
  363.                                     If arRecKeys(25) = "25" Then  '3rd Wednesday
  364.                                         If tlcsub.tlcGetXDay(3, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  365.                                     End If
  366.                                     If arRecKeys(32) = "32" Then  '4th Wednesday
  367.                                         If tlcsub.tlcGetXDay(3, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  368.                                     End If
  369.                                     If arRecKeys(39) = "39" Then  '5th Wednesday
  370.                                         If tlcsub.tlcGetXDay(3, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  371.                                     End If
  372.                                 Case 4  'thursday
  373.                                     If arRecKeys(5) = "5" Then bUpdateFlag = True
  374.                                     If arRecKeys(12) = "12" Then  '1st Thursday
  375.                                         If tlcsub.tlcGetXDay(4, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  376.                                     End If
  377.                                     If arRecKeys(19) = "19" Then  '2nd Thursday
  378.                                         If tlcsub.tlcGetXDay(4, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  379.                                     End If
  380.                                     If arRecKeys(26) = "26" Then  '3rd Thursday
  381.                                         If tlcsub.tlcGetXDay(4, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  382.                                     End If
  383.                                     If arRecKeys(33) = "33" Then  '4th Thursday
  384.                                         If tlcsub.tlcGetXDay(4, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  385.                                     End If
  386.                                     If arRecKeys(40) = "40" Then  '5th Thursday
  387.                                         If tlcsub.tlcGetXDay(4, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  388.                                     End If
  389.                                 Case 5  'friday
  390.                                     If arRecKeys(6) = "6" Then bUpdateFlag = True
  391.                                     If arRecKeys(13) = "13" Then  '1st Friday
  392.                                         If tlcsub.tlcGetXDay(5, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  393.                                     End If
  394.                                     If arRecKeys(20) = "20" Then  '2nd Friday
  395.                                         If tlcsub.tlcGetXDay(5, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  396.                                     End If
  397.                                     If arRecKeys(27) = "27" Then  '3rd Friday
  398.                                         If tlcsub.tlcGetXDay(5, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  399.                                     End If
  400.                                     If arRecKeys(34) = "34" Then  '4th Friday
  401.                                         If tlcsub.tlcGetXDay(5, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  402.                                     End If
  403.                                     If arRecKeys(41) = "41" Then  '5th Friday
  404.                                         If tlcsub.tlcGetXDay(5, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  405.                                     End If
  406.                                 Case 6  'saturday
  407.                                     If arRecKeys(7) = "7" Then bUpdateFlag = True
  408.                                     If arRecKeys(14) = "14" Then  '1st Saturday
  409.                                         If tlcsub.tlcGetXDay(6, 1, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  410.                                     End If
  411.                                     If arRecKeys(21) = "21" Then  '2nd Saturday
  412.                                         If tlcsub.tlcGetXDay(6, 2, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  413.                                     End If
  414.                                     If arRecKeys(28) = "28" Then  '3rd Saturday
  415.                                         If tlcsub.tlcGetXDay(6, 3, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  416.                                     End If
  417.                                     If arRecKeys(35) = "35" Then  '4th Saturday
  418.                                         If tlcsub.tlcGetXDay(6, 4, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  419.                                     End If
  420.                                     If arRecKeys(42) = "42" Then  '5th Saturday
  421.                                         If tlcsub.tlcGetXDay(6, 5, Month(tmpDate), Year(tmpDate)) = Day(tmpDate) Then bUpdateFlag = True
  422.                                     End If
  423.                             End Select
  424.                         Else
  425.                             If tmpDayNum = 0 Then
  426.                                 bUpdateFlag = True
  427.                             End If
  428.                         End If
  429.                         If bUpdateFlag = True Then
  430.                             sRate = tlcsub.tlcGetEmployeeRate(sEmployeeID)
  431.                             strSQL = "INSERT INTO [tblSchedule] ([schDate],[schDayOfWeek],[schEvtID],[schPartsID],[schCallTime],[schStartTime],[schEndTime],[schOutTime],[schLocID]," _
  432.         & "[schEmpID],[schPosID],[schTypID],[schDepID],[schNotes],[schDateCreated],[schRate]," _
  433.         & "[schStatus]) VALUES ('" & tmpDate & "'," & Weekday(tmpDate) & "," & sEventsID & "," & sPartsID & ",'" & ew_FormatDateTime(tmpDate, vbShortDate) & " " & ew_FormatDateTime(sCallTime, vbLongTime) & "','" & ew_FormatDateTime(tmpDate, vbShortDate) & " " & ew_FormatDateTime(sStartTime, vbLongTime) & "','" & ew_FormatDateTime(tmpDate, vbShortDate) & " " & ew_FormatDateTime(sEndTime, vbLongTime) & "','" & ew_FormatDateTime(tmpDate, vbShortDate) & " " & ew_FormatDateTime(sOutTime, vbLongTime) & "'," _
  434.         & sLocID & "," & sEmployeeID & "," & sPosID & "," & sTypID & "," & sDepID & ",'" & sNotes & "','" & Now() & "'," & sRate & ",2)"
  435.                             '                    strSQL = "INSERT INTO [tblSchedule] ([schDate],[schDayOfWeek],[schEvtID],[schPartsID],[schCallTime],[schStartTime],[schEndTime],[schOutTime],[schLocID]," _
  436.                             '& "[schEmpID],[schPosID],[schTypID],[schDepID],[schNotes],[schDateCreated],[schRate]," _
  437.                             '& "[schStatus]) VALUES ('" & tmpDate & "'," & Weekday(tmpDate) & "," & sEventsID & "," & sPartsID & ",'" & sCallTime & "','" & sStartTime & "','" & sEndTime & "','" & sOutTime & "'," _
  438.                             '& sLocID & "," & sEmployeeID & "," & sPosID & "," & sTypID & "," & sDepID & ",'" & sNotes & "','" & Now() & "'," & sRate & ",2)"
  439.                             Try
  440.                                 Conn = New cConnection()
  441.                                 Conn.Execute(strSQL)
  442.                                 Conn.Dispose()
  443.                                 tmpCount += 1
  444.                             Catch exp As Exception
  445.                                 Page_Terminate("askScheduleRecurringform_results.aspx?e=T&c=" & tmpCount & "&m=" & exp.Message)
  446.                             End Try
  447.                         End If
  448.                         tmpDate = DateAdd("d", 1, tmpDate)
  449.                         tmpDayNum = tmpDayNum + 1
  450.                         If tmpDayNum = 14 Then tmpDayNum = 0
  451.                     End While
  452.                     Page_Terminate("askScheduleRecurringform_results.aspx?e=F&c=" & tmpCount)
  453.                 End If
  454.             End If
  455.         End Sub
  456.  
  457.         '
  458.         ' Load recordset
  459.         '
  460.         Function LoadRecordset() As OleDbDataReader
  461.  
  462.             ' Recordset Selecting event
  463.             askScheduleReport.Recordset_Selecting(askScheduleReport.CurrentFilter)
  464.  
  465.             ' Load list page SQL
  466.             Dim sSql As String = askScheduleReport.ListSQL
  467.  
  468.             ' Write SQL for debug
  469.             If EW_DEBUG_ENABLED Then ew_Write(sSql)
  470.  
  471.             ' Count
  472.             lTotalRecs = -1
  473.  
  474.             ' Load recordset
  475.             Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  476.             If lTotalRecs < 0 AndAlso Rs.HasRows Then
  477.                 lTotalRecs = 0
  478.                 While Rs.Read()
  479.                     lTotalRecs = lTotalRecs + 1
  480.                 End While
  481.                 Rs.Close()
  482.                 Rs = Conn.GetDataReader(sSql)
  483.             End If
  484.  
  485.             ' Recordset Selected event
  486.             askScheduleReport.Recordset_Selected(Rs)
  487.             Return Rs
  488.         End Function
  489.  
  490.  
  491.         '
  492.         ' Render row values based on field settings
  493.         '
  494.         Sub RenderRow()
  495.  
  496.             ' Row Rendering event
  497.             askScheduleReport.Row_Rendering()
  498.  
  499.             '
  500.             '  Common render codes for all row types
  501.             '
  502.             ' schDate
  503.  
  504.             askScheduleReport.schDate.CellCssStyle = "white-space: nowrap;"
  505.             askScheduleReport.schDate.CellCssClass = ""
  506.  
  507.             ' schEvtID
  508.             askScheduleReport.schEvtID.CellCssStyle = ""
  509.             askScheduleReport.schEvtID.CellCssClass = ""
  510.  
  511.             ' schPartsID
  512.             askScheduleReport.schPartsID.CellCssStyle = ""
  513.             askScheduleReport.schPartsID.CellCssClass = ""
  514.  
  515.             ' schCallTime
  516.             askScheduleReport.schCallTime.CellCssStyle = ""
  517.             askScheduleReport.schCallTime.CellCssClass = ""
  518.  
  519.             ' schStartTime
  520.             askScheduleReport.schStartTime.CellCssStyle = ""
  521.             askScheduleReport.schStartTime.CellCssClass = ""
  522.  
  523.             ' schEndTime
  524.             askScheduleReport.schEndTime.CellCssStyle = ""
  525.             askScheduleReport.schEndTime.CellCssClass = ""
  526.  
  527.             ' schOutTime
  528.             askScheduleReport.schOutTime.CellCssStyle = ""
  529.             askScheduleReport.schOutTime.CellCssClass = ""
  530.  
  531.             ' schLocID
  532.             askScheduleReport.schLocID.CellCssStyle = ""
  533.             askScheduleReport.schLocID.CellCssClass = ""
  534.  
  535.             ' schEmpID
  536.             askScheduleReport.schEmpID.CellCssStyle = ""
  537.             askScheduleReport.schEmpID.CellCssClass = ""
  538.  
  539.             ' schPosID
  540.             askScheduleReport.schPosID.CellCssStyle = ""
  541.             askScheduleReport.schPosID.CellCssClass = ""
  542.  
  543.             ' schTypID
  544.             askScheduleReport.schTypID.CellCssStyle = ""
  545.             askScheduleReport.schTypID.CellCssClass = ""
  546.  
  547.             ' schDepID
  548.             askScheduleReport.schDepID.CellCssStyle = ""
  549.             askScheduleReport.schDepID.CellCssClass = ""
  550.  
  551.             ' schNotes
  552.             askScheduleReport.schNotes.CellCssStyle = ""
  553.             askScheduleReport.schNotes.CellCssClass = ""
  554.  
  555.             '
  556.             '  View  Row
  557.             '
  558.  
  559.             If askScheduleReport.RowType = EW_ROWTYPE_VIEW Then ' View row
  560.  
  561.                 ' schDate
  562.                 askScheduleReport.schDate.ViewValue = askScheduleReport.schDate.CurrentValue
  563.                 askScheduleReport.schDate.ViewValue = ew_FormatDateTime(askScheduleReport.schDate.ViewValue, 6)
  564.                 askScheduleReport.schDate.CssStyle = ""
  565.                 askScheduleReport.schDate.CssClass = ""
  566.                 askScheduleReport.schDate.ViewCustomAttributes = ""
  567.  
  568.                 ' schEvtID
  569.                 If ew_NotEmpty(askScheduleReport.schEvtID.CurrentValue) Then
  570.                     sSqlWrk = "SELECT [evtDescription] FROM [tblEvents] WHERE [evtID] = " & ew_AdjustSql(askScheduleReport.schEvtID.CurrentValue) & " AND [evtIsActive]=True"
  571.                     sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  572.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  573.                     If RsWrk.Read() Then
  574.                         askScheduleReport.schEvtID.ViewValue = RsWrk("evtDescription")
  575.                     Else
  576.                         askScheduleReport.schEvtID.ViewValue = askScheduleReport.schEvtID.CurrentValue
  577.                     End If
  578.                     Conn.CloseTempDataReader()
  579.                 Else
  580.                     askScheduleReport.schEvtID.ViewValue = System.DBNull.Value
  581.                 End If
  582.                 askScheduleReport.schEvtID.CssStyle = ""
  583.                 askScheduleReport.schEvtID.CssClass = ""
  584.                 askScheduleReport.schEvtID.ViewCustomAttributes = ""
  585.  
  586.                 ' schPartsID
  587.                 If ew_NotEmpty(askScheduleReport.schPartsID.CurrentValue) Then
  588.                     sSqlWrk = "SELECT [prtDescription] FROM [tblParts] WHERE [prtID] = " & ew_AdjustSql(askScheduleReport.schPartsID.CurrentValue) & " AND [prtIsActive]=True"
  589.                     sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  590.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  591.                     If RsWrk.Read() Then
  592.                         askScheduleReport.schPartsID.ViewValue = RsWrk("prtDescription")
  593.                     Else
  594.                         askScheduleReport.schPartsID.ViewValue = askScheduleReport.schPartsID.CurrentValue
  595.                     End If
  596.                     Conn.CloseTempDataReader()
  597.                 Else
  598.                     askScheduleReport.schPartsID.ViewValue = System.DBNull.Value
  599.                 End If
  600.                 askScheduleReport.schPartsID.CssStyle = ""
  601.                 askScheduleReport.schPartsID.CssClass = ""
  602.                 askScheduleReport.schPartsID.ViewCustomAttributes = ""
  603.  
  604.                 ' schLocID
  605.                 If ew_NotEmpty(askScheduleReport.schLocID.CurrentValue) Then
  606.                     sSqlWrk = "SELECT [locDescription] FROM [tblLocations] WHERE [locID] = " & ew_AdjustSql(askScheduleReport.schLocID.CurrentValue) & " AND [locIsActive]=True"
  607.                     sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  608.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  609.                     If RsWrk.Read() Then
  610.                         askScheduleReport.schLocID.ViewValue = RsWrk("locDescription")
  611.                     Else
  612.                         askScheduleReport.schLocID.ViewValue = askScheduleReport.schLocID.CurrentValue
  613.                     End If
  614.                     Conn.CloseTempDataReader()
  615.                 Else
  616.                     askScheduleReport.schLocID.ViewValue = System.DBNull.Value
  617.                 End If
  618.                 askScheduleReport.schLocID.CssStyle = ""
  619.                 askScheduleReport.schLocID.CssClass = ""
  620.                 askScheduleReport.schLocID.ViewCustomAttributes = ""
  621.  
  622.                 ' schCallTime
  623.                 askScheduleReport.schCallTime.ViewValue = askScheduleReport.schCallTime.CurrentValue
  624.                 askScheduleReport.schCallTime.ViewValue = ew_FormatDateTime(askScheduleReport.schCallTime.ViewValue, 14)
  625.                 askScheduleReport.schCallTime.CssStyle = ""
  626.                 askScheduleReport.schCallTime.CssClass = ""
  627.                 askScheduleReport.schCallTime.ViewCustomAttributes = ""
  628.  
  629.                 ' schStartTime
  630.                 askScheduleReport.schStartTime.ViewValue = askScheduleReport.schStartTime.CurrentValue
  631.                 askScheduleReport.schStartTime.ViewValue = ew_FormatDateTime(askScheduleReport.schStartTime.ViewValue, 14)
  632.                 askScheduleReport.schStartTime.CssStyle = ""
  633.                 askScheduleReport.schStartTime.CssClass = ""
  634.                 askScheduleReport.schStartTime.ViewCustomAttributes = ""
  635.  
  636.                 ' schEndTime
  637.                 askScheduleReport.schEndTime.ViewValue = askScheduleReport.schEndTime.CurrentValue
  638.                 askScheduleReport.schEndTime.ViewValue = ew_FormatDateTime(askScheduleReport.schEndTime.ViewValue, 14)
  639.                 askScheduleReport.schEndTime.CssStyle = ""
  640.                 askScheduleReport.schEndTime.CssClass = ""
  641.                 askScheduleReport.schEndTime.ViewCustomAttributes = ""
  642.  
  643.                 ' schOutTime
  644.                 askScheduleReport.schOutTime.ViewValue = askScheduleReport.schOutTime.CurrentValue
  645.                 askScheduleReport.schOutTime.ViewValue = ew_FormatDateTime(askScheduleReport.schOutTime.ViewValue, 14)
  646.                 askScheduleReport.schOutTime.CssStyle = ""
  647.                 askScheduleReport.schOutTime.CssClass = ""
  648.                 askScheduleReport.schOutTime.ViewCustomAttributes = ""
  649.  
  650.                 ' schEmpID
  651.                 If ew_NotEmpty(askScheduleReport.schEmpID.CurrentValue) Then
  652.                     sSqlWrk = "SELECT [empName] FROM [tblEmployees] WHERE [empID] = " & ew_AdjustSql(askScheduleReport.schEmpID.CurrentValue) & " AND [empIsActive]=True"
  653.                     sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  654.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  655.                     If RsWrk.Read() Then
  656.                         askScheduleReport.schEmpID.ViewValue = RsWrk("empName")
  657.                     Else
  658.                         askScheduleReport.schEmpID.ViewValue = askScheduleReport.schEmpID.CurrentValue
  659.                     End If
  660.                     Conn.CloseTempDataReader()
  661.                 Else
  662.                     askScheduleReport.schEmpID.ViewValue = System.DBNull.Value
  663.                 End If
  664.                 askScheduleReport.schEmpID.CssStyle = ""
  665.                 askScheduleReport.schEmpID.CssClass = ""
  666.                 askScheduleReport.schEmpID.ViewCustomAttributes = ""
  667.  
  668.                 ' schPosID
  669.                 If ew_NotEmpty(askScheduleReport.schPosID.CurrentValue) Then
  670.                     sSqlWrk = "SELECT [posDescription] FROM [tblPositions] WHERE [posID] = " & ew_AdjustSql(askScheduleReport.schPosID.CurrentValue) & " AND [posIsActive]=True"
  671.                     sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  672.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  673.                     If RsWrk.Read() Then
  674.                         askScheduleReport.schPosID.ViewValue = RsWrk("posDescription")
  675.                     Else
  676.                         askScheduleReport.schPosID.ViewValue = askScheduleReport.schPosID.CurrentValue
  677.                     End If
  678.                     Conn.CloseTempDataReader()
  679.                 Else
  680.                     askScheduleReport.schPosID.ViewValue = System.DBNull.Value
  681.                 End If
  682.                 askScheduleReport.schPosID.CssStyle = ""
  683.                 askScheduleReport.schPosID.CssClass = ""
  684.                 askScheduleReport.schPosID.ViewCustomAttributes = ""
  685.  
  686.                 ' schTypID
  687.                 If ew_NotEmpty(askScheduleReport.schTypID.CurrentValue) Then
  688.                     sSqlWrk = "SELECT [typDescription] FROM [tblTypes] WHERE [typID] = " & ew_AdjustSql(askScheduleReport.schTypID.CurrentValue) & " AND [typIsActive]=True"
  689.                     sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  690.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  691.                     If RsWrk.Read() Then
  692.                         askScheduleReport.schTypID.ViewValue = RsWrk("typDescription")
  693.                     Else
  694.                         askScheduleReport.schTypID.ViewValue = askScheduleReport.schTypID.CurrentValue
  695.                     End If
  696.                     Conn.CloseTempDataReader()
  697.                 Else
  698.                     askScheduleReport.schTypID.ViewValue = System.DBNull.Value
  699.                 End If
  700.                 askScheduleReport.schTypID.CssStyle = ""
  701.                 askScheduleReport.schTypID.CssClass = ""
  702.                 askScheduleReport.schTypID.ViewCustomAttributes = ""
  703.  
  704.                 ' schDepID
  705.                 If ew_NotEmpty(askScheduleReport.schDepID.CurrentValue) Then
  706.                     sSqlWrk = "SELECT [depAcctCode], [depDescription] FROM [tblDepartments] WHERE [depID] = " & ew_AdjustSql(askScheduleReport.schDepID.CurrentValue) & " AND [depIsActive]=True"
  707.                     sSqlWrk = sSqlWrk & " ORDER BY [depDescription] "
  708.                     RsWrk = Conn.GetTempDataReader(sSqlWrk)
  709.                     If RsWrk.Read() Then
  710.                         askScheduleReport.schDepID.ViewValue = RsWrk("depAcctCode")
  711.                         askScheduleReport.schDepID.ViewValue = askScheduleReport.schDepID.ViewValue & ew_ValueSeparator(0) & RsWrk("depDescription")
  712.                     Else
  713.                         askScheduleReport.schDepID.ViewValue = askScheduleReport.schDepID.CurrentValue
  714.                     End If
  715.                     Conn.CloseTempDataReader()
  716.                 Else
  717.                     askScheduleReport.schDepID.ViewValue = System.DBNull.Value
  718.                 End If
  719.                 askScheduleReport.schDepID.CssStyle = ""
  720.                 askScheduleReport.schDepID.CssClass = ""
  721.                 askScheduleReport.schDepID.ViewCustomAttributes = ""
  722.  
  723.                 ' schNotes
  724.                 askScheduleReport.schNotes.ViewValue = askScheduleReport.schNotes.CurrentValue
  725.                 askScheduleReport.schNotes.CssStyle = ""
  726.                 askScheduleReport.schNotes.CssClass = ""
  727.                 askScheduleReport.schNotes.ViewCustomAttributes = ""
  728.  
  729.  
  730.                 ' View refer script
  731.                 ' schDate
  732.  
  733.                 askScheduleReport.schDate.HrefValue = ""
  734.  
  735.                 ' schEvtID
  736.                 askScheduleReport.schEvtID.HrefValue = ""
  737.  
  738.                 ' schPartsID
  739.                 askScheduleReport.schPartsID.HrefValue = ""
  740.  
  741.                 ' schCallTime
  742.                 askScheduleReport.schCallTime.HrefValue = ""
  743.  
  744.                 ' schStartTime
  745.                 askScheduleReport.schStartTime.HrefValue = ""
  746.  
  747.                 ' schEndTime
  748.                 askScheduleReport.schEndTime.HrefValue = ""
  749.  
  750.                 ' schOutTime
  751.                 askScheduleReport.schOutTime.HrefValue = ""
  752.  
  753.                 ' schLocID
  754.                 askScheduleReport.schLocID.HrefValue = ""
  755.  
  756.                 ' schEmpID
  757.                 askScheduleReport.schEmpID.HrefValue = ""
  758.  
  759.                 ' schPosID
  760.                 askScheduleReport.schPosID.HrefValue = ""
  761.  
  762.                 ' schTypID
  763.                 askScheduleReport.schTypID.HrefValue = ""
  764.  
  765.                 ' schDepID
  766.                 askScheduleReport.schDepID.HrefValue = ""
  767.  
  768.                 ' schNotes
  769.                 askScheduleReport.schNotes.HrefValue = ""
  770.  
  771.                 '
  772.                 '  Search Row
  773.                 '
  774.  
  775.             ElseIf askScheduleReport.RowType = EW_ROWTYPE_SEARCH Then ' Search row
  776.  
  777.                 ' schDate
  778.                 askScheduleReport.schDate.EditCustomAttributes = ""
  779.                 askScheduleReport.schDate.EditValue = askScheduleReport.schDate.AdvancedSearch.SearchValue
  780.                 askScheduleReport.schDate.EditCustomAttributes = ""
  781.                 askScheduleReport.schDate.EditValue2 = askScheduleReport.schDate.AdvancedSearch.SearchValue2
  782.  
  783.                 ' schEvtID
  784.                 askScheduleReport.schEvtID.EditCustomAttributes = ""
  785.                 sSqlWrk = "SELECT [evtID], [evtDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblEvents]"
  786.                 sWhereWrk = "[evtIsActive]=True"
  787.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  788.                 sSqlWrk = sSqlWrk & " ORDER BY [evtDescription] "
  789.                 arwrk = Conn.GetRows(sSqlWrk)
  790.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  791.                 askScheduleReport.schEvtID.EditValue = arwrk
  792.  
  793.                 ' schPartsID
  794.                 askScheduleReport.schPartsID.EditCustomAttributes = ""
  795.                 sSqlWrk = "SELECT [prtID], [prtDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblParts]"
  796.                 sWhereWrk = "[prtIsActive]=True"
  797.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  798.                 sSqlWrk = sSqlWrk & " ORDER BY [prtDescription] "
  799.                 arwrk = Conn.GetRows(sSqlWrk)
  800.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  801.                 askScheduleReport.schPartsID.EditValue = arwrk
  802.  
  803.                 ' schCallTime
  804.                 askScheduleReport.schCallTime.EditCustomAttributes = ""
  805.                 askScheduleReport.schCallTime.EditValue = ew_FormatDateTime(askScheduleReport.schCallTime.CurrentValue, 14)
  806.  
  807.                 ' schStartTime
  808.                 askScheduleReport.schStartTime.EditCustomAttributes = ""
  809.                 askScheduleReport.schStartTime.EditValue = ew_FormatDateTime(askScheduleReport.schStartTime.CurrentValue, 14)
  810.  
  811.                 ' schEndTime
  812.                 askScheduleReport.schEndTime.EditCustomAttributes = ""
  813.                 askScheduleReport.schEndTime.EditValue = ew_FormatDateTime(askScheduleReport.schEndTime.CurrentValue, 14)
  814.  
  815.                 ' schOutTime
  816.                 askScheduleReport.schOutTime.EditCustomAttributes = ""
  817.                 askScheduleReport.schOutTime.EditValue = ew_FormatDateTime(askScheduleReport.schOutTime.CurrentValue, 14)
  818.  
  819.                 ' schLocID
  820.                 askScheduleReport.schLocID.EditCustomAttributes = ""
  821.                 sSqlWrk = "SELECT [locID], [locDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblLocations]"
  822.                 sWhereWrk = "[locIsActive]=True"
  823.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  824.                 sSqlWrk = sSqlWrk & " ORDER BY [locDescription] "
  825.                 arwrk = Conn.GetRows(sSqlWrk)
  826.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  827.                 askScheduleReport.schLocID.EditValue = arwrk
  828.  
  829.                 ' schEmpID
  830.                 askScheduleReport.schEmpID.EditCustomAttributes = ""
  831.                 sSqlWrk = "SELECT [empID], [empName], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblEmployees]"
  832.                 sWhereWrk = "[empIsActive]=True"
  833.                 sWhereWrk = tblEmployees.AddUserIDFilter(sWhereWrk)
  834.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  835.                 sSqlWrk = sSqlWrk & " ORDER BY [empFirstName] "
  836.                 arwrk = Conn.GetRows(sSqlWrk)
  837.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  838.                 askScheduleReport.schEmpID.EditValue = arwrk
  839.  
  840.                 ' schPosID
  841.                 askScheduleReport.schPosID.EditCustomAttributes = ""
  842.                 sSqlWrk = "SELECT [posID], [posDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblPositions]"
  843.                 sWhereWrk = "[posIsActive]=True"
  844.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  845.                 sSqlWrk = sSqlWrk & " ORDER BY [posDescription] "
  846.                 arwrk = Conn.GetRows(sSqlWrk)
  847.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  848.                 askScheduleReport.schPosID.EditValue = arwrk
  849.  
  850.                 ' schTypID
  851.                 askScheduleReport.schTypID.EditCustomAttributes = ""
  852.                 sSqlWrk = "SELECT [typID], [typDescription], '' AS Disp2Fld, '' AS SelectFilterFld FROM [tblTypes]"
  853.                 sWhereWrk = "[typIsActive]=True"
  854.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  855.                 sSqlWrk = sSqlWrk & " ORDER BY [typDescription] "
  856.                 arwrk = Conn.GetRows(sSqlWrk)
  857.                 arwrk.Insert(0, New Object() {"", "Please Select"})
  858.                 askScheduleReport.schTypID.EditValue = arwrk
  859.  
  860.                 ' schDepID
  861.                 askScheduleReport.schDepID.EditCustomAttributes = ""
  862.                 sSqlWrk = "SELECT [depID], [depAcctCode], [depDescription], '' AS SelectFilterFld FROM [tblDepartments]"
  863.                 sWhereWrk = "[depIsActive]=True"
  864.                 If sWhereWrk <> "" Then sSqlWrk = sSqlWrk & " WHERE " & sWhereWrk
  865.                 sSqlWrk = sSqlWrk & " ORDER BY [depDescription] "
  866.                 arwrk = Conn.GetRows(sSqlWrk)
  867.                 arwrk.Insert(0, New Object() {"", "Please Select", ""})
  868.                 askScheduleReport.schDepID.EditValue = arwrk
  869.  
  870.                 ' schNotes
  871.                 askScheduleReport.schNotes.EditCustomAttributes = ""
  872.                 askScheduleReport.schNotes.EditValue = askScheduleReport.schNotes
  873.  
  874.             End If
  875.  
  876.             ' Row Rendered event
  877.             askScheduleReport.Row_Rendered()
  878.         End Sub
  879.         ' Page Load event
  880.         Public Sub Page_Load()
  881.  
  882.             'HttpContext.Current.Response.Write("Page Load")
  883.         End Sub
  884.  
  885.         ' Page Unload event
  886.         Public Sub Page_Unload()
  887.  
  888.             'HttpContext.Current.Response.Write("Page Unload")
  889.         End Sub
  890.  
  891.         ' Form Custom Validate event
  892.         'Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  893.  
  894.         '    'Return error message in CustomError
  895.         '    Return True
  896.         'End Function
  897.  
  898.         Function ValidateTimes(ByRef tmpCallTime As String, ByRef tmpStartTime As String, ByRef tmpEndtime As String, ByRef tmpOutTime As String) As Boolean
  899.  
  900.             ' Initialize
  901.             ParentPage.gsFormError = ""
  902.  
  903.             Dim tlc As New AspNetMaker7_tfpssnet
  904.             tlc.tlcCheckTime(tmpCallTime)
  905.             tlc.tlcCheckTime(tmpStartTime)
  906.             tlc.tlcCheckTime(tmpEndtime)
  907.             tlc.tlcCheckTime(tmpOutTime)
  908.  
  909.             If Not ew_CheckTime(tmpCallTime) Then
  910.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  911.                 ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Call Time"
  912.             End If
  913.             If Not ew_CheckTime(tmpStartTime) Then
  914.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  915.                 ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Start Time"
  916.             End If
  917.             If Not ew_CheckTime(tmpEndtime) Then
  918.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  919.                 ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - End Time"
  920.             End If
  921.             If Not ew_CheckTime(tmpOutTime) Then
  922.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  923.                 ParentPage.gsFormError = ParentPage.gsFormError & "Incorrect time (hh:mm:ss) - Out Time"
  924.             End If
  925.  
  926.             ' Return validate result
  927.             Dim Valid As Boolean = (ParentPage.gsFormError = "")
  928.  
  929.             ' Form_CustomValidate event
  930.             Dim sFormCustomError As String = ""
  931.             '            Valid = Valid And Form_CustomValidate(sFormCustomError)
  932.             If sFormCustomError <> "" Then
  933.                 If ParentPage.gsFormError <> "" Then ParentPage.gsFormError = ParentPage.gsFormError & "<br />"
  934.                 ParentPage.gsFormError = ParentPage.gsFormError & sFormCustomError
  935.             End If
  936.             Return Valid
  937.         End Function
  938.  
  939.     End Class
  940.  
  941.     '
  942.     ' ASP.NET Page_Load event
  943.     '
  944.  
  945.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  946.         Response.Buffer = EW_RESPONSE_BUFFER
  947.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  948.  
  949.         ' Page init
  950.         askScheduleRecurring_form = New caskScheduleRecurring_form(Me)
  951.         askScheduleRecurring_form.Page_Init()
  952.  
  953.         ' Page main processing
  954.         askScheduleRecurring_form.Page_Main()
  955.     End Sub
  956.  
  957.     '
  958.     ' ASP.NET Page_Unload event
  959.     '
  960.  
  961.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  962.  
  963.         ' Dispose page object
  964.         If askScheduleRecurring_form IsNot Nothing Then askScheduleRecurring_form.Dispose()
  965.     End Sub
  966. End Class
  967.