Esempio n. 1
0
        public ActionResult SaveProgress(OnlineRegModel m)
        {
            m.HistoryAdd("saveprogress");
            if (m.UserPeopleId == null)
            {
                m.UserPeopleId = Util.UserPeopleId;
            }
            m.UpdateDatum();
            var p = m.UserPeopleId.HasValue ? DbUtil.Db.LoadPersonById(m.UserPeopleId.Value) : m.List[0].person;

            if (p == null)
            {
                return(Content("We have not found your record yet, cannot save progress, sorry"));
            }
            if (m.masterorgid == null && m.Orgid == null)
            {
                return(Content("Registration is not far enough along to save, sorry."));
            }

            var registerLink = EmailReplacements.CreateRegisterLink(m.masterorgid ?? m.Orgid, "Resume registration for {0}".Fmt(m.Header));
            var msg          = "<p>Hi {first},</p>\n<p>Here is the link to continue your registration:</p>\n" + registerLink;
            var notifyids    = DbUtil.Db.NotifyIds((m.masterorgid ?? m.Orgid).Value, (m.masterorg ?? m.org).NotifyIds);

            DbUtil.Db.Email(notifyids[0].FromEmail, p, "Continue your registration for {0}".Fmt(m.Header), msg);

            /* We use Content as an ActionResult instead of Message because we want plain text sent back
             * This is an HttpPost ajax call and will have a SiteLayout wrapping this.
             */
            return(Content("We have saved your progress. An email with a link to finish this registration will come to you shortly."));
        }
Esempio n. 2
0
 public void FinishLaterNotice()
 {
     var registerLink = EmailReplacements.CreateRegisterLink(masterorgid ?? Orgid,
         $"Resume registration for {Header}");
     var msg = "<p>Hi {first},</p>\n<p>Here is the link to continue your registration:</p>\n" + registerLink;
     Debug.Assert((masterorgid ?? Orgid) != null, "m.Orgid != null");
     var notifyids = DbUtil.Db.NotifyIds((masterorg ?? org).NotifyIds);
     var p = UserPeopleId.HasValue ? DbUtil.Db.LoadPersonById(UserPeopleId.Value) : List[0].person;
     DbUtil.Db.Email(notifyids[0].FromEmail, p, $"Continue your registration for {Header}", msg);
 }
Esempio n. 3
0
        public ActionResult SaveProgress(OnlineRegModel m)
        {
            m.HistoryAdd("saveprogress");
            if (m.UserPeopleId == null)
            {
                m.UserPeopleId = Util.UserPeopleId;
            }
            m.UpdateDatum();
            var p = m.UserPeopleId.HasValue ? CurrentDatabase.LoadPersonById(m.UserPeopleId.Value) : m.List[0].person;

            if (p == null)
            {
                return(Content("We have not found your record yet, cannot save progress, sorry"));
            }
            if (m.masterorgid == null && m.Orgid == null)
            {
                return(Content("Registration is not far enough along to save, sorry."));
            }

            var msg          = CurrentDatabase.ContentHtml("ContinueRegistrationLink", @"
<p>Hi {first},</p>
<p>Here is the link to continue your registration:</p>
Resume [registration for {orgname}]
").Replace("{orgname}", m.Header);
            var linktext     = Regex.Match(msg, @"(\[(.*)\])", RegexOptions.Singleline).Groups[2].Value;
            var registerlink = EmailReplacements.CreateRegisterLink(m.masterorgid ?? m.Orgid, linktext);

            msg = Regex.Replace(msg, @"(\[.*\])", registerlink, RegexOptions.Singleline);

            var notifyids = CurrentDatabase.NotifyIds((m.masterorg ?? m.org).NotifyIds);

            CurrentDatabase.Email(notifyids[0].FromEmail, p, $"Continue your registration for {m.Header}", msg);

            /* We use Content as an ActionResult instead of Message because we want plain text sent back
             * This is an HttpPost ajax call and will have a SiteLayout wrapping this.
             */
            return(Content(@"
We have saved your progress. An email with a link to finish this registration will come to you shortly.
<input type='hidden' id='SavedProgress' value='true'/>
"));
        }
Esempio n. 4
0
        public ActionResult FinishLater(int id)
        {
            var ed = DbUtil.Db.RegistrationDatas.SingleOrDefault(e => e.Id == id);

            if (ed != null)
            {
                var m = Util.DeSerialize <OnlineRegModel>(ed.Data);

                var registerLink = EmailReplacements.CreateRegisterLink(m.masterorgid ?? m.Orgid, "Resume registration for {0}".Fmt(m.Header));
                var msg          = "<p>Hi {first},</p>\n<p>Here is the link to continue your registration:</p>\n" + registerLink;
                Debug.Assert((m.masterorgid ?? m.Orgid) != null, "m.Orgid != null");
                var notifyids = DbUtil.Db.NotifyIds((m.masterorgid ?? m.Orgid).Value, (m.masterorg ?? m.org).NotifyIds);
                var p         = m.UserPeopleId.HasValue ? DbUtil.Db.LoadPersonById(m.UserPeopleId.Value) : m.List[0].person;
                DbUtil.Db.Email(notifyids[0].FromEmail, p, "Continue your registration for {0}".Fmt(m.Header), msg);

                /* We use Content as an ActionResult instead of Message because we want plain text sent back
                 * This is an HttpPost ajax call and will have a SiteLayout wrapping this.
                 */
                //return Content("We have saved your progress. An email with a link to finish this registration will come to you shortly.");

                return(View(m));
            }
            return(View("Unknown"));
        }