Using the Jiwa Assemblies from a .NET application  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

Using the Jiwa Assemblies from a .NET application

Postby jeromeh » Fri Jul 11, 2014 8:34 am

Hi MIke

I am converting our Jiwa 6.x code to Jiwa 7 for creating a sales orders and have used this little sample as a guide. However when I try and build my app I get
Error 304 'JiwaApplication' is not declared. It may be inaccessible due to its protection level.

I have included references to JiwaApplication and JiwaSales.

Also the line 'Dim jiwaApplicationManager As JiwaApplication.Manager' seems redundant as the variable is never used! Can you confirm if this does something to a static/shared object that makes it necessary?

Best regards
Jerome
jeromeh
Occasional Contributor
Occasional Contributor
 
Posts: 17
Joined: Wed Apr 08, 2009 9:53 am

Re: Using the Jiwa Assemblies from a .NET application

Postby Mike.Sheen » Fri Jul 11, 2014 1:12 pm

Hi Jerome,

jeromeh wrote:I get Error 304 'JiwaApplication' is not declared. It may be inaccessible due to its protection level.

I have retested the code posted previously and it works for me. Try adding references to the JiwaODBC Assembly - I found I needed to add that assembly (although the compiler told me that). I'm not familiar with "Error 304" - can you elaborate on your environment / platform ? Or even better provide a sample code fragment or project which demonstrates the issue ?

jeromeh wrote:Also the line 'Dim jiwaApplicationManager As JiwaApplication.Manager' seems redundant as the variable is never used! Can you confirm if this does something to a static/shared object that makes it necessary?


It's not used in the example, so it can be removed - I'd copied that snippet of code from an application which does refer to an instance. The JiwaApplication Manager class is a multiton, but can be treated like a singleton. The Jiwa.exe application uses it as a singleton, the Jiwa Web Services uses it as a multiton (an instance for each session) - so yes, it is a shared class.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Using the Jiwa Assemblies from a .NET application

Postby mribbons » Tue Sep 02, 2014 3:37 pm

I had to reference these assemblies to get the Manager.Instance.Logon() call to do anything:

Infragistics4.Shared.v13.1.dll
Infragistics4.Win.AppStylistSupport.v13.1.dll
Infragistics4.Win.v13.1.dll
JiwaApplication.dll
JiwaEncryption.dll
JiwaLib.dll
JiwaODBC.dll
JiwaSales.dll

Using Jiwa 7.00.78 and C#
Regards,
Mike Ribbons
Micro Pacific Pty Ltd
http://www.micropacific.com.au
mribbons
Occasional Contributor
Occasional Contributor
 
Posts: 13
Joined: Mon Sep 01, 2014 12:02 pm

Re: Using the Jiwa Assemblies from a .NET application

Postby perry » Wed Mar 25, 2015 5:12 pm

Hi Mike,

version: 7.0.115

I used codes below to create Sales Order outside Jiwa, however, salesOrder object doesn't have any custom fields that system has.
e.g.
salesOrder.CustomSettings.count = 0
I also found
JiwaApplication.Manager.Instance.PluginCollection.Count = 0

codes from my console app
Code: Select all
Module Module1

    Sub Main()
        SubmitOrder()
    End Sub

    Public Sub SubmitOrder()
        Try
            JiwaApplication.Manager.Instance.Logon("server", "jiwademo", JiwaFinancials.Jiwa.JiwaODBC.database.AuthenticationModes.JiwaAuthentication, "admin", "password")
            Dim salesOrder As JiwaSales.SalesOrder.SalesOrder = JiwaApplication.Manager.Instance.BusinessLogicFactory.CreateBusinessLogic(Of JiwaSales.SalesOrder.SalesOrder)(Nothing)

            '7 plugins enabled
            MsgBox(JiwaApplication.Manager.Instance.PluginCollection.Count)
            '2 sales order custom fields enabled
            MsgBox(salesOrder.CustomSettings.Count)

            JiwaApplication.Manager.Instance.LogOff()

        Catch ex As Exception

        Finally
            JiwaApplication.Manager.Instance.LogOff()
        End Try

    End Sub

End Module
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Using the Jiwa Assemblies from a .NET application

Postby Mike.Sheen » Wed Mar 25, 2015 6:36 pm

perry wrote:however, salesOrder object doesn't have any custom fields that system has.
e.g.
salesOrder.CustomSettings.count = 0
I also found
JiwaApplication.Manager.Instance.PluginCollection.Count = 0


Hi Perry,

Either you are connecting to the wrong database, or the plugins threw an exception on compile during login and the exception policy for those plugins was ignore. Your code example shows no handling of the exception in your try catch finally block - do you get an exception? Can you put something in your catch to indicate if an exception did occur.

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Using the Jiwa Assemblies from a .NET application

Postby perry » Thu Mar 26, 2015 2:32 pm

Hi Mike,

It didn't throw an error. I'm also 100% sure we are connecting to the right database.

There are other codes which I didn't include in my post, which allow us the save the order.
We can see the order sitting in correct database, everything we checked are fine except no custom values are saved.

I will see if we can replicate the same issue on a demo database today.
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Using the Jiwa Assemblies from a .NET application

Postby perry » Fri Mar 27, 2015 11:12 am

Hi Mike,

We tried on demo (7.0.115) database and it only loaded 4 plugins out of 10+ enabled plugins.

Below plugins loaded,
    ? JiwaApplication.Manager.Instance.PluginCollection(1).Name
    "Custom Search - Email"
    ? JiwaApplication.Manager.Instance.PluginCollection(4).Name
    "Web Browser"
    ? JiwaApplication.Manager.Instance.PluginCollection(2).Name
    "Journal Set Copy Reference"
    ? JiwaApplication.Manager.Instance.PluginCollection(3).Name
    "Launch App"

attached, plugin with custom fields which didn't load after login.
Attachments
Plugin CustomFields.xml
plugin
(45.44 KiB) Downloaded 1030 times
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Using the Jiwa Assemblies from a .NET application

Postby perry » Wed Apr 01, 2015 10:21 am

Hi,

An update to this issue, I think it is caused by references used by the plugin.
I found if I reference JiwaInventory.dll in the plugin, it won't load into JiwaApplication.Manager.Instance.PluginCollection.
There are other plugins without JiwaInventory.dll won't load as well, so I am assuming there are other dlls causing the same problem.

Regards,
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Re: Using the Jiwa Assemblies from a .NET application

Postby Mike.Sheen » Wed Apr 01, 2015 6:55 pm

Hi Perry,

I've managed to reproduce the issue, and found that if I two processes on the same machine, tried to login as the same user, then some plugins will not load (failing silently) - can you tell me if that scenario fits your experienced problem? i.e.: Were you running your application using the Jiwa assemblies whilst another application (either Jiwa itself or an application or service using the Jiwa assemblies) had already logged in?

Mike
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: Using the Jiwa Assemblies from a .NET application

Postby perry » Thu Apr 02, 2015 10:15 am

Hi Mike,

No, not quite true for me. I just tried with no other Jiwa session running and deleted the program data folder and still not getting all plugins loaded.

Also tried on another dev PC, connecting to the same database and getting exception now (never happened before when testing on that same PC)
Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.     at JiwaFinancials.Jiwa.JiwaApplication.Manager.HandleApplicationManagerPluginExceptions()     at
JiwaFinancials.Jiwa.JiwaApplication.Manager.Logon(String ServerName, String DatabaseName, AuthenticationModes AuthenticationMode, String JiwaUserName, String JiwaPassword)
Perry Ma
S. Programmer
Lonicera Pty Ltd
http://www.lonicera.com.au
perry
Frequent Contributor
Frequent Contributor
 
Posts: 173
Joined: Mon Oct 27, 2008 2:26 pm
Topics Solved: 15

Next

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 5 guests