Ejemplo n.º 1
0
        public QBResponse Send(QBRequest request)
        {
            System.Console.WriteLine("Send Command");
            Session session = this.ConnectToQB(request);

            return(session.ProcessRequest(request));
        }
Ejemplo n.º 2
0
            internal QBResponse ProcessRequest(QBRequest request)
            {
                string     resp     = rp.ProcessRequest(ticket, request.XML);
                QBResponse response = new QBResponse
                {
                    Data      = resp,
                    Timestamp = DateTime.Now
                };

                return(response);
            }
Ejemplo n.º 3
0
        // CONNECTION TO QB
        private Session ConnectToQB(QBRequest request)
        {
            string  key = GetSessionKey();
            Session session;

            if (!sessions.Keys.Contains(key))
            {
                session = new Session
                {
                    AppID       = request.AppID,
                    AppName     = request.AppName,
                    CompanyFile = request.CompanyFile
                };
                sessions.Add(key, session);
            }
            else
            {
                session = sessions[key];
            }
            if (session.rp == null)
            {
                try
                {
                    session.rp = new RequestProcessor2Class();
                    //			rp.OpenConnection(request.AppID, request.AppName);
                    session.rp.OpenConnection2(request.AppID, request.AppName, QBXMLRPConnectionType.localQBD);
                    if (request.CompanyFile == null)
                    {
                        request.CompanyFile = string.Empty;
                    }
                    session.ticket = session.rp.BeginSession(request.CompanyFile, QBFileMode.qbFileOpenDoNotCare);
                    string[] versions = (string[])session.rp.get_QBXMLVersionsForSession(session.ticket);
                    session.MaxVersion = versions[versions.Length - 1];
                }
                catch (Exception e)
                {
                    Logger.LogException(e);
                    DisconnectFromQB();
                }
            }

            return(session);
        }
Ejemplo n.º 4
0
        public QBResponse GetMaxVersion(QBRequest request)
        {
            Session session = this.ConnectToQB(request);

            return(session.ProcessRequest(request));
        }