viewSchedule.CurrentAction = ObjForm.GetValue("a_edit") ' Get action code
LoadFormValues() ' Get form values
' Validate Form
If Not ValidateForm() Then
viewSchedule.CurrentAction = "" ' Form error, reset action
Message = ParentPage.gsFormError
LoadRow() ' Restore row
RestoreFormValues() ' Restore form values if validate failed
End If
Else
viewSchedule.CurrentAction = "I" ' Default action is display
End If
' Check if valid key
If ew_Empty(viewSchedule.schSchID.CurrentValue) Then Page_Terminate("viewSchedulelist.aspx") ' Invalid key, return to list
Select Case viewSchedule.CurrentAction
Case "I" ' Get a record to display
If Not LoadRow() Then ' Load Record based on key
Message = "No records found" ' No record found
Page_Terminate("viewSchedulelist.aspx") ' No matching record, return to list
End If
Case "U" ' Update
viewSchedule.SendEmail = False ' Send email on update success
If EditRow() Then ' Update Record based on key
Message = "Update succeeded" ' Update success
UpdateCalendar()
Dim sReturnUrl As String = viewSchedule.ReturnUrl
Page_Terminate(sReturnUrl) ' Return to caller
Else
LoadRow() ' Restore row
RestoreFormValues() ' Restore form values if update failed
End If
End Select
' Render the record
viewSchedule.RowType = EW_ROWTYPE_EDIT ' Render as edit
' Render row
RenderRow()
End Sub
Sub UpdateCalendar()
'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
'see if it already exists - if so, delete and re-add
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
Message = "EWS Appointment added to Outlook calendar."
End If
End If
Catch ex As Exception
Message = ex.Message
End Try
End If
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