Exemplo n.º 1
0
        public override JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("email", EMailAddress.ToJSON(Embedded: true)),

            Subject.IsNotNullOrEmpty()
                       ? new JProperty("subject", Subject)
                       : null,

            SubjectPrefix.IsNotNullOrEmpty()
                       ? new JProperty("subjectPrefix", SubjectPrefix)
                       : null,

            ListId.IsNotNullOrEmpty()
                       ? new JProperty("listId", ListId)
                       : null,

            NotificationMessageTypes.SafeAny()
                       ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString())))
                       : null,

            Description.IsNotNullOrEmpty()
                       ? new JProperty("description", Description)
                       : null

            );
Exemplo n.º 2
0
        public override JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("groupName", GroupName),

            ChatId.HasValue
                       ? new JProperty("chatId", ChatId.Value)
                       : null,

            SharedSecret.IsNotNullOrEmpty()
                       ? new JProperty("sharedSecret", SharedSecret)
                       : null,

            TextTemplate.IsNotNullOrEmpty()
                       ? new JProperty("textTemplate", TextTemplate)
                       : null,

            NotificationMessageTypes.SafeAny()
                       ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString())))
                       : null,

            Description.IsNotNullOrEmpty()
                       ? new JProperty("description", Description)
                       : null

            );
Exemplo n.º 3
0
        public void Remove(params NotificationMessageType[] NotificationMessageTypes)
        {
            if (NotificationMessageTypes.SafeAny())
            {
                var notificationMessageTypes = new HashSet <NotificationMessageType>(NotificationMessageTypes);

                foreach (var remove in notifications.Where(nmd => notificationMessageTypes.Overlaps(nmd.Messages)).ToArray())
                {
                    this.notifications.Remove(remove);
                }
            }
        }
Exemplo n.º 4
0
        public void AddNotificationMessage(string title, string message, NotificationMessageTypes notificationMessageType = NotificationMessageTypes.Success, bool show = true)
        {
            var session  = GetSession();
            var messages = session["projectExercise.notificationmessages"] as IList <NotificationMessage>;

            if (messages == null)
            {
                messages = new List <NotificationMessage>();
                session.Add("projectExercise.notificationmessages", messages);
            }
            messages.Add(new NotificationMessage()
            {
                Title = title, Message = message, Show = show, NotificationMessageType = notificationMessageType
            });
        }
Exemplo n.º 5
0
        public override JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("method", Method.ToString()),
            new JProperty("URL", URL),
            new JProperty("TCPPort", RemotePort.ToUInt16()),

            BasicAuth_Login.IsNotNullOrEmpty() &&
            BasicAuth_Password.IsNotNullOrEmpty()
                       ? new JProperty("basicAuth",
                                       new JObject(
                                           new JProperty("login", BasicAuth_Login),
                                           new JProperty("password", BasicAuth_Password)
                                           )
                                       )
                       : null,

            APIKey.IsNotNullOrEmpty()
                       ? new JProperty("APIKey", APIKey)
                       : null,

            RequestTimeout.HasValue
                       ? new JProperty("RequestTimeout", RequestTimeout.Value.TotalSeconds)
                       : null,

            NotificationMessageTypes.SafeAny()
                       ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString())))
                       : null,

            Description.IsNotNullOrEmpty()
                       ? new JProperty("description", Description)
                       : null

            );
Exemplo n.º 6
0
        public override JObject ToJSON(Boolean Embedded = false)

        => JSONObject.Create(

            !Embedded
                       ? new JProperty("@context", JSONLDContext.ToString())
                       : null,

            new JProperty("phoneNumber", PhoneNumber.ToString()),

            TextTemplate.IsNotNullOrEmpty()
                       ? new JProperty("textTemplate", TextTemplate)
                       : null,

            NotificationMessageTypes.SafeAny()
                       ? new JProperty("messageTypes", new JArray(NotificationMessageTypes.Select(msgType => msgType.ToString())))
                       : null,

            Description.IsNotNullOrEmpty()
                       ? new JProperty("description", Description)
                       : null

            );