Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            AutoMapperConfig.RegisterMappings();

            var container     = new UnityContainer();
            var unitySections = new[] { "crossroadsCommonUnity", "unity" };

            foreach (var section in unitySections.Select(sectionName => (UnityConfigurationSection)ConfigurationManager.GetSection(sectionName)))
            {
                container.LoadConfiguration(section);
            }

            TlsHelper.AllowTls12();

            var exitCode = 0;

            try
            {
                // Dependency Injection
                _eventService = container.Resolve <EventService>();
                _eventService.SendReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Log.Error("Event Reminder Process failed.", ex);
            }

            try
            {
                _eventService = container.Resolve <EventService>();
                _eventService.SendPrimaryContactReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Log.Error("Event Primary Contact Reminder Process failed.", ex);
            }

            try
            {
                _serveService = container.Resolve <ServeService>();
                _serveService.SendReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode += 2;
                Log.Error("Serve Reminder Process failed.", ex);
            }

            Log.Info("all done");
            Environment.Exit(exitCode);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            AutoMapperConfig.RegisterMappings();
            var section   = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");
            var container = new UnityContainer();

            section.Configure(container);

            TlsHelper.AllowTls12();

            var exitCode = 0;

            try
            {
                // Dependency Injection
                _eventService = container.Resolve <EventService>();
                _eventService.SendReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Log.Error("Event Reminder Process failed.", ex);
            }

            try
            {
                _eventService = container.Resolve <EventService>();
                _eventService.SendPrimaryContactReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode = 1;
                Log.Error("Event Primary Contact Reminder Process failed.", ex);
            }

            try
            {
                _serveService = container.Resolve <ServeService>();
                _serveService.SendReminderEmails();
            }
            catch (Exception ex)
            {
                exitCode += 2;
                Log.Error("Serve Reminder Process failed.", ex);
            }

            Log.Info("all done");
            Environment.Exit(exitCode);
        }