p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   .NET 4 and Visual Studio 2010 General Discussions (http://p2p.wrox.com/forumdisplay.php?f=579)
-   -   How do I end CaseParty.Get process and add message" (http://p2p.wrox.com/showthread.php?t=99114)

winkimjr2 August 1st, 2016 04:40 PM

How do I end CaseParty.Get process and add message"
 
What I am trying to do is end the CaseParty.Get process when the original @ID is not found. This means it is not found because it was changed.
Also inside the objCaseParty, I want to add a display message "Original party no longer exist on the case.

In my xml document the original CaseParty/@ID was 854 but because this CasePartyName was changed the new CasePArty/@ID is 243. This causes an excelption which is what I want to avoid.
How do I do this?

Here is the CaseParty.Get object I want to make the changes
Code:

objCaseParty = Msc.Integration.Mncis.Library.v4.CaseParty.Get(CInt(aobjXmlInputDoc.DocumentElement.SelectSingleNode("Case/CaseParty[Connection/@BaseConnection='DF']/@ID").InnerText), strCaseNumber, True)
Right now I am getting an Exception "Unknown party for provided case" from running CaseParty.Get process because my xml document original CaseParty (@ID) has been changed.
So this means the original CaseParty.@ID no longer exist.
For that reason, instead of getting an Exception, I want to end CaseParty.Get process. I also want to display text message "The original party (MNCIS Parking) that triggered the NameGet process is no longer on the case."

vb.net sub
Code:

Option Strict On
Option Explicit On
Imports System.Xml
Imports System.Collections.Generic

Public Class BcaNameGet

    Shared Sub main()
        Dim objMessageProcessor As New MessageProcessor
        objMessageProcessor.ProcessInputQueue(False, False)

    End Sub

    Private Class MessageProcessor : Inherits Msc.Integration.MessageBroker.Library.v4.XmlMessageProcessor

        Protected Overrides Sub ProcessMessage(ByRef aobjBroker As MessageBroker.Library.v4.Broker, ByRef aobjXmlInputDoc As System.Xml.XmlDocument, ByRef aobjInstantiatedObjectsCollection As Microsoft.VisualBasic.Collection)
            MyBase.ProcessMessage(aobjBroker, aobjXmlInputDoc, aobjInstantiatedObjectsCollection)
            Dim objSimpleType As Msc.Integration.CourtXml.Library.v4.SimpleType = CType(aobjInstantiatedObjectsCollection.Item("SIMPLETYPE"), Msc.Integration.CourtXml.Library.v4.SimpleType)

            Dim strCitationNumber As String = aobjXmlInputDoc.DocumentElement.SelectSingleNode("Citation/CitationNumber").InnerText
            Dim strIssuingAgency As String = aobjXmlInputDoc.DocumentElement.SelectSingleNode("Citation/Agency/@Word").InnerText
            Dim blnWasEFiled As Boolean = Msc.Integration.Mncis.Library.v4.Citation.WasEFiled(strCitationNumber, strIssuingAgency, True)
            Dim strCaseNumber As String = aobjXmlInputDoc.DocumentElement.SelectSingleNode("Case/CaseNumber").InnerText

            Dim objXmlPersonNameNode As XmlNode = aobjXmlInputDoc.DocumentElement.SelectSingleNode("Case/CaseParty[Connection/@BaseConnection='DF']/CasePartyName")
            Dim objCaseParty As Msc.Integration.Mncis.Library.v4.CaseParty
            Dim objBusinessName As Msc.Integration.Mncis.Library.v4.BusinessName
            Dim objPersonName As Msc.Integration.Mncis.Library.v4.PersonName
            Dim objNickname As Msc.Integration.Mncis.Library.v4.Nickname
            Dim strUser As String = aobjXmlInputDoc.DocumentElement.SelectSingleNode("ControlPoint/@UserID").InnerText
            Dim blnNoRetry As Boolean = False

            'Get the existing party and update with registration name
            objCaseParty = Msc.Integration.Mncis.Library.v4.CaseParty.Get(CInt(aobjXmlInputDoc.DocumentElement.SelectSingleNode("Case/CaseParty[Connection/@BaseConnection='DF']/@ID").InnerText), strCaseNumber, True)
            If objVehicleRegistration.BusinessName.Length > 0 Then
                objBusinessName = New Msc.Integration.Mncis.Library.v4.BusinessName
                objBusinessName.BusinessName = objVehicleRegistration.BusinessName
                objBusinessName.IsCurrent = True
                objCaseParty.AddCasePartyName(CType(objBusinessName, Msc.Integration.Mncis.Library.v4.IName), , True)
            Else
                If objVehicleRegistration.PersonFirstName.Length > 0 Then
                    objPersonName = New Msc.Integration.Mncis.Library.v4.PersonName
                    objPersonName.First = objVehicleRegistration.PersonFirstName
                    objPersonName.Last = objVehicleRegistration.PersonLastName
                    objPersonName.Middle = objVehicleRegistration.PersonMiddleName
                    objPersonName.IsCurrent = True
                    objCaseParty.AddCasePartyName(CType(objPersonName, Msc.Integration.Mncis.Library.v4.IName), , True)
                Else
                    objNickname = New Msc.Integration.Mncis.Library.v4.Nickname
                    objNickname.Nickname = objVehicleRegistration.PersonLastName
                    objNickname.IsCurrent = True
                    objCaseParty.AddCasePartyName(CType(objNickname, Msc.Integration.Mncis.Library.v4.IName), , True)
                End If
                objCaseParty.Party.CurrentDateOfBirth = objVehicleRegistration.PersonBirthDate
            End If
        End Sub
    End Class
End Class

xml document
Code:

<Integration>
        <ControlPoint Timestamp="7/28/2016 11:20:49 AM" UserID="Nope">SAVE-CR-CASE</ControlPoint>
        <Case InternalID="685" ID="14870882" Op="A" xmlns:user="http://tylertechnologies.com">
                <CaseNumber>426</CaseNumber>
                <Court/>
                <CaseParty Op="A" ID="854">
                        <Connection Op="A" Word="JRD" BaseConnection="PL" ID="684">
                                <Description>Jurisdiction</Description>
                                <TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
                                <DateAdded Op="A">07/28/2016</DateAdded>
                                <RemovedDate Op="A"/>
                                <RemovedReason Op="A" Word=""/>
                                <Comment Op="A"/>
                        </Connection>
                        <CasePartyName Op="A" Current="true" ID="54441" InternalNameID="570">
                                <CasePartyNameType Op="A" Word=""/>
                                <NameType>Business</NameType>
                                <NameLast>State of Minnesota</NameLast>
                                <FormattedName>State of Minnesota</FormattedName>
                        </CasePartyName>
                        <TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
                </CaseParty>
                <CaseParty Op="A" ID="243">
                        <SendNotice Op="A">true</SendNotice>
                        <RestrictView Op="A">false</RestrictView>
                        <Connection Op="A" Word="DFD" BaseConnection="DF" ID="44919685" InternalCasePartyConnectionID="1651126621">
                                <Description>Defendant</Description>
                                <TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
                                <DateAdded Op="A">07/28/2016</DateAdded>
                                <RemovedDate Op="A"/>
                                <RemovedReason Op="A" Word=""/>
                                <Comment Op="A"/>
                        </Connection>
                        <CasePartyName Op="A" Current="true" ID="12121330" InternalNameID="1618922645">
                                <CasePartyNameType Op="A" Word=""/>
                                <NameType>Standard</NameType>
                                <NameFirst>MNCIS</NameFirst>
                                <NameLast>Parking</NameLast>
                                <FormattedName>Parking, MNCIS</FormattedName>
                        </CasePartyName>
                        <TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
                </CaseParty>
        </Case>
        <Citation Op="A" ID="679" xmlns:user="http://tylertechnologies.com">
                <CitationNumber Op="A">549</CitationNumber>
                <CaseTypeKey Op="A" Word="CRM">Crim/Traf Mandatory</CaseTypeKey>
                <Agency Op="A" Word="MN0270300">Brooklyn Park Police Department</Agency>
                <OffenseDate Op="A">07/18/2016</OffenseDate>
                <Vehicle Op="A">
                        <VehicleLicensePlateState Op="A">MN</VehicleLicensePlateState>
                        <VehicleLicensePlateNumber Op="A">348MAR</VehicleLicensePlateNumber>
                </Vehicle>
        </Citation>
</Integration>


winkimjr2 August 3rd, 2016 09:41 AM

I have resolved this one using Try Catch Exit sub.


All times are GMT -4. The time now is 07:10 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.