Ejemplo n.º 1
0
        public void Connect()
        {
            if (Connected)
            {
                return;
            }

            Company = settings.ToCompany();

            int result = Company.Connect();

            if (result != 0)
            {
                throw new ConnectionFailedException($"{result} {Company.GetLastErrorDescription()}");
            }

            Connected = true;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Connects to SAP Business One.
        /// </summary>
        /// <exception cref="ConnectionException">
        /// Thrown when a connection cannot be established.
        /// </exception>
        public void Connect()
        {
            if (Connected)
            {
                return;
            }

            Company = settings.ToCompany();

            var result = Company.Connect();

            if (result != 0)
            {
                var message = $"{result} {Company.GetLastErrorDescription()}";
                throw new ConnectionException(message);
            }

            Connected = true;
        }