public ValidadorDeEmpresaExistente(NotificationContext notificationContext) { _notificationContext = notificationContext; }
public DeleteCommandHandler(NotificationContext notificationContext, IService <TEntity, TType> service) { this._notificationContext = notificationContext; this._service = service; }
public ArticlesController(IMediator mediator, NotificationContext notificationContext) : base(mediator, notificationContext) { }
public EntityValidator(NotificationContext notification) { _notification = notification; }
public QuestionService(IRepositoryQuestion repositoryQuestion, IRepositoryAnswer repositoryAnswer, NotificationContext notificationContext) { _repositoryQuestion = repositoryQuestion; _repositoryAnswer = repositoryAnswer; _notificationContext = notificationContext; }
/// <summary> /// Sends the user registered notification. /// </summary> /// <param name="userName">The user.</param> public static void SendUserRegisteredNotification(string userName) { if (userName == "") throw new ArgumentNullException("userName"); var user = GetUser(userName); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template and replace the tokens var template = NotificationManager.Instance.LoadEmailNotificationTemplate("UserRegistered", emailFormatType); var subject = NotificationManager.Instance.LoadNotificationTemplate("UserRegisteredSubject"); var data = new Dictionary<string, object>(); var u = new ITUser { CreationDate = user.CreationDate, Email = user.Email, UserName = user.UserName, DisplayName = new WebProfile().GetProfile(user.UserName).DisplayName, IsApproved = user.IsApproved }; data.Add("User", u); template = NotificationManager.GenerateNotificationContent(template, data); //all admin notifications sent to admin user defined in host settings, var adminNotificationUsername = HostSettingManager.Get(HostSettingNames.AdminNotificationUsername); var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = subject, UserDisplayName = GetUserDisplayName(adminNotificationUsername), Username = adminNotificationUsername }; NotificationManager.Instance.SendNotification(context); }
public override async Task HandleNotification(object parameters, NotificationContext context) { this.LanguageServer.Stop(); }
public CargoController(IArmazenadorDeCargo armazenadorDeCargo, IAlteradorDeCargo alteradorDeCargo, IRemovedorDeCargo removedorDeCargo, IConsultasDeCargo consultasDeCargo, NotificationContext notificationContext) { _armazenadorDeCargo = armazenadorDeCargo; _alteradorDeCargo = alteradorDeCargo; _removedorDeCargo = removedorDeCargo; _consultasDeCargo = consultasDeCargo; }
protected MainController(NotificationContext notificationContext) { _notificationContext = notificationContext; }
public GetAllOptionsHandler( NotificationContext notificationContext, IOptionRepository optionRepository) { _notificationContext = notificationContext; _optionRepository = optionRepository; }
public ProductApplicationService(IUnitOfWork unitOfWork, IMapper mapper, NotificationContext notificationContext) { _unitOfWork = unitOfWork; _mapper = mapper; _notificationContext = notificationContext; }
public Handler(ApiDbContext db, NotificationContext notificationContext, IConfiguration configuration) { this.db = db; this.notificationContext = notificationContext; this.configuration = configuration; }
///public void SendNotification(string username, string subject, string bodyText, string userDisplayName) /// <summary> /// Sends the notification. /// </summary> /// <param name="notificationContext"></param> public void SendNotification(NotificationContext notificationContext) { if (string.IsNullOrEmpty(notificationContext.Username)) throw new ArgumentException("Unable send notification username cannot be null or empty."); if (string.IsNullOrEmpty(notificationContext.Subject)) throw new ArgumentException("Unable send notification subject cannot be null or empty."); if (string.IsNullOrEmpty(notificationContext.BodyText)) throw new ArgumentException("Unable send notification body text cannot be null or empty."); // _NotificationQueue must be protected with Locks lock (NotificationQueue) { // En-queue notification into the send queue NotificationQueue.Enqueue(notificationContext); // If we only have one notification in the queue we will need to start a new thread if (NotificationQueue.Count > 1) { // Create and Start a New Thread (new System.Threading.Thread(() => { // Get the First Notification that need sending from the queue NotificationContext notificationToSend; lock (NotificationQueue) { notificationToSend = NotificationQueue.Dequeue(); } // Whilst we still have queued notifications to send, we stay in this thread sending them while (notificationToSend != null) { // In The Thread Send The Notification foreach (var nt in _notificationPlugins.Where(nt => nt.Enabled)) { nt.SendNotification(notificationToSend); } // Sleep for 10 seconds, enable the line below to test the queuing of notifications is working correctly //Thread.Sleep(10000); // We attempt to get the next Notification that need sending from the queue lock (NotificationQueue) { // Get a new NotificationToSend if we can, otherwise reset notificationToSend = NotificationQueue.Count > 0 ? NotificationQueue.Dequeue() : null; } } } )).Start(); } } }
/// <summary> /// Sends the issue add notifications. /// </summary> /// <param name="issueId">The issue id.</param> public static void SendIssueAddNotifications(int issueId) { // validate input if (issueId <= Globals.NEW_ID) throw (new ArgumentOutOfRangeException("issueId")); var issue = DataProviderManager.Provider.GetIssueById(issueId); var issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template var template = NotificationManager.Instance.LoadEmailNotificationTemplate("IssueAdded", emailFormatType); var data = new Dictionary<string, object> {{"Issue", issue}}; template = NotificationManager.GenerateNotificationContent(template, data); var subject = NotificationManager.Instance.LoadNotificationTemplate("IssueAddedSubject"); foreach (var notify in issNotifications) { try { var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = String.Format(subject, issue.FullId, issue.ProjectName), UserDisplayName = UserManager.GetUserDisplayName(notify.NotificationUsername), Username = notify.NotificationUsername }; NotificationManager.Instance.SendNotification(context); } catch (Exception ex) { ProcessException(ex); } } }
public Handler(ApiDbContext db, NotificationContext notificationContext) { this.db = db; this.notificationContext = notificationContext; }
public override async Task HandleNotification(CloseSymbolsLibraryRequest parameters, NotificationContext context) { this.Server.SymbolsLibraries.RemoveLibrary(parameters.libraryId); }
/// <summary> /// Sends the user new password notification. /// </summary> /// <param name="user">The user.</param> /// <param name="newPassword">The new password.</param> public static void SendUserNewPasswordNotification(MembershipUser user, string newPassword) { if (user == null) throw new ArgumentNullException("user"); if (string.IsNullOrEmpty(newPassword)) throw new ArgumentNullException("newPassword"); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template and replace the tokens var template = NotificationManager.Instance.LoadEmailNotificationTemplate("PasswordReset", emailFormatType); var subject = NotificationManager.Instance.LoadNotificationTemplate("PasswordResetSubject"); var data = new Dictionary<string, object>(); var u = new ITUser { CreationDate = user.CreationDate, Email = user.Email, UserName = user.UserName, DisplayName = new WebProfile().GetProfile(user.UserName).DisplayName, IsApproved = user.IsApproved }; data.Add("User", u); data.Add("Password", newPassword); template = NotificationManager.GenerateNotificationContent(template, data); var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = subject, UserDisplayName = UserManager.GetUserDisplayName(user.UserName), Username = user.UserName }; NotificationManager.Instance.SendNotification(context); }
public CommandHandler(IUnitOfWork unitOfWork, NotificationContext notificationContext, IMediatorHandler mediator) { this.unitOfWork = unitOfWork; this.notificationContext = notificationContext; this.mediator = mediator; }
/// <summary> /// Sends an email to the user that is assigned to the issue /// </summary> /// <param name="notification"></param> public static void SendNewAssigneeNotification(IssueNotification notification) { if (notification == null) throw (new ArgumentNullException("notification")); if (notification.IssueId <= Globals.NEW_ID) throw (new ArgumentOutOfRangeException("notification", "The issue id is not valid for this notification")); var issue = DataProviderManager.Provider.GetIssueById(notification.IssueId); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template var template = NotificationManager.Instance.LoadEmailNotificationTemplate("NewAssignee", emailFormatType); var data = new Dictionary<string, object> {{"Issue", issue}}; template = NotificationManager.GenerateNotificationContent(template, data); var subject = NotificationManager.Instance.LoadNotificationTemplate("NewAssigneeSubject"); try { var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = String.Format(subject, issue.FullId), UserDisplayName = UserManager.GetUserDisplayName(notification.NotificationUsername), Username = notification.NotificationUsername }; NotificationManager.Instance.SendNotification(context); } catch (Exception ex) { ProcessException(ex); } }
public void Configure(IApplicationBuilder app, IServiceProvider serviceProvider) { //TODO Create db context CultureInfo.DefaultThreadCurrentCulture = CultureInfo.GetCultureInfo("en-US"); CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US"); Settings.Initialize(Configuration); IErpService service = null; try { DbContext.CreateContext(Settings.ConnectionString); service = app.ApplicationServices.GetService <IErpService>(); var cfg = new AutoMapper.Configuration.MapperConfigurationExpression(); AutoMapperConfiguration.Configure(cfg); AutoMapper.Mapper.Initialize(cfg); service.InitializeSystemEntities(); service.InitializeBackgroundJobs(); app.UseErpMiddleware(); //IHostingEnvironment env = app.ApplicationServices.GetService<IHostingEnvironment>(); //if (env.IsDevelopment()) app.UseDeveloperExceptionPage(); IPluginService pluginService = app.ApplicationServices.GetService <IPluginService>(); IHostingEnvironment hostingEnvironment = app.ApplicationServices.GetRequiredService <IHostingEnvironment>(); pluginService.Initialize(serviceProvider); IWebHookService webHookService = app.ApplicationServices.GetService <IWebHookService>(); webHookService.Initialize(pluginService); NotificationContext.Initialize(); NotificationContext.Current.SendNotification(new Notification { Channel = "*", Message = "ERP configuration loaded and completed." }); } finally { DbContext.CloseContext(); } if (service != null) { service.StartBackgroundJobProcess(); } //Enable CORS //app.Use((context, next) => //{ // context.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" }); // context.Response.Headers.Add("Access-Control-Allow-Headers", new[] { "*" }); // context.Response.Headers.Add("Access-Control-Allow-Methods", new[] { "*" }); // return next(); //}); //app.Run(async context => //{ // IErpService service = app.ApplicationServices.GetService<IErpService>(); // service.Run(); // context.Response.ContentType = "text/html"; // context.Response.StatusCode = 200; // System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); // byte[] buffer = encoding.GetBytes("<h1>test</h1>"); // await context.Response.Body.WriteAsync(buffer, 0, buffer.Length); //}); // Add the following to the request pipeline only in development environment. if (string.Equals(hostingEnviroment.EnvironmentName, "Development", StringComparison.OrdinalIgnoreCase)) { app.UseDeveloperExceptionPage(); } else { // Add Error handling middleware which catches all application specific errors and // send the request to the following path or controller action. app.UseExceptionHandler("/Home/Error"); } //TODO Check what was done here in RC1 //app.UseIISPlatformHandler(options => options.AutomaticAuthentication = false); //Should be before Static files app.UseResponseCompression(); // Add static files to the request pipeline. Should be last middleware. app.UseStaticFiles(new StaticFileOptions { OnPrepareResponse = ctx => { const int durationInSeconds = 60 * 60 * 24 * 30; //30 days caching of these resources ctx.Context.Response.Headers[HeaderNames.CacheControl] = "public,max-age=" + durationInSeconds; } }); // Add MVC to the request pipeline. app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action}/{id?}", defaults: new { controller = "Home", action = "Index" }); // Uncomment the following line to add a route for porting Web API 2 controllers. // routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}"); }); }
public UpdateWeaponHandler(IWeaponRepository repository, NotificationContext notification) { this.repository = repository ?? throw new ArgumentNullException(nameof(repository)); this.notification = notification ?? throw new ArgumentNullException(nameof(notification)); }
private void AddNotificationProductNotFound() { NotificationContext.AddNotification("ProductGetByIdMapperOperation", "Product not found."); }
public ExceptionHandlerBehaviour(ILogger <TRequest> logger, NotificationContext notificationContext) { _logger = logger; _notificationContext = notificationContext; }
public MongoUnitOfWorkFilter(NotificationContext notificationContext, IUnitOfWork unitOfWork) { _notificationContext = notificationContext; _unitOfWork = unitOfWork; }
public GetAllQueryHandler(NotificationContext context) { _context = context; }
public FilterByNameWeaponHandler(ISession session, NotificationContext notificationContext) { this.session = session; this.notificationContext = notificationContext; }
public NotificationFilter(NotificationContext notificationContext) { _notificationContext = notificationContext; }
public CreateNotificationCommandHandler(NotificationContext context) { _context = context; }
public async Task <Review> AddReviewAsync(ReviewModel reviewModel, CancellationToken cancellationToken) { if (reviewModel is null) { NotificationContext.AddNotificationWithType(ServicesResource.Object_Null, typeof(ReviewModel)); return(default);
public ArmazenadorDeEmpresa(NotificationContext notificationContext, IEmpresaRepository empresaRepository) { _notificationContext = notificationContext; _empresaRepository = empresaRepository; }
public PedidoService(IPedidoRepository pedidoRepository, NotificationContext notificationContext, PedidoNotificationMessages pedidoNotificationMessages) : base(pedidoRepository) { _pedidoRepository = pedidoRepository; _notificationContext = notificationContext; _pedidoNotificationMessages = pedidoNotificationMessages; }
public ValidadorDeFuncionarioExistente(NotificationContext notificationContext) { _notificationContext = notificationContext; }
public NotificationItemsController(NotificationContext context) { _context = context; queueClient = new QueueClient(ServiceBusConnectionString, QueueName); }
public GetNotificationTypesCountQueryHandler(NotificationContext context) { _context = context; }
/// <summary> /// Sends the user password reminder. /// </summary> /// <param name="user"></param> /// <param name="passwordAnswer"></param> /// <returns></returns> public static void SendUserPasswordReminderNotification(MembershipUser user, string passwordAnswer) { if (user == null) throw new ArgumentNullException("user"); //TODO: Move this to xslt notification //load template and replace the tokens var template = NotificationManager.Instance.LoadNotificationTemplate("PasswordReminder"); var subject = NotificationManager.Instance.LoadNotificationTemplate("PasswordReminderSubject"); var displayname = GetUserDisplayName(user.UserName); var context = new NotificationContext { BodyText = String.Format(template, HostSettingManager.Get(HostSettingNames.ApplicationTitle)), EmailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text), Subject = subject, UserDisplayName = displayname, Username = user.UserName }; NotificationManager.Instance.SendNotification(context); }
public NotificationController(NotificationContext notificationContext, IHubContext <BroadcastHub, IHubClient> hubContext) { _notificationContext = notificationContext; _hubContext = hubContext; }
/// <summary> /// Sends the user verification notification. /// </summary> /// <param name="user">The user.</param> public static void SendUserVerificationNotification(MembershipUser user) { if (user == null) throw new ArgumentNullException("user"); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template and replace the tokens var template = NotificationManager.Instance.LoadEmailNotificationTemplate("UserVerification", emailFormatType); var subject = NotificationManager.Instance.LoadNotificationTemplate("UserVerification"); var data = new Dictionary<string, object>(); if (user.ProviderUserKey != null) { var u = new ITUser { Id = (Guid)user.ProviderUserKey, CreationDate = user.CreationDate, Email = user.Email, UserName = user.UserName, DisplayName = new WebProfile().GetProfile(user.UserName).DisplayName, IsApproved = user.IsApproved }; data.Add("User", u); } template = NotificationManager.GenerateNotificationContent(template, data); var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = subject, UserDisplayName = GetUserDisplayName(user.UserName), Username = user.UserName }; NotificationManager.Instance.SendNotification(context); }
/// <summary> /// Sends the issue notifications. /// </summary> /// <param name="issueId">The issue id.</param> /// <param name="issueChanges">The issue changes.</param> public static void SendIssueNotifications(int issueId, IEnumerable<IssueHistory> issueChanges) { // validate input if (issueId <= Globals.NEW_ID) throw (new ArgumentOutOfRangeException("issueId")); var issue = DataProviderManager.Provider.GetIssueById(issueId); var issNotifications = DataProviderManager.Provider.GetIssueNotificationsByIssueId(issueId); var emailFormatType = HostSettingManager.Get(HostSettingNames.SMTPEMailFormat, EmailFormatType.Text); //load template var template = NotificationManager.Instance.LoadEmailNotificationTemplate("IssueUpdatedWithChanges", emailFormatType); var data = new Dictionary<string, object> {{"Issue", issue}}; var writer = new System.IO.StringWriter(); using (System.Xml.XmlWriter xml = new System.Xml.XmlTextWriter(writer)) { xml.WriteStartElement("IssueHistoryChanges"); foreach (var issueHistory in issueChanges) { IssueHistoryManager.SaveOrUpdate(issueHistory); xml.WriteRaw(issueHistory.ToXml()); } xml.WriteEndElement(); data.Add("RawXml_Changes", writer.ToString()); } template = NotificationManager.GenerateNotificationContent(template, data); var subject = NotificationManager.Instance.LoadNotificationTemplate("IssueUpdatedSubject"); var displayname = UserManager.GetUserDisplayName(Security.GetUserName()); foreach (var notify in issNotifications) { try { var context = new NotificationContext { BodyText = template, EmailFormatType = emailFormatType, Subject = String.Format(subject, issue.FullId, displayname), UserDisplayName = UserManager.GetUserDisplayName(notify.NotificationUsername), Username = notify.NotificationUsername }; NotificationManager.Instance.SendNotification(context); } catch (Exception ex) { ProcessException(ex); } } }