/// <summary> /// Creates the standard settings. /// </summary> /// <param name="server">The server.</param> /// <param name="dbUserName">Name of the database user.</param> /// <param name="dbPassword">The database password.</param> /// <param name="userName">Company username.</param> /// <param name="password">Company password.</param> /// <param name="language">The language.</param> /// <param name="licenseServer">The license server in <ServerName:Port> format.</param> /// <param name="dbServerType">Type of the database server.</param> /// <param name="companyDb">The company database.</param> /// <returns></returns> public static DiApiConnectionSettings CreateStandardSettings( string server, string dbUserName, string dbPassword, string userName, string password, BoSuppLangs language, string licenseServer, BoDataServerTypes dbServerType, string companyDb) { return(new DiApiConnectionSettings { Server = server, UseTrusted = false, DbUserName = dbUserName, DbPassword = dbPassword, UserName = userName, Password = password, Language = language, LicenseServer = licenseServer, DbServerType = dbServerType, CompanyDb = companyDb }); }
public static void ConnectViaDI(String dbServer, BoDataServerTypes dbServerType, String companyDb, String user, String password, String licenseServer, BoSuppLangs language = BoSuppLangs.ln_English) { try { // 1. Initiate the company instance for the first time if (oCompany == null) { oCompany = new SAPbobsCOM.Company(); } // 2. Set Company Property for login oCompany.Server = dbServer; oCompany.DbServerType = dbServerType; oCompany.CompanyDB = companyDb; oCompany.UserName = user; oCompany.Password = password; oCompany.LicenseServer = licenseServer; oCompany.language = language; oCompany.UseTrusted = false; IRetCode = oCompany.Connect(); // 4. Error Handling if (IRetCode != 0) { MsgBoxWrapper(oCompany.GetLastErrorDescription()); } // 5. (Optional) XML Export Configuration oCompany.XmlExportType = BoXmlExportTypes.xet_ExportImportMode; } catch (Exception ex) { MsgBoxWrapper(ex.Message + " " + ex.StackTrace); } }