Creating a Visual Studio Project to connect to Epicor/Vantage

Thanks for the explanation -- it made a lot of sense. I looked at the projects -- that is very cool stuff.

________________________________

From: vantage@yahoogroups.com on behalf of Mark Wonsil
Sent: Wed 9/22/2010 3:33 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to Epicor/Vantage




Sean asks
>
> Is there a reason that you're going this route instead of just using the web services?
>

I can't speak for Joe and his project but the quick answer is speed.
The web services are a layer on top of the business objects. You
eliminate all of the converting of the data to/from XML and going
through the web server. DMT talks to the business objects AND works
with multiple threads. That's why it's chosen to load databases over
Service Connect. The con is that you have to write your own control
logic in your .NET language of choice and not use a graphical system
like Service Connect.

Mark W.





[Non-text portions of this message have been removed]
Hello,



I am trying to create a Visual Studio 2010 project in order to create a
debugging environment.

I'm trying to simply invoke the search window for an adapter.

I have what I think are all the correct references but I keep getting an
error when trying to instantiate a new SessionOptions object.

The code line looks like this: SearchOptions opts = new
SearchOptions(SearchMode.ShowDialog);



And the error I keep getting is:

...

A first chance exception of type 'System.IO.FileNotFoundException'
occurred in Epicor.Mfg.Lib.AppSettingsHandler.dll

A first chance exception of type 'System.TypeInitializationException'
occurred in Epicor.Mfg.UI.EpiClientLib.dll

...

The program '[6008] EpicorSearchCSharp.vshost.exe: Managed (v2.0.50727)'
has exited with code -532459699 (0xe0434f4d).



My guess is that AppSettingsHandler is the object that reads the config
file but I can't figure out what is wrong.



Has anyone else created a VS project and could shed some light on what I
might be missing in my project?










Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
jrojas@... | www.matsinc.com Ask us about our clean, green and beautiful matting and flooring


This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.


[Non-text portions of this message have been removed]
Hi Joe,

> I am trying to create a Visual Studio 2010 project in order to create a
> debugging environment.
>
> I'm trying to simply invoke the search window for an adapter.

Can you please post your code? (Don't forget to mask the username/password)

Mark W.
Hi Mark,



Thanks for taking a look.

Right now, I just have a form with one button that has my code in the
Click event.



using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using Epicor.Mfg.Core;

using Epicor.Mfg.UI;

using Epicor.Mfg.UI.Adapters;

using Epicor.Mfg.UI.Searches;



namespace EpicorSearchCSharpTake2

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}



private void btnCustCntSearch_Click(object sender, EventArgs e)

{

Session epiSession = new Session("user", "password",
"AppServerDC://myserver:9031", Session.LicenseType.Default);

CustCntAdapter adpCustCnt = new
CustCntAdapter(epiSession.ConnectionPool);

SearchOptions opts = new
SearchOptions(SearchMode.ShowDialog);



opts.DataSetMode = DataSetMode.ListDataSet;



adpCustCnt.InvokeSearch(opts);

}

}

}





From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mark Wonsil
Sent: Tuesday, September 21, 2010 9:40 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage





Hi Joe,

> I am trying to create a Visual Studio 2010 project in order to create
a
> debugging environment.
>
> I'm trying to simply invoke the search window for an adapter.

Can you please post your code? (Don't forget to mask the
username/password)

Mark W.




[Non-text portions of this message have been removed]
Joe Wrote:
>
> Right now, I just have a form with one button that has my code in the
> Click event.
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Epicor.Mfg.Core;
> using Epicor.Mfg.UI;
> using Epicor.Mfg.UI.Adapters;
> using Epicor.Mfg.UI.Searches;
>
> namespace EpicorSearchCSharpTake2
>
> {
>
> public partial class Form1 : Form
>
> {
>
> public Form1()
>
> {
>
> InitializeComponent();
>
> }
>
> private void btnCustCntSearch_Click(object sender, EventArgs e)
>
> {
>
> Session epiSession = new Session("user", "password",
> "AppServerDC://myserver:9031", Session.LicenseType.Default);
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> SearchOptions opts = new
> SearchOptions(SearchMode.ShowDialog);
>
> opts.DataSetMode = DataSetMode.ListDataSet;
>
> adpCustCnt.InvokeSearch(opts);
>
> }
> }
> }

I'm not in the office today but I am guessing that the SearchOptions
BO is looking for the number of search items to display by default and
that's stored in the config folder of the client. I would make a copy
of the entire config folder into your debug or release folder. I'm
assuming of course that the program is looking for the config file in
a relative position to the executable.

HTH,

Mark W.
Thanks Mark,



Copying the config folder to the debug folder of my project worked.

Thanks!



Now I'm having a problem initializing the adapter. It seems that the BO
is not connecting.

When I look at some examples I've created within Epicor, I've been using
oTrans instead of a Session object in the line that reads:

CustCntAdapter adpCustCnt = new
CustCntAdapter(epiSession.ConnectionPool);



As I walk through the code, it looks like the when the CustCntAdapter is
being instantiated, it is trying to cast the ConnectionPool to an
IEpiTransaction, which it cannot.



Does this mean I need to create an oTrans for my project? If I do,
normally oTrans is based off of the Transaction member of an Epicor
screen, like Project Entry or Order Entry. Is there a way to make a
generic Transaction object?



Thanks for your help so far Mark!





From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mark Wonsil
Sent: Wednesday, September 22, 2010 2:16 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage





Joe Wrote:
>
> Right now, I just have a form with one button that has my code in the
> Click event.
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Epicor.Mfg.Core;
> using Epicor.Mfg.UI;
> using Epicor.Mfg.UI.Adapters;
> using Epicor.Mfg.UI.Searches;
>
> namespace EpicorSearchCSharpTake2
>
> {
>
> public partial class Form1 : Form
>
> {
>
> public Form1()
>
> {
>
> InitializeComponent();
>
> }
>
> private void btnCustCntSearch_Click(object sender, EventArgs e)
>
> {
>
> Session epiSession = new Session("user", "password",
> "AppServerDC://myserver:9031", Session.LicenseType.Default);
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> SearchOptions opts = new
> SearchOptions(SearchMode.ShowDialog);
>
> opts.DataSetMode = DataSetMode.ListDataSet;
>
> adpCustCnt.InvokeSearch(opts);
>
> }
> }
> }

I'm not in the office today but I am guessing that the SearchOptions
BO is looking for the number of search items to display by default and
that's stored in the config folder of the client. I would make a copy
of the entire config folder into your debug or release folder. I'm
assuming of course that the program is looking for the config file in
a relative position to the executable.

HTH,

Mark W.




[Non-text portions of this message have been removed]
>
> Copying the config folder to the debug folder of my project worked.
>

Even a blind squirrel like me can find a nut sometimes...it was a
lucky guess. ;-)

>
> Now I'm having a problem initializing the adapter. It seems that the BO
> is not connecting.
>
> When I look at some examples I've created within Epicor, I've been using
> oTrans instead of a Session object in the line that reads:
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> As I walk through the code, it looks like the when the CustCntAdapter is
> being instantiated, it is trying to cast the ConnectionPool to an
> IEpiTransaction, which it cannot.
>
> Does this mean I need to create an oTrans for my project? If I do,
> normally oTrans is based off of the Transaction member of an Epicor
> screen, like Project Entry or Order Entry. Is there a way to make a
> generic Transaction object?

I have not used the transaction object in my .Net programming. If you
look in the Files section in the .Net folder, you'll see the program
that I wrote to update the file attachments. Maybe there's more luck
in there that can help you!

Mark W.
Is there a reason that you're going this route instead of just using the web services?

________________________________

From: vantage@yahoogroups.com on behalf of Joe Rojas
Sent: Wed 9/22/2010 2:41 PM
To: vantage@yahoogroups.com
Subject: RE: [Vantage] Creating a Visual Studio Project to connect to Epicor/Vantage




Thanks Mark,

Copying the config folder to the debug folder of my project worked.

Thanks!

Now I'm having a problem initializing the adapter. It seems that the BO
is not connecting.

When I look at some examples I've created within Epicor, I've been using
oTrans instead of a Session object in the line that reads:

CustCntAdapter adpCustCnt = new
CustCntAdapter(epiSession.ConnectionPool);

As I walk through the code, it looks like the when the CustCntAdapter is
being instantiated, it is trying to cast the ConnectionPool to an
IEpiTransaction, which it cannot.

Does this mean I need to create an oTrans for my project? If I do,
normally oTrans is based off of the Transaction member of an Epicor
screen, like Project Entry or Order Entry. Is there a way to make a
generic Transaction object?

Thanks for your help so far Mark!

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> ] On Behalf
Of Mark Wonsil
Sent: Wednesday, September 22, 2010 2:16 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage

Joe Wrote:
>
> Right now, I just have a form with one button that has my code in the
> Click event.
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Epicor.Mfg.Core;
> using Epicor.Mfg.UI;
> using Epicor.Mfg.UI.Adapters;
> using Epicor.Mfg.UI.Searches;
>
> namespace EpicorSearchCSharpTake2
>
> {
>
> public partial class Form1 : Form
>
> {
>
> public Form1()
>
> {
>
> InitializeComponent();
>
> }
>
> private void btnCustCntSearch_Click(object sender, EventArgs e)
>
> {
>
> Session epiSession = new Session("user", "password",
> "AppServerDC://myserver:9031", Session.LicenseType.Default);
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> SearchOptions opts = new
> SearchOptions(SearchMode.ShowDialog);
>
> opts.DataSetMode = DataSetMode.ListDataSet;
>
> adpCustCnt.InvokeSearch(opts);
>
> }
> }
> }

I'm not in the office today but I am guessing that the SearchOptions
BO is looking for the number of search items to display by default and
that's stored in the config folder of the client. I would make a copy
of the entire config folder into your debug or release folder. I'm
assuming of course that the program is looking for the config file in
a relative position to the executable.

HTH,

Mark W.

[Non-text portions of this message have been removed]






[Non-text portions of this message have been removed]
Yes. :)



There is, in my opinion, a bug in the CustCntAdapter.

When trying to use a QuickSearch on its search window, it does not
return the row(s) that were selected.

I'm trying to recreate the searching process to try and work around this
"bug".



It would be pretty tough to figure this out in Epicor's customization
tool due to the lack of functionality of the IDE.

I'm trying to do the work in VS2010 and then copy the code into a
customization.

Before I can even start testing, I'm trying to setup my VS Project to
simply connect to the appserver and then display the CustCntAdapter
search window, which is where I'm stuck.



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Sean McDaniel
Sent: Wednesday, September 22, 2010 3:12 PM
To: vantage@yahoogroups.com; vantage@yahoogroups.com
Subject: RE: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage





Is there a reason that you're going this route instead of just using the
web services?












Joe Rojas | Director of Information Technology | Mats Inc
dir: 781-573-0291 | cell: 781-408-9278 | fax: 781-232-5191
jrojas@... | www.matsinc.com Ask us about our clean, green and beautiful matting and flooring


This message is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the company.



________________________________


From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com> on
behalf of Joe Rojas
Sent: Wed 9/22/2010 2:41 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
Subject: RE: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage

Thanks Mark,

Copying the config folder to the debug folder of my project worked.

Thanks!

Now I'm having a problem initializing the adapter. It seems that the BO
is not connecting.

When I look at some examples I've created within Epicor, I've been using
oTrans instead of a Session object in the line that reads:

CustCntAdapter adpCustCnt = new
CustCntAdapter(epiSession.ConnectionPool);

As I walk through the code, it looks like the when the CustCntAdapter is
being instantiated, it is trying to cast the ConnectionPool to an
IEpiTransaction, which it cannot.

Does this mean I need to create an oTrans for my project? If I do,
normally oTrans is based off of the Transaction member of an Epicor
screen, like Project Entry or Order Entry. Is there a way to make a
generic Transaction object?

Thanks for your help so far Mark!

From: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com> [mailto:vantage@yahoogroups.com
<mailto:vantage%40yahoogroups.com> <mailto:vantage%40yahoogroups.com> ]
On Behalf
Of Mark Wonsil
Sent: Wednesday, September 22, 2010 2:16 PM
To: vantage@yahoogroups.com <mailto:vantage%40yahoogroups.com>
<mailto:vantage%40yahoogroups.com>
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage

Joe Wrote:
>
> Right now, I just have a form with one button that has my code in the
> Click event.
>
> using System;
> using System.Collections.Generic;
> using System.ComponentModel;
> using System.Data;
> using System.Drawing;
> using System.Linq;
> using System.Text;
> using System.Windows.Forms;
> using Epicor.Mfg.Core;
> using Epicor.Mfg.UI;
> using Epicor.Mfg.UI.Adapters;
> using Epicor.Mfg.UI.Searches;
>
> namespace EpicorSearchCSharpTake2
>
> {
>
> public partial class Form1 : Form
>
> {
>
> public Form1()
>
> {
>
> InitializeComponent();
>
> }
>
> private void btnCustCntSearch_Click(object sender, EventArgs e)
>
> {
>
> Session epiSession = new Session("user", "password",
> "AppServerDC://myserver:9031", Session.LicenseType.Default);
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> SearchOptions opts = new
> SearchOptions(SearchMode.ShowDialog);
>
> opts.DataSetMode = DataSetMode.ListDataSet;
>
> adpCustCnt.InvokeSearch(opts);
>
> }
> }
> }

I'm not in the office today but I am guessing that the SearchOptions
BO is looking for the number of search items to display by default and
that's stored in the config folder of the client. I would make a copy
of the entire config folder into your debug or release folder. I'm
assuming of course that the program is looking for the config file in
a relative position to the executable.

HTH,

Mark W.

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]




[Non-text portions of this message have been removed]
Sean asks
>
> Is there a reason that you're going this route instead of just using the web services?
>

I can't speak for Joe and his project but the quick answer is speed.
The web services are a layer on top of the business objects. You
eliminate all of the converting of the data to/from XML and going
through the web server. DMT talks to the business objects AND works
with multiple threads. That's why it's chosen to load databases over
Service Connect. The con is that you have to write your own control
logic in your .NET language of choice and not use a graphical system
like Service Connect.

Mark W.
Thanks Mark,



I took a look at your project and it looks like it will be a great
reference tool. Thanks for the upload!



The only downside, is that in your case, you're working directly with
the BO and it appears that things behave differently with the AD.



From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf
Of Mark Wonsil
Sent: Wednesday, September 22, 2010 3:01 PM
To: vantage@yahoogroups.com
Subject: Re: [Vantage] Creating a Visual Studio Project to connect to
Epicor/Vantage





>
> Copying the config folder to the debug folder of my project worked.
>

Even a blind squirrel like me can find a nut sometimes...it was a
lucky guess. ;-)

>
> Now I'm having a problem initializing the adapter. It seems that the
BO
> is not connecting.
>
> When I look at some examples I've created within Epicor, I've been
using
> oTrans instead of a Session object in the line that reads:
>
> CustCntAdapter adpCustCnt = new
> CustCntAdapter(epiSession.ConnectionPool);
>
> As I walk through the code, it looks like the when the CustCntAdapter
is
> being instantiated, it is trying to cast the ConnectionPool to an
> IEpiTransaction, which it cannot.
>
> Does this mean I need to create an oTrans for my project? If I do,
> normally oTrans is based off of the Transaction member of an Epicor
> screen, like Project Entry or Order Entry. Is there a way to make a
> generic Transaction object?

I have not used the transaction object in my .Net programming. If you
look in the Files section in the .Net folder, you'll see the program
that I wrote to update the file attachments. Maybe there's more luck
in there that can help you!

Mark W.




[Non-text portions of this message have been removed]