(Jason Hecker) #1

In my continued tour of the world of Epicor 10 Customizations, I came across what I am finding to me quite a puzzler. Below is a snippet of a customization that calls the CustShipAdapter, which works splendidly.

Dim adpPackLines As CustShipAdapter = New CustShipAdapter(oTrans)
Dim csaQueryHead As String = String.Format("PackNum = '{0}'", ei.strPackNum)
Dim csaOpts As Ice.Lib.Searches.SearchOptions = New Ice.Lib.Searches.SearchOptions(Ice.Lib.Searches.SearchMode.AutoSearch)
csaOpts.DataSetMode = Ice.Lib.Searches.DataSetMode.RowsDataSet
csaOpts.PreLoadSearchFilter = csaQueryHead
Dim dsPackLines As Erp.BO.CustShipDataSet = adpPackLines.CustShipData

Now here is another code snippet that calls the SalesOrderAdapter, and this does not work.

Dim objOrderHed As SalesOrderAdapter = New SalesOrderAdapter(oTrans)
Dim objQueryHead As String = String.Format("OrderNum = '{0}'", ei.intOrderNum)
Dim objOpts As Ice.Lib.Searches.SearchOptions = New Ice.Lib.Searches.SearchOptions(Ice.Lib.Searches.SearchMode.AutoSearch)
objOpts.DataSetMode = Ice.Lib.Searches.DataSetMode.RowsDataSet
objOpts.PreLoadSearchFilter = objQueryHead
Dim dsOrder As Erp.BO.SalesOrderDataSet = objOrderHed.SalesOrderData

To make things really easy to compare, I made each snippet to be 8 lines long, with line X on each snippet doing the same thing for the adapter it’s working with.

As far as I know, I have all of the appropriate assemblies loaded, but for some reason when I try to compile the 2nd snippet (the one for the SalesOrderAdapter) I get the following error:

Error: BC31429 - line 217 (509) - ‘salesOrderData’ is ambiguous because multiple kinds of members with this name exist in class ‘Erp.Adapters.SalesOrderAdapter’.

Line 217 is this:

Dim dsOrder As Erp.BO.SalesOrderDataSet = objOrderHed.SalesOrderData

Poking around in the source code for both Erp.Adapters.CustShip.dll as well as Erp.Adapters.SalesOrder.dll and they both have 2 methods that are named the same, but with different signatures. Both are shown below.


What is throwing me for a loop is why I am getting the error for the SalesOrderData and not for CustShipData.

Anyone have any thoughts?

Does SalesOrderAdapter have InvokeSearch method?
(Jose C Gomez) #2

Actually believe it or not this is because you are using VB
In c# salesOrderData and SalesOrderData are different objects and thus having both of these doesn’t cause a problem.
However in VB since it isn’t case sensitive the compiler can’t figure out which object you are trying to address.
The reason why it works in custShip is because custShipData is private while CustShipData is public.
In sales order however both are public.


(Jason Hecker) #3

Now that makes sense, I failed to even think about the case sensitivity. Does that mean that this won’t be possible in VB? I guess if needed I could declare it as a System.Data.DataSet and work with it that way.

(Rob Bucek) #4

or just bite the bullet and covert it now :slight_smile:

(Jason Hecker) #5

Yeah, I thought about just making the jump to C#. It’s not that I don’t know C#, I just find VB to be faster to hammer out these customizations with.

(Rob Bucek) #6

i feel you…it’s the familiarization that’s the speed, you gotta pay the piper at some point. I was in the same boat a couple years ago. Now I’d be slower writing VB lol, C# code isn’t harder or longer to write. The structure it offers is pretty nice tho.

(Jose C Gomez) #7

Oh @jhecker come over to the dark side buddy. C# is where it is at! Plus customizations you write in VB are not supported by the framework for web publishing or well pretty much anything.

(Jason Hecker) #8


Oh, I will. This customization was well over 1/2 done, and since it was started in VB I decided to keep going in VB. I will port it to C# in the near future, and then do my future customizations in C# as well.

The main reason that I did not redo this one in C# is because I have my E10 Go-Live this Friday night, and I am hammering out finishing up the porting of my E9 Customizations to E10.

Now, in regards to the reason I opened up this thread, I found an appropriate work-around that I should have realized earlier. I was trying to use the SalesOrderAdapter to grab the information for the order (from CustShipForm). In my rush to finish the customization, I had tunnel-vision and didn’t remember that the same data I was trying to pull from the SalesOrderAdapter was already in oTrans.EpiDataViews(“OrderHed”). So I just grabbed that data and threw it into my DataSet so that my existing routine for extracting the data from it would work without needing to be rewritten.

Since I was not saving any data, the adapter wasn’t required, so it worked out perfectly. I am finishing up the customization now, bringing me one step closer to being ready for Friday’s uplift.