internal SDKBatch(SDK.IQBSessionManager mgr, short majorVer, short minorVer, string Country) { _clousures = new Dictionary <int, ClosureSpec>(); _mgr = mgr; _msg = _mgr.CreateMsgSetRequest(Country, majorVer, minorVer); _iterator = null; if (_msg == null) { throw new Exception("Can't create message set"); } }
/// <summary> /// Closes this connection /// </summary> public void Close() { var sessionMgr = _sessionMgr; _sessionMgr = null; ConnectionMgr.ConnectionClosed(this); try { sessionMgr.EndSession(); sessionMgr.CloseConnection(); } catch (System.Runtime.InteropServices.COMException cex) { throw new SDKCloseException(cex); } }
public static SDKConnection GetTestConnection(SDK.IQBSessionManager sessionMgr) { return(new SDKConnection(sessionMgr)); }
internal SDKConnection(ConnectionMgr.ApplicationIdentity appID, ConnectionMgr.ConnectionConfig config) { _SDKMajorVersion = HOST_QUERY_QBXML_VERSION; _SDKMinorVersion = 0; SDK.ENConnectionType cnType; switch (config.ConnectionType) { case ConnectionMgr.FCConnectionType.Desktop: cnType = SDK.ENConnectionType.ctLocalQBD; break; case ConnectionMgr.FCConnectionType.DesktopLaunchUI: cnType = SDK.ENConnectionType.ctLocalQBDLaunchUI; break; case ConnectionMgr.FCConnectionType.Online: cnType = SDK.ENConnectionType.ctRemoteQBOE; _SDKMajorVersion = ONLINE_QBXML_VERSION; break; default: throw new Exception("Unsupported connection type:" + config.ConnectionType.ToString()); } try { //ToDo: use online session manager for online version var sessionMgr = new SDK.QBSessionManager(); sessionMgr.OpenConnection2(appID.IntuitAppID, appID.Name, cnType); _sessionMgr = sessionMgr; } catch (System.Runtime.InteropServices.COMException cex) { throw new SDKSessionException(cex); } _country = string.Empty; switch (appID.TargetEdition) { case ConnectionMgr.QBEdition.Australia: case ConnectionMgr.QBEdition.US: _country = "US"; break; case ConnectionMgr.QBEdition.Canada: _country = "CA"; break; case ConnectionMgr.QBEdition.UK: _country = "UK"; break; } SDK.ENOpenMode cnMode; if (config.RequireSingleUser) { cnMode = SDK.ENOpenMode.omSingleUser; } else { cnMode = SDK.ENOpenMode.omDontCare; } string filePath = config.FilePath; if (config.UseCurrentFile) { filePath = string.Empty; } try { _sessionMgr.BeginSession(filePath, cnMode); } catch (System.Runtime.InteropServices.COMException cex) { throw new SDKSessionException(cex); } }
internal SDKConnection(SDK.IQBSessionManager sessionMgrMock) { _sessionMgr = sessionMgrMock; }