I am hoping someone can steer me in the correct direction. I trying to get an MVC script to enter a sales order. As far as I understand it (I do not have much experience in BOI) I need an instance of the SO_SalesOrder_bus. The problem occurs when I try to instantiate it. I have no idea what I am doing wrong, can someone point me in the right direction? Below is my code upto the point where it fails: ===================================================================================================================== string mas90 = @"\\sage100adv\APPS\Sage\Sage 100 Advanced ERP\MAS90\Home"; string compCode = @"WEI"; string accDate = DateTime.Now.ToString("yyyyMMdd"); object pvx = null; object oSS = null; object oSOB = null; object oSOL = null; System.Reflection.BindingFlags flgMethod = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.InvokeMethod; System.Reflection.BindingFlags flgGetProperty = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.GetProperty; System.Reflection.BindingFlags flgSetProperty = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.SetProperty; try { pvx = System.Activator.CreateInstance(Type.GetTypeFromProgID("ProvideX.Script", true)); pvx.GetType().InvokeMember("Init", flgMethod, null, pvx, new object[] { mas90 }); oSS = pvx.GetType().InvokeMember("NewObject", flgMethod, null, pvx, new object[] { "SY_Session" }); oSS.GetType().InvokeMember("nSetUser", System.Reflection.BindingFlags.InvokeMethod, null, oSS, new object[] {"username","password"}); oSS.GetType().InvokeMember("nSetCompany", flgMethod, null, oSS, new object[] { compCode }); oSS.GetType().InvokeMember("nSetDate", flgMethod, null, oSS, new object[] { "S/O", accDate }); oSS.GetType().InvokeMember("nSetModule", flgMethod, null, oSS, new object[] { "S/O" }); int TaskID = (int)oSS.GetType().InvokeMember("nLookupTask", flgMethod, null, oSS, new object[] { "SO_SalesOrder_ui" }); oSS.GetType().InvokeMember("nSetProgram", flgMethod, null, oSS, new object[] { TaskID }); // get the SalesOrderBus Object FAILS HERE oSOB = pvx.GetType().InvokeMember("NewObject", flgMethod, null, pvx, new object[] { "SO_SalesOrder_bus" }); ===================================================================================================================== Thanks for the help.
↧