If sFilter.EndsWith(" AND ") Then sFilter = sFilter.Substring(0, sFilter.Length - 5) & ") OR "
Next
If sFilter.EndsWith(" OR ") Then sFilter = sFilter.Substring(0, sFilter.Length - 4)
' Set up filter (SQL WHERE clause)
' SQL constructor in tblSchedule class, tblScheduleinfo.aspx
tblSchedule.CurrentFilter = sFilter
' Get action
If ew_Post("a_delete") <> "" Then
tblSchedule.CurrentAction = ew_Post("a_delete")
Else
tblSchedule.CurrentAction = "I" ' Display record
End If
Select Case tblSchedule.CurrentAction
Case "D" ' Delete
tblSchedule.SendEmail = False ' Send email on delete success
UpdateCalendarEntry()
If DeleteRows() Then ' delete rows
Message = "Delete succeeded" ' Set up success message
Page_Terminate(tblSchedule.ReturnUrl) ' Return to caller
End If
End Select
End Sub
Sub UpdateCalendarEntry()
'Dim service As New ExchangeService(requestedServerVersion:=ExchangeVersion.Exchange2010)
Dim service As New ExchangeService(ExchangeVersion.Exchange2010_SP1)
Dim tmpSchDate As Date, tmpEvtDescription As String, tmpPrtDescription As String, tmpCallTime As Date
Dim tmpStartTime As Date, tmpEndTime As Date, tmpOutTime As Date, tmpLocDescription As String, tmpPosDescription As String, tmpStDescription As String
Dim tmpTypDescription As String, tmpEmpName As String, tmpEmail As String, tmpBody As String, tmpAction As String = "", tmpStatus As String, tmpType As String, tmpNotes As String
Dim intResult As Integer, tmpMessage As String, tmpNewStatus As String, smtpStatus As Boolean, smtpMessage As String
Dim findResults As FindItemsResults(Of Appointment) = service.FindAppointments(WellKnownFolderName.Calendar, New CalendarView(tmpSchDate, tmpSchDate.AddHours(24)))
Dim items As New List(Of Item)()
For Each appointment As Appointment In findResults
If Appointment.Subject = tmpEvtDescription & " - " & tmpPrtDescription Or Appointment.Subject = tmpEvtDescription Then
Appointment.Delete(DeleteMode.HardDelete)
Message = "Old EWS Appointment deleted from Outlook calendar."
End If
End If
Next
End If
End If
Catch ex As Exception
Message = ex.Message
End Try
End Sub
Private Function ValidateCertificate(ByVal sender As Object, ByVal certificate As X509Certificate, ByVal chain As X509Chain, ByVal sslPolicyErrors As SslPolicyErrors) As Boolean
'Return True to force the certificate to be accepted.
Return True
End Function
Private Shared Function RedirectionUrlValaditionCallBack(ByVal redirectionURL As String) As Boolean
Dim result As Boolean = False
Dim redirectionuri As New Uri(redirectionURL)
If redirectionuri.Scheme = "https" Then
result = True
End If
Return result
End Function
'
' Function DeleteRows
' - Delete Records based on current filter
'
Function DeleteRows() As Boolean
Dim sKey As String, sThisKey As String, sKeyFld As String
Dim arKeyFlds() As String
Dim RsDelete As OleDbDataReader = Nothing
Dim sSql As String, sWrkFilter As String
Dim RsOld As ArrayList
DeleteRows = True
sWrkFilter = tblSchedule.CurrentFilter
' Set up filter (SQL WHERE Clause)
' SQL constructor in tblSchedule class, tblScheduleinfo.aspx
tblSchedule.CurrentFilter = sWrkFilter
sSql = tblSchedule.SQL
Conn.BeginTrans() ' Begin transaction
Try
RsDelete = Conn.GetDataReader(sSql)
If Not RsDelete.HasRows Then
Message = "No records found" ' No record found
RsDelete.Close()
RsDelete.Dispose()
Return False
End If
Catch e As Exception
If EW_DEBUG_ENABLED Then Throw
Message = e.Message
Return False
End Try
' Clone old rows
RsOld = Conn.GetRows(RsDelete)
RsDelete.Close()
RsDelete.Dispose()
' Call Row_Deleting event
If DeleteRows Then
For Each Row As OrderedDictionary in RsOld
DeleteRows = tblSchedule.Row_Deleting(Row)
If Not DeleteRows Then Exit For
Next Row
End If
If DeleteRows Then
sKey = ""
For Each Row As OrderedDictionary in RsOld
sThisKey = ""
If sThisKey <> "" Then sThisKey = sThisKey & EW_COMPOSITE_KEY_SEPARATOR