/// <summary> /// Initializes a new instance of the <see cref="PostServiceRequestsmp_CopySR"/> class. /// </summary> public PostServiceRequestsmp_CopySR() : base(typeof(PostServiceRequestsmp_CopySR)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(40, "smp_CopySR", "incident", new Action <LocalPluginContext>(this.ExecutePostServiceRequestsmp_CopySR))); // Note : you can register for more events here if this plugin is not specific to an individual entity and message combination. // You may also need to update your RegisterFile.crmregister plug-in registration file to reflect any change. }
/// <summary> /// Initializes a new instance of the <see cref="PreEscalationCreateDuplicateDetection"/> class. /// </summary> public PreEscalationCreateDuplicateDetection() : base(typeof(PreEscalationCreateDuplicateDetection)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(20, "Create", "smp_escalation", new Action <LocalPluginContext>(this.ExecutePreEscalationCreateDuplicateDetection))); // Note : you can register for more events here if this plugin is not specific to an individual entity and message combination. // You may also need to update your RegisterFile.crmregister plug-in registration file to reflect any change. }
/// <summary> /// Initializes a new instance of the <see cref="PostProviderCreateTeam"/> class. /// </summary> public PostProviderCreateTeam() : base(typeof(PostProviderCreateTeam)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(40, Constants.Create, Constants.AccountEntityName, new Action <LocalPluginContext>(this.ExecutePostProviderCreateTeam))); // Note : you can register for more events here if this plugin is not specific to an individual entity and message combination. // You may also need to update your RegisterFile.crmregister plug-in registration file to reflect any change. }
/// <summary> /// Registers a new <see cref="Event"/> /// </summary> /// <param name="type">The type of the <see cref="Event"/> to register</param> /// <returns>Whether the event was succesfully registered.</returns> public bool RegisterEventType(Type type) { if (RegisteredEvents.ContainsKey(type) || !EventTypes.TryAdd(type)) { return(false); } else { RegisteredEvents.Add(type, new EventDispatcherValues()); Log.Info($"Registered event type \"{type.Name}\""); return(true); } }
/// <summary> /// Registers all EventHandler methods with the current EventDispatcher. /// </summary> /// <param name="obj">The class to scan for EventHandlers</param> public void RegisterEvents(IEventHandler obj) { int count = 0; var type = typeof(Event); Type objType = obj.GetType(); foreach (var method in objType.GetMethods(BindingFlags.Public | BindingFlags.Instance)) { EventHandlerAttribute attribute = method.GetCustomAttribute <EventHandlerAttribute>(false); if (attribute == null) { continue; } var parameters = method.GetParameters(); if (parameters.Length != 1 || !type.IsAssignableFrom(parameters[0].ParameterType)) { continue; } var paramType = parameters[0].ParameterType; EventDispatcherValues e = null; if (!RegisteredEvents.TryGetValue(paramType, out e)) { if (EventTypes.TryAdd(paramType)) { e = new EventDispatcherValues(); RegisteredEvents.Add(paramType, e); } } if (!e.RegisterEventHandler(attribute, obj, method)) { Log.Warn($"Duplicate found for class \"{obj.GetType()}\" of type \"{paramType}\""); } else { count++; } } Log.Info($"Registered {count} event handlers for \"{obj}\""); }
public PreServiceRequestUpdateCompletedDate() : base(typeof(PreServiceRequestUpdateCompletedDate)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(20, "Update", "incident", new Action <LocalPluginContext>(this.ExecuteCompletedDatebyBuildingTimeZone))); }
public PreSRUpdatePriorityEscalationNotes() : base(typeof(PreSRUpdatePriorityEscalationNotes)) { RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(20, Constants.Update, Constants.IncidentEntityaName, new Action<LocalPluginContext>(this.ExecutePriorityNotes))); }
//public AccountSetTerritories() //{ //} public AccountSetTerritories(string unsecureConfig, string secureConfig) : base(unsecureConfig, secureConfig) { RegisteredEvents.Add(new PluginEvent(eStage.PreOperation, "Create", "account", ExecutePluginLogic)); RegisteredEvents.Add(new PluginEvent(eStage.PreOperation, "Update", "account", ExecutePluginLogic)); }
/// <summary> /// Initializes a new instance of the <see cref="PrePFRRegistrationUpdate"/> class. /// </summary> public PrePFRRegistrationUpdate() : base(typeof(PrePFRRegistrationUpdate)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(20, "Update", "crs_pfrrenewal", new Action <LocalPluginContext>(this.ExecutePrePFRRegistrationUpdate))); }
/// <summary> /// Initializes a new instance of the <see cref="PreCharityRegistrationUpdateSubgridValidation"/> class. /// </summary> public PreCharityRegistrationUpdateSubgridValidation() : base(typeof(PreCharityRegistrationUpdate)) { RegisteredEvents.Add(new Tuple <int, string, string, Action <LocalPluginContext> >(20, "Update", "crs_charityinitialregistration", new Action <LocalPluginContext>(this.ExecutePreCharityRegistrationUpdateSubgridValidation))); }