tblSchedule.CurrentAction = ObjForm.GetValue("a_edit") ' Get action code
LoadFormValues() ' Get form values
' Validate Form
If Not ValidateForm() Then
tblSchedule.CurrentAction = "" ' Form error, reset action
Message = ParentPage.gsFormError
LoadRow() ' Restore row
RestoreFormValues() ' Restore form values if validate failed
End If
Else
tblSchedule.CurrentAction = "I" ' Default action is display
End If
' Check if valid key
If ew_Empty(tblSchedule.schSchID.CurrentValue) Then Page_Terminate("tblSchedulelist.aspx") ' Invalid key, return to list
Select Case tblSchedule.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("tblSchedulelist.aspx") ' No matching record, return to list
End If
Case "U" ' Update
tblSchedule.SendEmail = False ' Send email on update success
Dim tmpRsOld As New OrderedDictionary, tmpRsNew As New OrderedDictionary
If EditRow(tmpRsOld, tmpRsNew) Then ' Update Record based on key
Message = "Update succeeded" ' Update success
UpdateCalendarEntry(tmpRsOld, tmpRsNew)
Dim sReturnUrl As String = tblSchedule.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
tblSchedule.RowType = EW_ROWTYPE_EDIT ' Render as edit
' Render row
RenderRow()
End Sub
Sub UpdateCalendarEntry(ByRef tmpRsOld As OrderedDictionary, ByVal tmpRsNew As OrderedDictionary)
'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
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 = "New EWS Appointment added to Outlook calendar."
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
tblSchedule.schDoubleBooked.SetDbValue((tblSchedule.schDoubleBooked.CurrentValue <> "" And Not IsDBNull(tblSchedule.schDoubleBooked.CurrentValue)), System.DBNull.Value)