I decided to finally give E10 a whirl in Visual Studio. First - wow - code completion for the win.
With that said I am having some issues. I connected, authenticated, connected the Part BO.
I was able to successfully use PartExists() but if I try to use wither GetRows() or GetByID() I get the following error:
System.InvalidCastException was unhandled
HResult=-2147467262
Message=Unable to cast object of type ‘Ice.Core.Session’ to type ‘Ice.Lib.Framework.ILaunch’.
Source=Erp.Adapters.Part
StackTrace:
at Erp.Adapters.PartAdapter.get_partData()
at Erp.Adapters.PartAdapter.GetCurrentDataSet(DataSetMode dsMode)
at Ice.Lib.Framework.EpiBaseAdapter.afterGetByID(DataSet rowsDataSet)
at Ice.Lib.Framework.EpiBaseAdapter.GetByID(String stringId)
at EpicorBaseProject.Form1.button1_Click(Object sender, EventArgs e) in c:\users\cconn\documents\visualstudio2015\Projects\EpicorBaseProject\EpicorBaseProject\Form1.cs:line 44
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at EpicorBaseProject.Program.Main() in c:\users\cconn\documents\visualstudio2015\Projects\EpicorBaseProject\EpicorBaseProject\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Here’s some of my test code:
using (Session epiSession = new Session("Me","MyPassword",Session.LicenseType.Default, @"C:\Epicor\ERP10.1Client\Client\config\E10LiveDB2.sysconfig"))
{
PartAdapter pa = new PartAdapter(epiSession);
pa.BOConnect();
if (pa.PartExists("498CC")) MessageBox.Show("498CC exists");
bool more;
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
//PartListDataSet ds = new PartListDataSet();
bool res = pa.GetByID("498");
/*DataSet ds = pa.PartList;
//pa.GetRows(opts, out more);
//pa.PartList;
}
Any thoughts?