public string ReadSettings(ActivityEventNotifierIdentity notificationType) { (string resourceName, Assembly assembly) = GetEmbeddedResource(notificationType); try { return(_embeddedResourceService.ReadResourceContent(resourceName, assembly)); } catch (FileNotFoundException) { return(null); } }
internal UiNotificationMessage GetUiNotificationMessage( Guid receiverId, Enum activityType, Enum notificationType, INotifierDataValue newValue) { var notificationIdentity = new ActivityEventNotifierIdentity(activityType, notificationType, UiNotifierType); var template = _notificationSettingsService.Get <UiNotifierTemplate>(notificationIdentity).Template; var receiver = _intranetMemberService.Get(receiverId); var message = _notificationModelMapper.Map(newValue, template, receiver); return(message); }
public async Task <NotifierSettingModel <T> > GetAsync <T>(ActivityEventNotifierIdentity activityEventNotifierIdentity) where T : INotifierTemplate { var defaultTemplate = await _backofficeNotificationSettingsProvider.GetAsync <T>(activityEventNotifierIdentity); if (defaultTemplate == null) { return(null); } var(setting, _) = await FindOrCreateSettingAsync <T>(activityEventNotifierIdentity); var mappedSetting = MappedNotifierSetting(setting, activityEventNotifierIdentity, defaultTemplate); return(mappedSetting); }
public async Task <NotificationSettingDefaults <T> > GetAsync <T>(ActivityEventNotifierIdentity identity) where T : INotifierTemplate { var result = (await _backofficeSettingsReader.ReadSettingsAsync(identity)).Deserialize <NotificationSettingDefaults <T> >(); return(result); }
public NotificationSettingDefaults <T> Get <T>(ActivityEventNotifierIdentity identity) where T : INotifierTemplate { var result = _backofficeSettingsReader.ReadSettings(identity).Deserialize <NotificationSettingDefaults <T> >(); return(result); }
protected virtual string GetEmbeddedResourceFileName(ActivityEventNotifierIdentity type) => $"{type.NotifierType}.{type.Event.ActivityType.ToString()}.{type.Event.NotificationType.ToString()}.json";
protected virtual string GetEmbeddedResourceName(ActivityEventNotifierIdentity notificationType, Assembly assembly) => $"{GetRootFolder(assembly)}.{GetEmbeddedResourceFileName(notificationType)}";
protected virtual Assembly GetResourceAssembly(ActivityEventNotifierIdentity notificationType) => Assembly.GetExecutingAssembly();
protected virtual (string resourceName, Assembly assembly) GetEmbeddedResource(ActivityEventNotifierIdentity notificationType) { Assembly assembly = GetResourceAssembly(notificationType); string resourceName = GetEmbeddedResourceName(notificationType, assembly); return(resourceName, assembly); }