tblSchedule.CurrentAction = ObjForm.GetValue("a_add") ' Get form action
LoadFormValues() ' Load form values
' Validate Form
If Not ValidateForm() Then
tblSchedule.CurrentAction = "I" ' Form error, reset action
Message = ParentPage.gsFormError
End If
' Not post back
Else
If bCopy Then
tblSchedule.CurrentAction = "C" ' Copy Record
Else
tblSchedule.CurrentAction = "I" ' Display Blank Record
If ew_Get("reload") = "Y" Then
tlcLoadFormValues()
Else
LoadDefaultValues() ' Load default values
End If
End If
End If
' Perform action based on action code
Select Case tblSchedule.CurrentAction
Case "I" ' Blank record, no action required
Case "C" ' Copy an existing record
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
ew_Session("CopyRecord") = "True"
Case "A" ' Add new record
tblSchedule.SendEmail = False ' Send email on add success
If AddRow() Then ' Add successful
Message = "Add succeeded" ' Set up success message
UpdateCalendarEntry()
Dim sReturnUrl As String = tblSchedule.ReturnUrl
'Page_Terminate(sReturnUrl) ' Clean up and return
tlcSaveItems()
If ew_Session("CopyRecord") = "True" Then
ew_Session("CopyRecord") = ""
Page_Terminate(sReturnUrl) ' Clean up and return
Else
Page_Terminate("tblScheduleAdd.aspx?reload=Y")
End If
Else
RestoreFormValues() ' Add failed, restore form values
End If
End Select
' Render row based on row type
tblSchedule.RowType = EW_ROWTYPE_ADD ' Render add type
' Render row
RenderRow()
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
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)