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 string PrefixSubject(string subject, int maxLength)
        {
            var result = $"{SubjectPrefix?.Trim() ?? ""} {subject}".Trim();

            return(result.Length > maxLength?result.Substring(0, maxLength - 3) + "..." : result);
        }