/// <summary> /// Saves a single instance of <see cref="INotificationMethod"/> /// </summary> /// <param name="notificationMethod">The <see cref="INotificationMethod"/> to be saved</param> /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param> public void Save(INotificationMethod notificationMethod, bool raiseEvents = true) { if (raiseEvents) { if (Saving.IsRaisedEventCancelled(new SaveEventArgs <INotificationMethod>(notificationMethod), this)) { ((NotificationMethod)notificationMethod).WasCancelled = true; return; } } using (new WriteLock(Locker)) { var uow = _uowProvider.GetUnitOfWork(); using (var repository = _repositoryFactory.CreateNotificationMethodRepository(uow)) { repository.AddOrUpdate(notificationMethod); uow.Commit(); } } if (raiseEvents) { Saved.RaiseEvent(new SaveEventArgs <INotificationMethod>(notificationMethod), this); } }
public SmtpNotificationGatewayMethod(IGatewayProviderService gatewayProviderService, INotificationMethod notificationMethod, ExtendedDataCollection extendedData) : base(gatewayProviderService, notificationMethod) { Mandate.ParameterNotNull(extendedData, "extendedData"); _settings = extendedData.GetSmtpProviderSettings(); }
protected NotificationGatewayMethodBase(IGatewayProviderService gatewayProviderService, INotificationMethod notificationMethod) { Mandate.ParameterNotNull(gatewayProviderService, "gatewayProviderService"); Mandate.ParameterNotNull(notificationMethod, "notificationMethod"); _notificationMethod = notificationMethod; _gatewayProviderService = gatewayProviderService; }
/// <summary> /// Initializes a new instance of the <see cref="NotificationGatewayMethodBase"/> class. /// </summary> /// <param name="gatewayProviderService"> /// The gateway provider service. /// </param> /// <param name="notificationMethod"> /// The notification method. /// </param> protected NotificationGatewayMethodBase(IGatewayProviderService gatewayProviderService, INotificationMethod notificationMethod) { Mandate.ParameterNotNull(gatewayProviderService, "gatewayProviderService"); Mandate.ParameterNotNull(notificationMethod, "notificationMethod"); _notificationMethod = notificationMethod; _gatewayProviderService = gatewayProviderService; }
/// <summary> /// Initializes a new instance of the <see cref="SmtpNotificationGatewayMethod"/> class. /// </summary> /// <param name="gatewayProviderService"> /// The gateway provider service. /// </param> /// <param name="notificationMethod"> /// The notification method. /// </param> /// <param name="extendedData"> /// The extended data. /// </param> public SmtpNotificationGatewayMethod(IGatewayProviderService gatewayProviderService, INotificationMethod notificationMethod, ExtendedDataCollection extendedData) : base(gatewayProviderService, notificationMethod) { Mandate.ParameterNotNull(extendedData, "extendedData"); _settings = extendedData.GetSmtpProviderSettings(); _settings.Port = _settings.Port == 0 ? 25 : _settings.Port; }
internal static INotificationMethod ToNotificationMethod(this NotificationMethodDisplay notificationMethodDisplay, INotificationMethod destination) { if (notificationMethodDisplay.Key != Guid.Empty) destination.Key = notificationMethodDisplay.Key; destination.Name = notificationMethodDisplay.Name; destination.Description = notificationMethodDisplay.Description; destination.ServiceCode = notificationMethodDisplay.ServiceCode; return destination; }
internal static INotificationMethod ToNotificationMethod(this NotificationMethodDisplay notificationMethodDisplay, INotificationMethod destination) { if (notificationMethodDisplay.Key != Guid.Empty) { destination.Key = notificationMethodDisplay.Key; } destination.Name = notificationMethodDisplay.Name; destination.Description = notificationMethodDisplay.Description; destination.ServiceCode = notificationMethodDisplay.ServiceCode; return(destination); }
/// <summary> /// Deletes a <see cref="INotificationMethod"/> /// </summary> /// <param name="method">The <see cref="INotificationMethod"/> to be deleted</param> public void Delete(INotificationMethod method) { _notificationMethodService.Delete(method); }
/// <summary> /// Saves a <see cref="INotificationMethod"/> /// </summary> /// <param name="method">The <see cref="INotificationMethod"/> to be saved</param> public void Save(INotificationMethod method) { _notificationMethodService.Save(method); }
/// <summary> /// Saves a single instance of <see cref="INotificationMethod"/> /// </summary> /// <param name="notificationMethod">The <see cref="INotificationMethod"/> to be saved</param> /// <param name="raiseEvents">Optional boolean indicating whether or not to raise events</param> public void Save(INotificationMethod notificationMethod, bool raiseEvents = true) { if (raiseEvents) if (Saving.IsRaisedEventCancelled(new SaveEventArgs<INotificationMethod>(notificationMethod), this)) { ((NotificationMethod)notificationMethod).WasCancelled = true; return; } using (new WriteLock(Locker)) { var uow = UowProvider.GetUnitOfWork(); using (var repository = RepositoryFactory.CreateNotificationMethodRepository(uow)) { repository.AddOrUpdate(notificationMethod); uow.Commit(); } } if (raiseEvents) Saved.RaiseEvent(new SaveEventArgs<INotificationMethod>(notificationMethod), this); }