Пример #1
0
        private string getForm(User user, string formHtml)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(@"
                        <script>
                        jQuery(function(){
                            var user_data = {};
                            _USERDATA_
                            var elems = jQuery('#fMembership').find(':input');
                            for(var i=0; i<elems.length; i++)
                                jQuery(elems[i]).val(user_data[jQuery(elems[i]).attr('name')]);
                        });
                        </script>");

            sb.Append(formHtml);
            bool isPostBack = Provider.Request["Email"] != null;

            StringBuilder sbUserData = new StringBuilder();
            foreach (PropertyInfo pi in user.GetType().GetProperties())
            {
                if (pi.Name.Contains("Password") || pi.DeclaringType != typeof(User) || pi.GetSetMethod() == null)
                    continue; //***
                object val = pi.GetValue(user, null);
                sbUserData.AppendLine("                            user_data[\"" + pi.Name + "\"] = " + (isPostBack ? Provider.Request[pi.Name] : (val == null ? "" : val.ToString())).ToJS() + ";");
            }

            sb = sb.Replace("_USERDATA_", sbUserData.ToString());
            return sb.ToString();
        }
Пример #2
0
        public static string EmailCustomMessage(User to, string customSubject = "", string content = "")
        {
            string subject = "Custom Trial Mail";
            if (customSubject != "")
                subject = customSubject;

            if (content == "")
            {
                content = string.Format(EmailH1, "Hello" + (string.IsNullOrWhiteSpace(to.Name) ? "" : " " + to.Name) + ",");
                string p = "This is a custom message. You can send custom html messages with it. Such as <strong>this.</strong>";
                content += string.Format(EmailParagraph, p);
            }

            string msg = string.Format(EmailHTMLBody, content);

            string response = "";
            if (SendMail(to.Email, subject, msg) != "")
                response = "<h6> " + to.FullName + " &lt;" + to.Email + "&gt; </h6>";
            return response;
        }