Created
July 14, 2010 20:27
-
-
Save KevM/476016 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports FChoice.Foundation.Clarify | |
Imports System.Collections.Specialized | |
Imports FChoice.Foundation | |
Imports FChoice.Foundation.Clarify.Workflow | |
Imports NUnit.Framework | |
Module SDKExample | |
<TestFixture()> Public Class SDK_test | |
<Test()> Public Sub update_case_title() | |
InitializeDovetailSDK() | |
UseGenericToUpdateExistingCaseTitle("1", "new title") | |
End Sub | |
End Class | |
Sub InitializeDovetailSDK() | |
Dim config As New NameValueCollection | |
'notice that these are hard coded database credentials. More typically you'd use application configuration | |
config.Add("fchoice.dbtype", "mssql") | |
config.Add("fchoice.connectionstring", "Data Source=.; Initial Catalog=SDKcl125_2k5; User Id=sa; Password=sa;") | |
ClarifyApplication.Initialize(config) | |
End Sub | |
Function CreateSession() As ClarifySession | |
Return ClarifyApplication.Instance.CreateSession("sa", "sa", ClarifyLoginType.User) | |
End Function | |
Function CreateDataSet() As ClarifyDataSet | |
Return New ClarifyDataSet(CreateSession()) | |
End Function | |
Sub UseGenericToUpdateExistingCaseTitle(ByVal caseId As String, ByVal title As String) | |
Dim dataset As ClarifyDataSet = CreateDataSet() | |
Dim caseGeneric As ClarifyGeneric | |
caseGeneric = dataset.CreateGeneric("case") | |
caseGeneric.AppendFilter("id_number", StringOps.Equals, caseId) | |
caseGeneric.Query() | |
If caseGeneric.Rows.Count < 1 Then | |
Throw New ApplicationException(String.Format("Case {0} was not found.", caseId)) | |
End If | |
caseGeneric.Rows(0)("title") = title | |
dataset.Update(caseGeneric) | |
End Sub | |
Sub DispatchCustomWorflowObject(ByVal id As String, ByVal objectName As String, ByVal queue As String) | |
Dim workflowManager As New WorkflowManager(CreateDataSet()) | |
Dim workFlowInfo As WorkFlowInfo = workflowManager.Dispatch(id, objectName, queue, DateTime.Now, "sa", False) | |
End Sub | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment