Exemplo n.º 1
0
        /// <summary>
        ///     <c>Restart</c>
        ///     Method called by Topshellf to restart the service
        /// </summary>
        public void Restart()
        {
            _pharmaserve.Dispose();
            _pharmaserve = new Pharmaserve(_motDatabaseServer, GatewayIp, GatewayPort);
            _pharmaserve.Go();

            EventLogger.Info("Service restarted");
        }
Exemplo n.º 2
0
        public void Start()
        {
            try
            {
                LoadConfiguration();
                // "Data Source=PROXYPLAYGROUND;Initial Catalog=McKessonTestDb;User ID=sa;Password=$MOT2018"

                _connectString     = $"Data Source={DbServer};Initial Catalog={DbName};User ID={DbUser};Password={DbPassword};";
                _motDatabaseServer = new MotSqlServer(_connectString);

                _pharmaserve             = new Pharmaserve(_motDatabaseServer, GatewayIp, GatewayPort);
                _pharmaserve.RefreshRate = RefreshRate;
                _pharmaserve.Go();

                EventLogger.Info("Service started");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                EventLogger.Error($"Failed to start service: {ex.Message}");
                throw;
            }
        }