GoFundraise Customer Care


(Example) Page Creation Implementation

This is an example of a Page Creation implementation for the .NET Client Wrapper.


Dim bGFCreate As Boolean = True
    If IsDBNull(dbRdr("reg_dob")) Or IsDBNull(dbRdr("reg_tel_mob")) Then bGFCreate = False
    If bGFCreate Then 
        Dim chyID As String = "_"
        Dim dbConn2 As SqlConnection
        Dim dbCommand2 As SqlCommand
        Dim dbRdr2 As SqlDataReader
        dbConn2 = New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("db_application").ConnectionString)

        If Not IsDBNull(dbRdr("reg_chy_keyval")) Then
            dbCommand2 = New SqlCommand("regGetCharityDetails", dbConn2)
            dbCommand2.CommandType = CommandType.StoredProcedure
            dbCommand2.Parameters.Add(New SqlParameter("@chyKeyval", SqlDbType.Int)).Value = dbRdr("reg_chy_keyval")
            dbRdr2 = dbCommand2.ExecuteReader()
            If dbRdr2.Read() Then chyID = dbRdr2("chy_id")
            chyID = dbRdr("reg_chy_keyvals")
        End If

        If chyID <> "_" Then
            System.Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls Or Net.SecurityProtocolType.Tls11 Or Net.SecurityProtocolType.Tls12

            Dim client As GoFundraise.API.Client
            client = New GoFundraise.API.Client("https://api.gofundraise.com.au", "-x-x-x-x", "-x-x-x-x")

            Dim newPageInfo = New GoFundraise.API.CreatePageRequest With {
                .EventCampaignId = dbRdr("sto_fr_api_id"),
                .BeneficiaryAccountId = chyID,
                .EmailAddress = dbRdr("reg_email"),
                .FirstName = dbRdr("reg_first_name"),
                .LastName = dbRdr("reg_last_name"),
                .DateOfBirth = dbRdr("reg_date_of_birth")

            Dim pageCreatedResult = client.Pages.CreateFundraisingPage(newPageInfo)
            dbCommand2 = New SqlCommand("regSetCharityURL", dbConn2)
            dbCommand2.CommandType = CommandType.StoredProcedure
            dbCommand2.Parameters.Add(New SqlParameter("@regKeyval", SqlDbType.Int)).Value = dbRdr("reg_keyval")
            client = Nothing
        End If

        dbConn2 = Nothing
    End If

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request