Wrox Programmer Forums
.NET 4 and Visual Studio 2010 General Discussions For discussing anything about .NET 4, WPF, WCF, the rest of the .NET 4 Framework, and Visual Studio 2010 that isn't about a specific Wrox book. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET 4 and Visual Studio 2010 General Discussions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old August 1st, 2016, 04:40 PM
Friend of Wrox
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts
Default 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
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
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)
                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)
                    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
	<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">
		<CaseParty Op="A" ID="854">
			<Connection Op="A" Word="JRD" BaseConnection="PL" ID="684">
				<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"/>
			<CasePartyName Op="A" Current="true" ID="54441" InternalNameID="570">
				<CasePartyNameType Op="A" Word=""/>
				<NameLast>State of Minnesota</NameLast>
				<FormattedName>State of Minnesota</FormattedName>
			<TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
		<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">
				<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"/>
			<CasePartyName Op="A" Current="true" ID="12121330" InternalNameID="1618922645">
				<CasePartyNameType Op="A" Word=""/>
				<FormattedName>Parking, MNCIS</FormattedName>
			<TimestampCreate Op="A">7/28/2016 11:20:49 AM</TimestampCreate>
	<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>
Old August 3rd, 2016, 09:41 AM
Friend of Wrox
Join Date: Apr 2013
Posts: 101
Thanks: 14
Thanked 0 Times in 0 Posts

I have resolved this one using Try Catch Exit sub.

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to process "embedded2.xml" example with msxsl obmana BOOK: XSLT 2.0 and XPath 2.0 Programmer's Reference, 4th Edition ISBN: 978-0-470-19274-0 1 July 24th, 2012 08:03 AM
MSXSL gives error message for "for" inside "select" ilyaz XSLT 1 December 9th, 2010 05:02 PM
"No rule to process file" superherogeek BOOK: Beginning iPad Application Development 0 July 13th, 2010 01:06 PM
Add a CheckBox DataColumn to my DataGridView, Null format: "" or "True" but Error: F ismailc C# 2005 0 September 25th, 2009 04:56 AM
end process in task mgr bab02 Access 2 September 29th, 2006 06:46 AM

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