public void Text(FormDataSetEntry entry, String value)
 {
     if (entry.HasName && value != null)
     {
         _writers.Add(stream =>
         {
             stream.WriteLine(String.Concat("Content-Disposition: form-data; name=\"", entry.Name.HtmlEncode(_encoding), "\""));
             stream.WriteLine();
             stream.WriteLine(value.HtmlEncode(_encoding));
         });
     }
 }
Exemplo n.º 2
0
        public static void SendLinkToEmail(File file, String url, String message, List<String> addressRecipients)
        {
            if (file == null || String.IsNullOrEmpty(url))
                throw new ArgumentException();

            var recipients = addressRecipients
                .ConvertAll(address => (IRecipient) (new DirectRecipient(Guid.NewGuid().ToString(), String.Empty, new[] {address}, false)));

            Instance.SendNoticeToAsync(
                NotifyConstants.Event_LinkToEmail,
                null,
                recipients.ToArray(),
                false,
                new TagValue(NotifyConstants.Tag_DocumentTitle, file.Title),
                new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
                new TagValue(NotifyConstants.Tag_AccessRights, GetAccessString(file.Access)),
                new TagValue(NotifyConstants.Tag_Message, message.HtmlEncode())
                );
        }
Exemplo n.º 3
0
        public static void SendLinkToEmail(File file, String url, String message, List<String> addressRecipients)
        {
            if (file == null || String.IsNullOrEmpty(url))
                throw new ArgumentException();

            var recipients = addressRecipients
                .ConvertAll(address => (IRecipient)(new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), String.Empty, new[] { address }, false)));

            Instance.SendNoticeToAsync(
                NotifyConstants.Event_LinkToEmail,
                null,
                recipients.ToArray(),
                new[] { "email.sender" },
                null,
                new TagValue(NotifyConstants.Tag_DocumentTitle, file.Title),
                new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
                new TagValue(NotifyConstants.Tag_AccessRights, GetAccessString(file.Access, CultureInfo.CurrentUICulture)),
                new TagValue(NotifyConstants.Tag_Message, message.HtmlEncode()),
                new TagValue(NotifyConstants.Tag_UserEmail, CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).Email)
                );
        }
        public void File(FormDataSetEntry entry, String fileName, String contentType, IFile content)
        {
            if (entry.HasName)
            {
                _writers.Add(stream =>
                {
                    var hasContent = content != null && content.Name != null && content.Type != null && content.Body != null;

                    stream.WriteLine("Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"",
                        entry.Name.HtmlEncode(_encoding), fileName.HtmlEncode(_encoding));
                    stream.WriteLine("Content-Type: {0}", contentType);
                    stream.WriteLine();

                    if (hasContent)
                    {
                        stream.Flush();
                        content.Body.CopyTo(stream.BaseStream);
                    }

                    stream.WriteLine();
                });
            }
        }
Exemplo n.º 5
0
        public static void SendLinkToEmail(File file, String url, String message, List<String> addressRecipients)
        {
            if (file == null || String.IsNullOrEmpty(url))
                throw new ArgumentException();

            foreach (var recipients in addressRecipients
                .Select(addressRecipient => (IRecipient) (new DirectRecipient(SecurityContext.CurrentAccount.ID.ToString(), String.Empty, new[] {addressRecipient}, false))))
            {
                Instance.SendNoticeToAsync(
                    NotifyConstants.Event_LinkToEmail,
                    null,
                    new[] {recipients},
                    new[] {"email.sender"},
                    null,
                    new TagValue(NotifyConstants.Tag_DocumentTitle, file.Title),
                    new TagValue(NotifyConstants.Tag_DocumentUrl, CommonLinkUtility.GetFullAbsolutePath(url)),
                    new TagValue(NotifyConstants.Tag_AccessRights, GetAccessString(file.Access, CultureInfo.CurrentUICulture)),
                    new TagValue(NotifyConstants.Tag_Message, message.HtmlEncode()),
                    new TagValue(NotifyConstants.Tag_UserEmail, CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID).Email),
                    new TagValue(CommonTags.WithPhoto, CoreContext.Configuration.Personal ? "personal" : ""),
                    new TagValue(CommonTags.IsPromoLetter, CoreContext.Configuration.Personal ? "true" : "false")
                    );
            }
        }