private Guid AddNotificationBatch(GenericNotificationViewModel model) { //Add the Notification Batch ..... var notificationTemplate = _notificationTemplatesService.GetByKey(model.NotificationTemplateKey); if (notificationTemplate != null) { NotificationBatch notificationBatch = new NotificationBatch(); Guid batchGuid = Guid.NewGuid(); notificationBatch.StartDate = model.CurrentDate; if (!string.IsNullOrEmpty(model.NotificationTemplateKey)) { notificationBatch.ResourceType = model.NotificationTemplateKey.Split('.')[0]; notificationBatch.ResourceAction = model.NotificationTemplateKey.Split('.')[1]; } notificationBatch.AdditionalMessage = ""; notificationBatch.ResourceId = model.ResourceId; notificationBatch.NotificationBatchGuid = batchGuid; notificationBatch.NotificationTemplateGuid = notificationTemplate.NotificationTemplateGuid; notificationBatch.CreatedBy = model.CurrentUserGuid; notificationBatch.CreatedOn = model.CurrentDate; _notificationBatchService.Add(notificationBatch); return(batchGuid); } return(Guid.Empty); }
public Guid Add(NotificationBatch model) { var sql = @"INSERT INTO NotificationBatch (NotificationBatchGuid ,NotificationTemplateGuid ,ResourceId ,ResourceType ,ResourceAction ,StartDate ,AdditionalMessage ,CreatedOn ,CreatedBy) VALUES (@NotificationBatchGuid ,@NotificationTemplateGuid ,@ResourceId ,@ResourceType ,@ResourceAction ,@StartDate ,@AdditionalMessage ,@CreatedOn ,@CreatedBy)"; _context.Connection.Execute(sql, model); return(model.NotificationBatchGuid); }
public void SendNotifications(Notification[] notifications) { NotificationBatch batch = new NotificationBatch(this, notifications); bool complete = false; while (!complete) { complete = batch.SendMessages(); } batch.Complete(); }
public void SendNotifications(Notification[] notifications) { NotificationBatch batch = new NotificationBatch(this, notifications); bool complete = false; while(!complete) complete = batch.SendMessages(); batch.Complete(); }
public Guid Add(NotificationBatch model) { return(_notificationBatchRepository.Add(model)); }