示例#1
0
        private bool SetMailToLinkAttributes(Packet packet)
        {
            Assert.ArgumentNotNull((object)packet, nameof(packet));
            string str   = this.MailToLink.Value;
            string email = StringUtil.GetLastPart(str, ':', str);

            if (!EmailUtility.IsValidEmailAddress(email))
            {
                SheerResponse.Alert("The e-mail address is invalid.", (string[])Array.Empty <string>());
                return(false);
            }
            if (!string.IsNullOrEmpty(email))
            {
                email = "mailto:" + email;
            }
            LinkForm.SetAttribute(packet, Attributes.url, email ?? string.Empty);
            LinkForm.SetAttribute(packet, Attributes.anchor, string.Empty);
            return(true);
        }
        /// <summary>
        /// The set mail to link attributes.
        /// </summary>
        /// <param name="packet">The packet.</param>
        /// <returns>The set mail to link attributes.</returns>
        private bool SetMailToLinkAttributes(Packet packet)
        {
            Assert.ArgumentNotNull(packet, "packet");
            string value = MailToLink.Value;

            value = StringUtil.GetLastPart(value, ':', value);
            if (!EmailUtility.IsValidEmailAddress(value))
            {
                SheerResponse.Alert("The e-mail address is invalid.");
                return(false);
            }
            if (!string.IsNullOrEmpty(value))
            {
                value = "mailto:" + value;
            }
            UltraLinkForm.SetAttribute(packet, "url", value ?? string.Empty);
            UltraLinkForm.SetAttribute(packet, "anchor", string.Empty);
            return(true);
        }