Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

subroutine not returning to complete process

$
0
0

Hello,

I have a subroutine that I am calling that creates a vcs file for Outlook.  This process opens the vcs so that you can make changes to the calendar event.

The issue is that it is not continuing from there to complete the entire process.  I have added my code below:

Call of Subroutine:

'See what the value is changing to
        Select Case strStatus
            Case "SOLD"
                strPayType = ddlPayType.SelectedItem.Text
                strPolicyAmt = txtPolicyAmt.Text
                If IsDate(txtTPPSoldDate.Text) Then
                    strTPPSoldDate = txtTPPSoldDate.Text
                Else
                    strTPPSoldDate = dtDefault
                End If
                If ddlNewFamily.SelectedItem.Text = "Yes" Then
                    strNewFamily = -1
                Else
                    strNewFamily = 0
                End If
                If IsDate(txtSoldDate.Text) Then
                    strSoldDate = txtSoldDate.Text
                Else
                    strSoldDate = dtDefault
                End If
            Case "CALL BACK"
                strCallBack = txtCallBackDate.Text
                strStatus = "CALL BACK"
                If Session("HasOutlook") Then
                    CreateAppointmentUsingItemsAdd()
                End If
            Case "APPOINTMENT"
                strStatus = "APPOINTMENT"
                strAppt = txtApptDate.Text
                If Session("HasOutlook") Then
                    CreateAppointmentUsingItemsAdd()
                End If
        End Select

        If GetLetterDates(strStatus) = False Then
            GoTo sub_error
        End If

Subroutine:

Private Sub CreateAppointmentUsingItemsAdd()
        Dim outlookvcs As New System.Text.StringBuilder
        Dim subject As String
        Dim content As String
        Dim FromDate As Date

        ' SET SUBJECT HEADER
        subject = Session("Client") & " - " & Session("Status")

        ' SET CONTENT [use '=0D' to make outlook perform a line break]
        content = ""

        Select Case Session("Status")
            Case "APPOINTMENT"
                FromDate = Session("FromDate")
                FromDate = DateAdd(DateInterval.Day, 1, FromDate)
            Case "CALL BACK"
                FromDate = Session("FromDate")
                FromDate = DateAdd(DateInterval.Day, 1, FromDate)
        End Select

        With outlookvcs
            .Append("BEGIN:VCALENDAR" & vbLf)
            .Append("PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN" & vbLf)
            .Append("VERSION:1.0" & vbLf)
            .Append("BEGIN:VEVENT" & vbLf)
            .Append("DTSTART:" & str_outlookdate(FromDate) & "T" & str_outlooktime(FromDate) & "Z" & vbLf)
            .Append("DTEND:" & str_outlookdate(FromDate) & "T" & str_outlooktime(FromDate) & "Z" & vbLf)
            .Append("UID:1" & vbLf)
            .Append("DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & content & "=0A" & vbLf)
            .Append("SUMMARY;ENCODING=QUOTED-PRINTABLE:" & subject & vbLf)
            .Append("PRIORITY:3" & vbLf)
            .Append("END:VEVENT" & vbLf)
            .Append("END:VCALENDAR" & vbLf)
        End With

        Response.Clear()
        Response.ContentType = "text/calendar"
        Response.AddHeader("content-disposition", "attachment; filename=outlook_calendar_appointment.vcs")
        Response.Write(outlookvcs)
        Response.End()
    End Sub

I am not sure what I am doing wrong.

Thanks for your help in advance!!

Eddi Rae


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>