Example #1
0
 public MTSTicketsHandlers(IMtsSdk mtsSdk, IBuilderFactory builderFactory, ILog log)
 {
     _mtsSdk          = mtsSdk;
     _factory         = builderFactory;
     _log             = log;
     _ticketService   = new TicketService(_log);
     _ticketGenerator = new TicketGenerator(_factory, _log);
 }
Example #2
0
        /// <summary>
        /// Starts the MTS Sdk Session
        /// </summary>
        public void Start()
        {
            try
            {
                _log.Info("Running the MTS SDK Non-Blocking mode.");

                _log.Info("Retrieving configuration from application configuration file.");
                var config = MtsSdk.GetConfiguration();

                _log.Info("Creating root MTS SDK instance.");
                _mtsSdk = new MtsSdk(config);

                #region Testing Section

                ////handles database related operations
                //_ticketService = new TicketService(_log);
                ////handles all MTS events
                //_factory = _mtsSdk.BuilderFactory;
                //_ticketHandler = new MTSTicketsHandlers(_mtsSdk, _factory, _log);
                //TestSendTicket();

                #endregion

                _log.Info("Attaching to events.");
                AttachToFeedEvents(_mtsSdk);

                _log.Info("Opening the sdk instance (creating and opening connection to the AMPQ broker)");
                _mtsSdk.Open();
                _factory = _mtsSdk.BuilderFactory;

                //handles database related operations
                _ticketService = new TicketService(_log);
                //handles all MTS events
                _ticketHandler = new MTSTicketsHandlers(_mtsSdk, _factory, _log);

                //starting timer to get ticket updates from database
                _timer = new Timer(TicketUpdatesTimer_Tick, null, _updateInterval, _updateInterval);

                _log.Info("MTS SDK started successfully. Hit <enter> to quit if in console mode.");
                Console.WriteLine(string.Empty);
                Console.ReadLine();
            }
            catch (Exception error)
            {
                EventLog.WriteEntry("Service ", error.ToString(), EventLogEntryType.Error);
            }
        }