Пример #1
0
        /// <summary>
        /// Подключиться к торговой системе.
        /// </summary>
        protected override void OnConnect()
        {
            if (Address == null)
            {
                throw new InvalidOperationException(LocalizedStrings.Str1895);
            }

            if (Login == null)
            {
                throw new InvalidOperationException(LocalizedStrings.Str1896);
            }

            if (Password == null)
            {
                throw new InvalidOperationException(LocalizedStrings.Str1897);
            }

            try
            {
                // SmartCOM 3 не является сервисом и не требует перезапуска
                if (RestartService && Version == SmartComVersions.V2)
                {
                    SmartComService.RestartSmartComService(RestartServiceTimeOut);
                }
            }
            catch (Exception ex)
            {
                TransactionAdapter.SendOutMessage(new ErrorMessage {
                    Error = ex
                });
            }

            base.OnConnect();
        }