public Task <CommunicationResponse> Handle(SendNotificationRequest Request, CancellationToken cancellationToken) { try { var Notification = new NotificationQueue() { Message = Request.Message, Subject = Request.Subject, DeviceID = Request.DeviceID, Status = 0, CreatedBy = 1, CreatedDate = DateTime.UtcNow }; _MessageRepository.Add(Notification); return(Task.FromResult(new CommunicationResponse { ErrorCode = 101, ReturnMsg = "Message sent." })); } catch (Exception ex) { return(Task.FromResult(new CommunicationResponse { ErrorCode = 99, ReturnMsg = "Message not sent." })); } }
public void NotificationQueue_Default_Constructor() { // Arrange // Act var queue = new NotificationQueue(); // Assert queue.Id.Should().Be(0); queue.Key.Should().BeEmpty(); queue.Status.Should().Be(NotificationStatus.Pending); queue.Priority.Should().Be(NotificationPriorities.Normal); queue.Encoding.Should().Be(NotificationEncodings.Utf8); queue.SendOn.Should().Be(new DateTime()); queue.Subject.Should().BeNull(); queue.BodyType.Should().Be(NotificationBodyTypes.Html); queue.Body.Should().BeNull(); queue.Bcc.Should().BeNull(); queue.Cc.Should().BeNull(); queue.Tag.Should().BeNull(); queue.ProjectId.Should().BeNull(); queue.Project.Should().BeNull(); queue.ToAgencyId.Should().BeNull(); queue.ToAgency.Should().BeNull(); queue.TemplateId.Should().BeNull(); queue.Template.Should().BeNull(); queue.ChesMessageId.Should().BeNull(); queue.ChesTransactionId.Should().BeNull(); queue.Responses.Should().BeEmpty(); }
public void NotificationQueue_Constructor_01() { // Arrange var date = DateTime.UtcNow; var template = new NotificationTemplate("template", "subject", "body") { BodyType = NotificationBodyTypes.Text, Priority = NotificationPriorities.Low, Encoding = NotificationEncodings.Base64, Tag = "tag" }; var project = EntityHelper.CreateProject(1, 1); // Act var queue = new NotificationQueue(template, project, "to", "subject", "body"); // Assert queue.Id.Should().Be(0); queue.Key.Should().NotBeEmpty(); queue.TemplateId.Should().Be(template.Id); queue.Template.Should().Be(template); queue.Subject.Should().Be("subject"); queue.Body.Should().Be("body"); queue.BodyType.Should().Be(template.BodyType); queue.Priority.Should().Be(template.Priority); queue.Encoding.Should().Be(template.Encoding); queue.Tag.Should().Be(template.Tag); queue.ProjectId.Should().Be(project.Id); queue.Project.Should().Be(project); queue.To.Should().Be("to"); queue.SendOn.Should().BeOnOrAfter(date); }
public void AddNotificationQueue(NotificationContainer noti) { lock (NotificationQueue) { NotificationQueue.Add(noti); } }
public void ClearNotificationQueue() { lock (NotificationQueue) { NotificationQueue.Clear(); } }
private void DelayedNotifications() { remainingSeconds = ConvertMinutesToSeconds(minutes, seconds); float timeToLastMinute = remainingSeconds - 60; Game.DelayedEvents.AddDelayedAction(delegate { NotificationQueue.PushNotification("Il reste une minute."); }, timeToLastMinute); float timeToLastFiveMinutes = remainingSeconds - 300; if (timeToLastFiveMinutes > 0) { Game.DelayedEvents.AddDelayedAction(delegate { NotificationQueue.PushNotification("Il reste 5 minutes."); }, timeToLastFiveMinutes); } float timetoLastTenMinutes = remainingSeconds - 600; if (timetoLastTenMinutes > 0) { Game.DelayedEvents.AddDelayedAction(delegate { NotificationQueue.PushNotification("Il reste 10 minutes."); }, timetoLastTenMinutes); } }
public void ProcessChoiceResults() { DisplayCurrentNodeCharacterPortrait(); DisableMe(); dialogueUI.DestroyInteractiveChoices(); dialogueUI.InsertSpacer(); if (dialogueUI.GetChoiceResultsCount(myID) > 0) { dialogueUI.ActivateQuests(myID); dialogueUI.ActivateQuestTasks(myID); //dialogueUI.ActivateNewGrammar(myID); dialogueUI.ActivateNewWelsh(myID); dialogueUI.MarkDialogueComplete(myID); dialogueUI.ActivateNewDialogue(myID); notificationQueue = FindObjectOfType <NotificationQueue>(); notificationQueue.DisplayQueuedNotifications(); } if (isVocabTest) { dialogueUI.CurrentPlayerChoice = this; dialogueUI.ProcessPlayerChoiceTest(vocabArray, testData); } else if (myNextNode != "") { dialogueUI.DisplayDialogueNode(GetDialogueNodeData(myNextNode)); } else { dialogueUI.SetNotInUse(); } }
public ComparisonTracker(IMailSelector selection) { _selection = selection; _workTodo = new NotificationQueue<ComparisonInformation>(); _workTodo.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(_workTodo_CollectionChanged); Logger.LogInfo(string.Format(CultureInfo.CurrentCulture, "EMAILTRACKING: Initialised Comparison Tracker - Working Threads Available = {0}", 1)); }
/// <summary> /// Add to the notifications queue to process later with back ground process. /// </summary> /// <param name="notification"></param> /// <param name="cancellationToken"></param> /// <returns></returns> public async Task Handle(RegisteredPatientEvent notification, CancellationToken cancellationToken) { var notificationToAdd = new NotificationQueue(notification.CreatedOn, notification.GetType().FullName, JsonConvert.SerializeObject(notification)); // await _notificationQueueRepository.InsertAsync(notificationToAdd); // dummy for now await Task.CompletedTask; }
public async Task AddNotification(string body, EmailConf emailGeneral, string subject, string attachment = null) { try { var notification = new NotificationQueue { Subject = subject, Body = body, Attachment = attachment, To = emailGeneral.Email, ToName = emailGeneral.FullName, From = _settings.Value.From, FromName = _settings.Value.FromName, ReplyTo = _settings.Value.ReplyTo, ReplyToName = _settings.Value.ReplyToName, Priority = emailGeneral.Priority, CreatedTimestamp = DateTime.Now, FailCount = 0 }; _notificationDbContext.NotificationQueues.Add(notification); await _notificationDbContext.SaveChangesAsync(); } catch (Exception e) { _logger.LogError(e.Message); } }
private void CheckForNewNotifications(object sender, EventArgs e) { var world = WarframeInfoProvider.GetWorldState(); var newAlerts = WarframeInfoProvider.GetAlerts(world); var tmpAlerts = new ObservableCollection <Alert>(); foreach (Alert alert in newAlerts) { if (!(Alerts.Any(x => x._id.oid == alert._id.oid)) && alert != null) { NotificationQueue.Add(alert); } alert.ToNotificationString(); tmpAlerts.Add(alert); } Alerts = tmpAlerts; WarframeInfoProvider.GetInvasions(world); var newInvasions = WarframeInfoProvider.GetInvasions(world); var tmpInvasions = new ObservableCollection <Invasion>(); foreach (Invasion invasion in newInvasions) { if (!(Invasions.Any(x => x._id.oid == invasion._id.oid)) && invasion != null) { NotificationQueue.Add(invasion); } invasion.ToNotificationString(); tmpInvasions.Add(invasion); } Invasions = tmpInvasions; }
void Update() { rectTransform.position = Camera.main.WorldToScreenPoint(Node.Position); TimeRemaining -= Time.deltaTime; if (TimeRemaining < 0) { clientManager.RemoveFromOrderList(gameObject); Node.Order = null; NotificationQueue.PushNotification("Vous avez manquer une livraison !"); Destroy(gameObject); } else if (TimeRemaining <= clientManager.TimeRemainingWarning) { objectiveWarningObject.GetComponent <Image>().enabled = true; countdownObject.GetComponent <Text>().color = Color.white; } if (Node.pizza.Count > 0) { Node.pizza[0].Destroy(); PizzaAmount--; } countdownObject.GetComponent <Text>().text = Convert.ToString((int)TimeRemaining); pizzaCountObject.GetComponent <Text>().text = Convert.ToString(PizzaAmount); }
/* publish function publishes a Notification Event */ public void Publish() { int i = 0; while (true) { /* Generate the test / publish message as per interval config */ Thread.Sleep(NotificationInterval); if (OnPublish != null) { MessageEvent notificationObj = new MessageEvent(DateTime.Now, "New message arrived from"); Random random = new Random(); var msg = new NotificationQueue { Id = random.Next(), ChannelMessage = ((MessageSubscriber)OnPublish.Target).SubscriberName + " " + ((MessageSubscriber)OnPublish.Target).SubscriberCategory + " " + this.PublisherName + " at " + DateTime.Now.ToString() }; allNotification.Add(msg); allNotification.Add(msg); OnPublish(this, notificationObj); } Thread.Yield(); i++; if (i == 10) /* for test set count and return */ { break; } } }
/// <summary> /// Notifies the specified data. /// </summary> /// <param name="data">The data.</param> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public virtual async Task NotifyAsync(T data) { if (Subscribed) { OnNotify?.Invoke(data); await NotificationQueue.AddAsync(data); } }
/// <summary> /// SendEmailCommand /// </summary> /// <param name="emailAddress"></param> /// <param name="subject"></param> /// <param name="message"></param> public SendEmailCommand(NotificationQueue notificationQueue, string emailAddress, string subject, string message, AppointmentNotification appointmentNotification = null) { Notification = notificationQueue; EmailAddress = emailAddress; Subject = subject; Message = message; AppointmentNotification = appointmentNotification; }
/// <summary> /// Notifies the specified data. /// </summary> /// <param name="data">The data.</param> public virtual void Notify(T data) { if (Subscribed) { OnNotify?.Invoke(data); NotificationQueue.Add(data); } }
public void AddIdentityToNotifiticationQueue(long identityId) { var cooldownKey = new EntityIdCooldownKey(identityId); var delay = Config.NotifyDelaySeconds * 1000L; CooldownManagerNotificationQueue.StartCooldown(cooldownKey, NOTIFICATION_COOLDOWN_COMMAND, delay); NotificationQueue.Add(cooldownKey); }
public void UnlockNotificationStatus() { status = NotificationStatus.Unlocked; if (isNotificationsQueued) { for (int i = 0; i < notificationQueue.Count; i++) { NotificationQueue nq = notificationQueue.Dequeue(); NotifyAllControllers(nq.Notification, nq.param); } } }
public void Lose() { if (gameEnded) { return; } gameEnded = true; NotificationQueue.PushNotification(new Notification() { text = "You lost", onHide = ReturnToLevelSelect }); }
/// <summary> /// Instantiate a new <see cref="SubscriptionProcessor"/> class. /// </summary> /// <param name="servers">Discord servers dictionary</param> /// <param name="config">Configuration file</param> /// <param name="whm">Webhook controller class</param> public SubscriptionProcessor(Dictionary <ulong, DiscordClient> servers, WhConfig config, WebhookController whm) { _logger.Trace($"SubscriptionProcessor::SubscriptionProcessor"); _servers = servers; _whConfig = config; _whm = whm; _queue = new NotificationQueue(); Manager = new SubscriptionManager(_whConfig); ProcessQueue(); }
public VSTalkCore(IWindowsManager windowsManager, IEnvironmentManager environmentManager, IModelContext modelContext) { WindowsManager = windowsManager; EnvironmentManager = environmentManager; ModelContext = modelContext; NotificationQueue = new NotificationQueue(); Connector = new ClientConnector(this); ControlsRepository = new ControlRepository(this); LoadConnections(); }
public MainViewModel() { MessengerInstance.Register <ChangeViewMessage>(this, ReceiveChangeViewMessage); SetInitialViewCommand = new RelayCommand(ExecuteSetInitialViewCommand); OnPreviewMouseLeftButtonUp = new RelayCommand(ExecuteOnPreviewMouseLeftButtonUp); ViewTabs.Add(CreateItem(ViewManager.AdminTitle, ViewManager.AdminId, "Lock")); ViewTabs.Add(CreateItem(ViewManager.HomeTitle, ViewManager.HomeId, "Home")); ViewTabs.Add(CreateItem(ViewManager.LiveChartTitle, ViewManager.LiveChartId, "film")); NotificationQueue.Enqueue("Welcome to Material Desgin !!"); }
public SubscriptionProcessor(DiscordClient client, WhConfig config, WebhookManager whm)//, EmbedBuilder embedBuilder) { _logger.Trace($"SubscriptionProcessor::SubscriptionProcessor"); _client = client; _whConfig = config; _whm = whm; //_embedBuilder = embedBuilder; _queue = new NotificationQueue(); Manager = new SubscriptionManager(_whConfig); ProcessQueue(); }
public void AddEMailLog(MailMessage mail, NotificationQueue queue) { var log = new EmailLog(); log.From = mail.From.Address; log.To = string.Join(';', mail.To.Select(t => t.Address).ToArray()); log.CC = string.Join(';', mail.CC.Select(t => t.Address).ToArray()); log.BCC = string.Join(';', mail.Bcc.Select(t => t.Address).ToArray()); log.MessageBody = mail.Body; log.SentDateTime = DateTime.Now; log.Subject = mail.Subject; log.Description = queue.Description; log.MessageId = queue.MessageId; Add(log); }
void CommandCompleted(Node node) { NotificationQueue.PushNotification("Vous avez complété une commande !"); Objectives currentObjectives = Game.Map.cash; int income = currentObjectives.OrderBaseReward + (currentObjectives.RewardPerPizza * node.pizza.Count); currentObjectives.IncomeCash(income); for (int i = 0; i < node.pizza.Count; i++) { Destroy(node.pizza[i].gameObject); } }
public async Task <long> CreateAsync(Supply supply) { if (supply == null) { throw new ArgumentNullException(nameof(supply)); } this.unitOfWork.Supplies.Add(supply); var notification = new NotificationQueue(supply, Enums.OperationType.Create); this.unitOfWork.NotificationQueues.Add(notification); await this.unitOfWork.CommitAsync(); return(supply.Id); }
public async Task <CommunicationResponse> Handle(SendNotificationRequest Request, CancellationToken cancellationToken) { try { var Notification = new NotificationQueue() { Message = Request.Message, Subject = Request.Subject, DeviceID = Request.DeviceID, TickerText = Request.TickerText, ContentTitle = Request.ContentTitle, Status = 0, CreatedBy = 1, CreatedDate = DateTime.UtcNow }; _MessageRepository.Add(Notification); Notification.InQueueMessage(); _MessageRepository.Update(Notification); IQueryable Result = await _MessageConfiguration.GetAPIConfigurationAsync(1, 2); foreach (CommunicationProviderList Provider in Result) { string Response = await _MessageService.SendNotificationAsync(Notification.DeviceID, Notification.TickerText, Notification.ContentTitle, Notification.Message, Provider.SendURL, Provider.RequestFormat, Provider.SenderID, Provider.MethodType, Provider.ContentType); CopyClass.CopyObject(Provider, ref _GetDataForParsingAPI); _GenerateResponse = _WebApiParseResponse.ParseResponseViaRegex(Response, _GetDataForParsingAPI); if (_GenerateResponse.Status == enTransactionStatus.Success) { Notification.SentMessage(); _MessageRepository.Update(Notification); return(await Task.FromResult(new CommunicationResponse { ReturnCode = enResponseCode.Success, ReturnMsg = EnResponseMessage.NotificationSuccessMessage })); } else { continue; } } Notification.FailMessage(); _MessageRepository.Update(Notification); return(await Task.FromResult(new CommunicationResponse { ReturnCode = enResponseCode.Fail, ReturnMsg = EnResponseMessage.NotificationFailMessage })); } catch (Exception ex) { return(await Task.FromResult(new CommunicationResponse { ReturnCode = enResponseCode.InternalError, ReturnMsg = EnResponseMessage.NotificationExceptionMessage })); } }
public Task <SendNotificationResponse> Handle(SendNotificationRequest Request, CancellationToken cancellationToken) { var Notification = new NotificationQueue() { MobileNo = Request.MobileNo, Message = Request.Message, DeviceID = Request.DeviceID, Status = 0, CreatedBy = 1, CreatedDate = DateTime.UtcNow }; _MessageRepository.Add(Notification); return(Task.FromResult(new SendNotificationResponse { ResponseCode = 101, ResponseMessage = "Message sent." })); }
private int UpdateQueueStatus(NotificationQueue queue, NotificationSentStatus status, String description = "") { queue.Status = status; if (status == NotificationSentStatus.Failed) { queue.RetryCount += 1; } queue.Description = description; if (status == NotificationSentStatus.Sent) { _context.NotificationQueue.Remove(queue); } else { _context.NotificationQueue.Update(queue); } return(_context.SaveChangesAsync().Result); }
private Tuple <NotificationSentStatus, string> SendNotification(NotificationQueue notificationQueue) { var feature = _context.Notification .Include(r => r.SMTP) .Where(r => r.IsActive).ToList(); var description = ""; int completed = 0; foreach (var item in feature) { try { var selectedHandler = _notificationHandlers(item.NotificationType); if (!item.IsActive) { description += $"Feature disabled :{item.NotificationId.ToString()}; "; continue; } var template = _templateGenerator.GetTemplateHandler(new TemplateGenerateView { NotificationQueue = notificationQueue, MessageId = notificationQueue.MessageId, NotificationType = item.NotificationType, }); selectedHandler.Send(template, item); completed++; } catch (Exception ex) { description = ex.ToString(); Log.Error(ex, "Notifier.SendNotification"); } } if (completed == 0) { return(Tuple.Create(NotificationSentStatus.Failed, description)); } //if (completed == feature.) // return Tuple.Create(Models.NotificationSentStatus.Sent, description); return(Tuple.Create(NotificationSentStatus.Partial, description)); }
public void Notify(Notification notification, NotificationParam param = null) { switch (status) { case NotificationStatus.Locked: if (param != null) { if (param.shouldQueue) { NotificationQueue nq = new NotificationQueue(notification, param); notificationQueue.Enqueue(nq); } } break; case NotificationStatus.Unlocked: NotifyAllControllers(notification, param); break; } }