Page 1 of 2
Using the Jiwa Assemblies from a .NET application

Posted:
Fri Jul 11, 2014 8:34 am
by jeromeh
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
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Fri Jul 11, 2014 1:12 pm
by Mike.Sheen
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
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Tue Sep 02, 2014 3:37 pm
by mribbons
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#
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Wed Mar 25, 2015 5:12 pm
by perry
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
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Wed Mar 25, 2015 6:36 pm
by Mike.Sheen
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
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Thu Mar 26, 2015 2:32 pm
by perry
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.
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Fri Mar 27, 2015 11:12 am
by perry
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.
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Wed Apr 01, 2015 10:21 am
by perry
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,
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Wed Apr 01, 2015 6:55 pm
by Mike.Sheen
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
Re: Using the Jiwa Assemblies from a .NET application

Posted:
Thu Apr 02, 2015 10:15 am
by perry
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)