コード例 #1
0
        public string JsonDtoCompose(NotificationTypeDictionary notificationType, Dictionary<string, string> data)
        {
            var createdTasksTypes = new[]
                                        {
                                                NotificationTypeDictionary.TaskCreated,
                                                NotificationTypeDictionary.TaskCreateDocCreated,
                                                NotificationTypeDictionary.TaskVisaCreated,
                                                NotificationTypeDictionary.TaskManualExecute
                                        };

            if (createdTasksTypes.Contains(notificationType))
            {

                var newTaskNotification = new NewItemsNotification
                {
                    Ids = new[] { data["TaskId"] },
                    Type = NewItemsNotificationType.Task
                };

                var serializer = new JavaScriptSerializer();
                serializer.MaxJsonLength = int.MaxValue;
                string message = serializer.Serialize(newTaskNotification);
                var notificationData = new ClientNotification { Message = message, NotificationType = ClientNotificationType.NewItems };
                return serializer.Serialize(notificationData);
            }

            return string.Empty;
        }
コード例 #2
0
 public NotificationTemplate GetNotificationTemplate(NotificationTypeDictionary notificationType)
 {
     return Uow.NotificationTemplates.GetByType(notificationType);
 }