Manipulating Batch
In this example, we will create a batch from an existing batch template and then add rows to the new batch using an Infinity Web API.
The source code for this example can be found here: BatchWebAPISample.
First, we need to create the new custom client application in the form of a .NET win form application. This custom application elicits the help of the Blackbaud.AppFx.WebAPI.dll. This assembly is a wrapper around the Blackbaud AppFx Web Service (AppFxWebService.asmx).
Figure: Make a reference to the Blackbaud.AppFx.WebAPI.dll assembly within our client project eases access to the AppFxWebSerice.asmx web service
To create the WinForm project, we can utilize the Web API Client Template that comes with the Infinity SDK. This template helps you to jump start a project by automatically creating a reference to Blackbaud.AppFx.WebApi, Blackbaud.AppFx.XMLTypes, Blackbaud.AppFx.dll, among others.
Figure: Select the Web API Client template
The project template stubs out some code within a Module1.vb and also makes references to some assemblies that we do not need for our sample.
Figure: Clean the unnecessary assembly references
I made the following changes to the newly created project:
-
Remove the reference to the Blackbaud.AppFx.UIModeling.DataFormWebHost assembly.
-
Comment out or remove the Imports statement that points to the DataFormWebHost namespace.
-
Comment out or remove the ShowDataFormExample(), ShowSearchExample(), and WebApiExample() procedures within Module1.vb.
-
Within Module1.vb, remove the following constants that point to the correct Infinity application. We will add these to a new BatchHelper.vb class file later in this example.
-
serviceUrlBasePath
-
databaseName
-
applicationTitle
-
-
Add a new Windows Form to the solution. I use the default name of "Form1."
-
Modify the Main() procedure within Module1.vb to open Form1.
-
Modify the startup object within the application's properties.
-
Change the application type to Windows Forms Application
-
Utilize the Sub Main as the startup object which will cause our Form1 to display when the application starts. See below.
Imports Blackbaud.AppFx.XmlTypes 'Imports Blackbaud.AppFx.UIModeling.DataFormWebHost Module Module1 Sub Main() Dim Form1 As New Form1 Form1.ShowDialog() End Sub End Module
Figure: Change the application type