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 msg = DbUtil.Db.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 = DbUtil.Db.NotifyIds((m.masterorg ?? m.org).NotifyIds); DbUtil.Db.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'/> "); }
private ActionResult FlowList(OnlineRegModel m) { try { m.UpdateDatum(); m.Log(fromMethod); var content = ViewExtensions2.RenderPartialViewToString2(this, "Flow2/List", m); return Content(content); } catch (Exception ex) { return ErrorResult(m, ex, "In " + fromMethod + "<br>" + ex.Message); } }
public ActionResult AutoSaveProgress(OnlineRegModel m) { try { m.UpdateDatum(); } catch { } return Content(m.DatumId.ToString()); }
private ActionResult ErrorResult(OnlineRegModel m, Exception ex, string errorDisplay) { // ReSharper disable once EmptyGeneralCatchClause try { m.UpdateDatum(); } catch { } var ex2 = new Exception($"{errorDisplay}, {DbUtil.Db.ServerLink("/OnlineReg/RegPeople/") + m.DatumId}", ex); ErrorSignal.FromCurrentContext().Raise(ex2); m.Log(ex2.Message); TempData["error"] = errorDisplay; TempData["stack"] = ex.StackTrace; return Content("/Error/"); }