Sales Order Entry via BOI

SOLVED

Please forgive me as I have been scouring the internet and other Sage sites to find the answer to this question with no avail.

I am trying to insert a sales order from c#. The order gets created, yet it doesn't have an assigned customer or any lines. Also, when I open the order in Sage, I receive an error stating "Another User is editing this Order".

Here is my code:

string mas90 = @"Path-To-MAS90";
string compCode = @"COMP";
string accDate = DateTime.Now.ToString("yyyyMMdd");

//new way
object pvx = null;
object oSS = null;
object oSOB = null;
object oSOL = null;

BindingFlags flgMethod = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.InvokeMethod;
BindingFlags flgGetProperty = BindingFlags.Public | BindingFlags.Static | BindingFlags.IgnoreCase | BindingFlags.GetProperty;
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[] {"UN","PW"});
//oSS.GetType().InvokeMember("nLogin", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);
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
oSOB = pvx.GetType().InvokeMember("NewObject", flgMethod, null, pvx, new object[] { "SO_SalesOrder_bus", oSS });

oSOB.GetType().InvokeMember("nSetKey", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "W1007" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ARDivisionNo$", "00" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "CustomerNo$", "WEB999" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "OrderType$", "N" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "OrderDate$", accDate });
// bill to
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToName$", "Jim Jergins" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToAddress1$", "123 E 456 S" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToCity$", "Saint George" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToState$", "UT" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToZipCode$", "84790" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "BillToCountryCode$", "USA" });
// Shipto
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToName$", "Jim Jergins" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToAddress1$", "123 E 456 S" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToCity$", "Saint George" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToState$", "UT" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToZipCode$", "84790" });
oSOB.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOB, new object[] { "ShipToCountryCode$", "USA" });

// lines object
oSOL = oSOB.GetType().InvokeMember("oLines", flgGetProperty, null, oSOB, null);
oSOL.GetType().InvokeMember("nAddLine", System.Reflection.BindingFlags.InvokeMethod, null, oSOL, null);
oSOL.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOL, new object[] { "ItemCode$", "801201" });
oSOL.GetType().InvokeMember("nSetValue", System.Reflection.BindingFlags.InvokeMethod, null, oSOL, new object[] { "QuantityOrdered", "2" });
oSOL.GetType().InvokeMember("nWrite", flgMethod, null, oSOL, null);
}
catch (Exception ex)
{
string error = (string)oSS.GetType().InvokeMember("sLastErrorMsg", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);
//int errornum = (int)oSS.GetType().InvokeMember("nLastErrorNo", System.Reflection.BindingFlags.InvokeMethod, null, oSS, null);
string that = ex.Message.ToString();
}
finally
{
//if (ar_cust_svc != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(ar_cust_svc);
//if (oSOL != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSOL);
//if (oSOB != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSOB);
if (oSS != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(oSS);
if (pvx != null) System.Runtime.InteropServices.Marshal.ReleaseComObject(pvx);
}

Is there something I am missing? Thank you for your help in advance.