private static void Main(string [] args) { log4net.Config.XmlConfigurator.Configure(); TlsHelper.AllowTls12(); var unitySections = new [] { "unity", "scheduledDataUnity" }; var container = new UnityContainer(); foreach (var sectionName in unitySections) { var section = (UnityConfigurationSection)ConfigurationManager.GetSection(sectionName); container.LoadConfiguration(section); } var argString = args == null ? string.Empty : string.Join(" ", args); Log.Info($"Starting ScheduledDataUpdate with arguments: {argString}"); var program = container.Resolve <Program>(); var exitCode = program.Run(args); Log.Info($"Completed Scheduled Data Update, exit code {exitCode}"); Environment.Exit(exitCode); }
private static void Main() { 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(); AutoMapperConfig.RegisterMappings(); try { Log.Info("Starting Bulk Email Synchronization"); var syncService = container.Resolve <IBulkEmailSyncService>(); syncService.RunService(); Log.Info("Finished Bulk Email Synchronization successfully"); } catch (Exception ex) { Log.Error("Bulk Email Synchronization Process failed.", ex); Environment.Exit(9999); } }
private static void Main() { var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); var container = new UnityContainer(); section.Configure(container); TlsHelper.AllowTls12(); AutoMapperConfig.RegisterMappings(); try { Log.Info("Starting Bulk Email Synchronization"); var syncService = container.Resolve <IBulkEmailSyncService>(); syncService.RunService(); Log.Info("Finished Bulk Email Synchronization successfully"); } catch (Exception ex) { Log.Error("Bulk Email Synchronization Process failed.", ex); Environment.Exit(9999); } }
private static void Main() { var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); var container = new UnityContainer(); section.Configure(container); TlsHelper.AllowTls12(); var exitCode = 0; var childcareService = container.Resolve <ChildcareService>(); try { Log.Info("Sending notifications for cancellations"); childcareService.SendChildcareCancellationNotification(); } catch (Exception ex) { Log.Error("Childcare Cancellation Notifcation Failed", ex); exitCode += 1; } try { Log.Info("Sending childcare reminders"); childcareService.SendChildcareReminders(); } catch (Exception ex) { Log.Error("Sending Childcare Reminders failed", ex); exitCode += 2; } Environment.Exit(exitCode); }
protected void Application_Start(object sender, EventArgs e) { AreaRegistration.RegisterAllAreas(); AutoMapperConfig.RegisterMappings(); UnityConfig.RegisterComponents(); GlobalConfiguration.Configure(WebApiConfig.Register); ApplicationPreload.StartJobProcessor(); TlsHelper.AllowTls12(); XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/Web.config"))); }
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); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); UnityConfig.RegisterComponents(); //GlobalConfiguration.Configure(WebApiConfig.Register); GlobalConfiguration.Configure(VersionConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); AutoMapperConfig.RegisterMappings(); TlsHelper.AllowTls12(); log4net.Config.XmlConfigurator.Configure(new FileInfo(Server.MapPath("~/Web.config"))); }
public static void Main(string[] args) { var section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity"); var container = new UnityContainer(); section.Configure(container); TlsHelper.AllowTls12(); var program = container.Resolve <Program>(); program.run(args); }
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); }
public static void Main(string[] args) { 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 program = container.Resolve <Program>(); program.run(args); }
private static void Main() { 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; var childcareService = container.Resolve <ChildcareService>(); try { Log.Info("Sending notifications for cancellations"); childcareService.SendChildcareCancellationNotification(); } catch (Exception ex) { Log.Error("Childcare Cancellation Notifcation Failed", ex); exitCode += 1; } try { Log.Info("Sending childcare reminders"); childcareService.SendChildcareReminders(); } catch (Exception ex) { Log.Error("Sending Childcare Reminders failed", ex); exitCode += 2; } Environment.Exit(exitCode); }
private static void Main() { 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 eventService = container.Resolve <EventService>(); var groupService = container.Resolve <GroupService>(); var userApiService = container.Resolve <ApiUserRepository>(); var mpRestRepository = container.Resolve <MinistryPlatformRestRepository>(); // use childcare grouptype and eventtype var groupTypeId = Convert.ToInt32(ConfigurationManager.AppSettings["ChildcareGroupType"]); var eventTypeId = Convert.ToInt32(ConfigurationManager.AppSettings["ChildcareEventType"]); var defaultMinistryId = Convert.ToInt32(ConfigurationManager.AppSettings["ChildcareDefaultMinistryId"]); var configSettingsPageId = Convert.ToInt32(ConfigurationManager.AppSettings["ConfigurationSettingsPageId"]); try { //////////////////////////////////////////////////////////////////////// // Update the childcare events that are properly set up in a series //////////////////////////////////////////////////////////////////////// Log.Info("Updating Childcare events in series."); var apiToken = userApiService.GetToken(); AutoMapperConfig.RegisterMappings(); var parms = new Dictionary <string, object>() { { "@Group_Type", groupTypeId }, { "@Event_type", eventTypeId } }; //Call Andy's stored proc and loop through var results = mpRestRepository.UsingAuthenticationToken(apiToken).GetFromStoredProc <MpEventsMissingGroups>("api_crds_MissingChildcareGroup", parms); var eventList = results.FirstOrDefault() ?? new List <MpEventsMissingGroups>(); Log.Info("Updating " + eventList.Count.ToString() + " series events."); foreach (var item in eventList) { var groupdto = groupService.GetGroupDetails(item.GroupId); //change the date var mpevent = eventService.GetEvent(item.EventId); groupdto.StartDate = mpevent.EventStartDate; groupdto.Participants?.Clear(); groupdto.Events?.Clear(); groupdto.MeetingDayId = null; groupdto.MeetingFrequencyID = null; //change the dates var newgroupdto = groupService.CreateGroup(groupdto); //link the new group to the event eventService.AddEventGroup(item.EventId, newgroupdto.GroupId, apiToken); } //////////////////////////////////////////////////////////////////////// // Update the childcare events that are orphans (Use defaults) //////////////////////////////////////////////////////////////////////// //get default values 10,25,100 var maxAgeObject = MinistryPlatformService.GetRecordsDict(configSettingsPageId, apiToken, ",ChildcareMaxAge", string.Empty).FirstOrDefault()?["Value"]; var defaultMaximumAge = maxAgeObject != null?Convert.ToInt32(maxAgeObject) : 10; var minParticipantsObject = MinistryPlatformService.GetRecordsDict(configSettingsPageId, apiToken, ",ChildcareMinParticipants", string.Empty).FirstOrDefault()?["Value"]; var defaultMinimumParticipants = minParticipantsObject != null?Convert.ToInt32(minParticipantsObject) : 25; var targetSizeObject = MinistryPlatformService.GetRecordsDict(configSettingsPageId, apiToken, ",ChildcareTargetSize", string.Empty).FirstOrDefault()?["Value"]; var defaultTargetSize = targetSizeObject != null?Convert.ToInt32(targetSizeObject) : 100; Log.Info("Updating orphan Childcare events."); var orphanresults = mpRestRepository.UsingAuthenticationToken(apiToken).GetFromStoredProc <MpOrphanEventsMissingGroups>("api_crds_GetOrphanChildcareEvents", new Dictionary <string, object>()); var orphaneventList = orphanresults.FirstOrDefault() ?? new List <MpOrphanEventsMissingGroups>(); Log.Info("Updating " + eventList.Count.ToString() + " orphan events."); foreach (var item in orphaneventList) { var groupdto = new GroupDTO(); var mpevent = eventService.GetEvent(item.EventId); groupdto.StartDate = mpevent.EventStartDate; groupdto.Participants?.Clear(); groupdto.Events?.Clear(); groupdto.MeetingDayId = null; groupdto.MeetingFrequencyID = null; groupdto.CongregationId = mpevent.CongregationId; groupdto.Congregation = mpevent.Congregation; groupdto.ContactId = mpevent.PrimaryContact.ContactId; groupdto.MaximumAge = defaultMaximumAge; groupdto.MinimumParticipants = defaultMinimumParticipants; groupdto.TargetSize = defaultTargetSize; groupdto.GroupName = "__childcaregroup"; groupdto.GroupTypeId = groupTypeId; groupdto.MinistryId = defaultMinistryId; var newgroupdto = groupService.CreateGroup(groupdto); //link the new group to the event eventService.AddEventGroup(item.EventId, newgroupdto.GroupId, apiToken); } Log.Info("Childcare Group update Complete."); } catch (Exception ex) { Log.Error("Childcare Group Update Notifcation Failed", ex); Environment.Exit(9999); } Environment.Exit(0); }