Once a connection has been established and a method returned a session ID to the program you can use that session id for subsequent calls:

<VisionConnInfo>
<SessionID>Session ID returned by the previous call</SessionID>
</VisionConnInfo>

Test connection

Create GetSystemInfo code

Add Unit Test project

Add a reference to the main project

Copy <system.serviceModel> from web.config of main app to app.config of unit test app

Add unit test code

Debug and check result

Available methods and schemas

Method and schema information

You can find a list of available methods

in the PDF documentation “DeltekVisionXtend76WebServicesAPI.pdf”

in the list displayed by the browser if you go to http:///vision/vision WS.asmx

in the Visual Studio Object Browser when you go to your new Namespace “VisionAPI”

The schema definitions for the API can be found on your application server: C:\Program Files (x86)\Deltek\Vision\Web\xsd

Each info center has a corresponding …_Schema.xsd file that can be opened in Visual Studio and checked for specific elements

Specific vs. generic methods

You can always choose specific read/write methods vs generic methods. With the generic methods you will have to pass the InfoCenter information but these give you more control over the returned data. We suggest to use the generic methods by default

Writing Data

SendDataToDeltekVision (generic): can insert or update all info centers

SendDataToDeltekVisionWithReturn (generic): This method provides the same functionality as SendDataToDeltekVision but also returns snapshots of the records after the updates

[InfoCenter] (specific): adds a record to the specific info center

Update[InfoCenter] (specific): updates a record in an info center

Deleting Data

DeleteRecords (generic): This deletes records from Info Centers.

Delete[InfoCenter] (specific): deletes a record from an Info Center

Reading Data

GetRecordsByKey (generic): retrieves records by a primary key

GetRecordsByQuery (generic): retrieves records based on a SQL select statement

Get[InfoCenter]ByKey (specific): retrieves records by key

Get[InfoCenter]ByQuery (specific): retrieves records by query

Specific vs. generic methods for UDICs

Deleting Data

DeleteUDIC (generic): This deletes records from a UDIC.

Reading Data

GetUDICByKey (generic): retrieves UDIC records by a primary key

GetUDICByQuery (generic): retrieves UDIC records using a query

Reading data from Vision

Sample “MVCApp_Phase2”

This is an extension to the MVC application we started with.

It adds project read functions to the VisionServices class and a project controller and views that display a list of recent projects (including detail views)

It also adds 2 models (ProjectInfo and ConnectionInfo) and also moves the connection info into the application’s settings so it is easier to manage

The following screenshots will guide you through the code for this

Models: ProjectInfo and ConnectionInfo

The ProjectInfo class is used to store and display limited project data

The ConnectionInfo class is used to load the connection details from the app settings and pass it into the service class

VisionServices: GetProjectByQuery

Sets the connection info

Calls the GetProjectsByQuery with a statement that must include select * from PR

Reads the returned XML document and creates a list of project info items from it

VisionServices: GetProjectByID

Similar to the ByQuery call but this uses one specific primary key to retrieve the data

Because the project table has a primary key with 3 fields, the key values must be passed accordingly

It will only look for the top level project

ProjectsController

Initializes the VisionServices class with the connection info from the app settings

Retrieves a list of the 50 newest regular projects in the database

Includes a function to retrieve a detail record by id (when clicked in the web form)

Writing data to Vision

Sample “MVCApp_Phase3”

This is an extension to MVCApp_Phase2.

It adds the SubLevel field to the project info class and returns it in the read functions. This is necessary because it is a required value for inserts and updates to projects

It adds the function SaveProjectInfo to the VisionServices class that creates an XDocument on the fly and passes it to the UpdateProject method of the API