public void Confirm(Controller controller) { var details = ViewExtensions2.RenderPartialViewToString(controller, "ManageGiving/EmailConfirmation", this); var staff = DbUtil.Db.StaffPeopleForOrg(orgid); var from = staff[0]; if (!string.IsNullOrEmpty(Setting.Body)) { var text = Setting.Body.Replace("{church}", DbUtil.Db.Setting("NameOfChurch", "church"), ignoreCase: true); // text = text.Replace("{name}", person.Name, ignoreCase: true); text = text.Replace("{date}", DateTime.Now.ToString("d"), ignoreCase: true); text = text.Replace("{email}", person.EmailAddress, ignoreCase: true); text = text.Replace("{phone}", person.HomePhone.FmtFone(), ignoreCase: true); text = text.Replace("{contact}", from.Name, ignoreCase: true); text = text.Replace("{contactemail}", from.EmailAddress, ignoreCase: true); text = text.Replace("{contactphone}", Organization.PhoneNumber.FmtFone(), ignoreCase: true); text = text.Replace("{details}", details, ignoreCase: true); DbUtil.Db.EmailFinanceInformation(from.FromEmail, person, Setting.Subject, text); } DbUtil.Db.EmailFinanceInformation(from.FromEmail, staff, "Managed giving", $"Managed giving for {person.Name} ({pid}) {Util.Host}"); var msg = GetThankYouMessage(@"<p>Thank you {first}, for managing your recurring giving</p> <p>You should receive a confirmation email shortly.</p>"); msg = msg.Replace("{first}", person.PreferredName, ignoreCase: true); ThankYouMessage = msg; }
public ActionResult UpdateNotifyIds(int id, int topid, string field) { var t = DbUtil.Db.FetchOrCreateTag(Util.SessionId, Util.UserPeopleId, DbUtil.TagTypeId_AddSelected); var selected_pids = (from p in t.People(DbUtil.Db) orderby p.PeopleId == topid ? "0" : "1" select p.PeopleId).ToArray(); var o = DbUtil.Db.LoadOrganizationById(Util2.CurrentOrgId); var notifyids = string.Join(",", selected_pids); switch (field) { case "notifyids": o.NotifyIds = notifyids; break; case "giftnotifyids": o.GiftNotifyIds = notifyids; break; } DbUtil.Db.TagPeople.DeleteAllOnSubmit(t.PersonTags); DbUtil.Db.Tags.DeleteOnSubmit(t); DbUtil.Db.SubmitChanges(); ViewBag.OrgId = id; ViewBag.field = field; var view = ViewExtensions2.RenderPartialViewToString2(this, "NotifyList2", notifyids); return(Content(view)); //return View("NotifyList2", notifyids); }
public ActionResult LogOn(string returnUrl) { var r = DbUtil.CheckDatabaseExists(Util.CmsHost); var redirect = ViewExtensions2.DatabaseErrorUrl(r); if (redirect != null) { return(Redirect(redirect)); } var user = AccountModel.GetValidToken(Request.QueryString["otltoken"]); if (user.HasValue()) { FormsAuthentication.SetAuthCookie(user, false); AccountModel.SetUserInfo(user, Session); if (returnUrl.HasValue() && Url.IsLocalUrl(returnUrl)) { return(Redirect(returnUrl)); } return(Redirect("/")); } var m = new AccountInfo { ReturnUrl = returnUrl }; return(View(m)); }
public ActionResult EmailBody(string id, bool? useUnlayer) { var i = id.ToInt(); var c = ViewExtensions2.GetContent(i); if (c == null) { return new EmptyResult(); } var design = string.Empty; var body = string.Empty; if (c.TypeID == ContentTypeCode.TypeUnlayerSavedDraft) { dynamic payload = JsonConvert.DeserializeObject(c.Body); design = payload.design; body = payload.rawHtml; } else body = c.Body; var doc = new HtmlDocument(); doc.LoadHtml(body); var bvedits = doc.DocumentNode.SelectNodes("//div[contains(@class,'bvedit') or @bvedit]"); if (bvedits == null || !bvedits.Any()) { body = $"<div bvedit='discardthis'>{body}</div>"; } ViewBag.body = body; ViewBag.design = design; ViewBag.useUnlayer = useUnlayer; return View(); }
protected void TryLoadAlternateShell() { var shell = string.Empty; var alternateShellSetting = DbUtil.DbReadOnly.Settings.SingleOrDefault(x => x.Id == LogonPageShellSettingKey); if (alternateShellSetting != null) { var alternateShell = DbUtil.DbReadOnly.Contents.SingleOrDefault(x => x.Name == alternateShellSetting.SettingX); if (alternateShell != null) { shell = alternateShell.Body; } } if (shell.HasValue()) { var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline); var t = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css()); t = t.Replace("<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body> </body>\r\n", ""); ViewBag.hasshell = true; ViewBag.top = t; var b = re.Match(shell).Groups[2].Value; b = b.Replace("</html>", ""); ViewBag.bottom = b; } else { ViewBag.hasshell = false; } }
private static string RecentAbsentsEmail(OrganizationController c, IEnumerable <RecentAbsent> list) { var q = from p in list orderby p.Consecutive, p.Name2 select p; return(ViewExtensions2.RenderPartialViewToString(c, "RecentAbsentsEmail", q)); }
private static string RecentVisitsEmail(OrgSearchController c, IEnumerable <OrgVisitorsAsOfDate> list) { var q = from p in list orderby p.LastAttended, p.LastName, p.PreferredName select p; return(ViewExtensions2.RenderPartialViewToString(c, "RecentVisitsEmail", q)); }
public string Summary(CmsController controller) { var q = from i in FetchSlots() where i.Checked select i; return(!q.Any() ? "no commitments" : ViewExtensions2.RenderPartialViewToString(controller, "ManageVolunteer/VolunteerSlotsSummary", q)); }
public ActionResult ManageGiving2(int id) { var m = new ManageGivingModel(id); m.testing = true; var body = ViewExtensions2.RenderPartialViewToString(this, "ManageGiving2", m); return(Content(body)); }
public ActionResult ConfirmRecurringGiving() { var m = TempData["managegiving"] as ManageGivingModel; if (m == null) { return(Content("No active registration")); } #if DEBUG2 m.testing = true; #else #endif var details = ViewExtensions2.RenderPartialViewToString(this, "ManageGiving2", m); var staff = DbUtil.Db.StaffPeopleForOrg(m.orgid)[0]; var text = m.setting.Body.Replace("{church}", DbUtil.Db.Setting("NameOfChurch", "church"), ignoreCase: true); text = text.Replace("{name}", m.person.Name, ignoreCase: true); text = text.Replace("{date}", DateTime.Now.ToString("d"), ignoreCase: true); text = text.Replace("{email}", m.person.EmailAddress, ignoreCase: true); text = text.Replace("{phone}", m.person.HomePhone.FmtFone(), ignoreCase: true); text = text.Replace("{contact}", staff.Name, ignoreCase: true); text = text.Replace("{contactemail}", staff.EmailAddress, ignoreCase: true); text = text.Replace("{contactphone}", m.Organization.PhoneNumber.FmtFone(), ignoreCase: true); text = text.Replace("{details}", details, ignoreCase: true); var contributionemail = (from ex in DbUtil.Db.PeopleExtras where ex.Field == "ContributionEmail" where ex.PeopleId == m.person.PeopleId select ex.Data).SingleOrDefault(); if (!Util.ValidEmail(contributionemail)) { contributionemail = m.person.FromEmail; } Util.SendMsg(Util.SysFromEmail, Util.Host, Util.TryGetMailAddress(DbUtil.Db.StaffEmailForOrg(m.orgid)), m.setting.Subject, text, Util.EmailAddressListFromString(contributionemail), 0, m.pid); Util.SendMsg(Util.SysFromEmail, Util.Host, Util.TryGetMailAddress(contributionemail), "Managed Giving", "Managed giving for {0} ({1})".Fmt(m.person.Name, m.pid), Util.EmailAddressListFromString(DbUtil.Db.StaffEmailForOrg(m.orgid)), 0, m.pid); SetHeaders(m.orgid); ViewBag.Title = "Online Recurring Giving"; var msg = m.Organization.GetExtra("ConfirmationDisplay"); if (!msg.HasValue()) { msg = @"<p>Thank you {first}, for managing your recurring giving</p> <p>You should receive a confirmation email shortly.</p>"; } msg = msg.Replace("{first}", m.person.PreferredName, ignoreCase: true); ViewBag.Message = msg; return(View(m)); }
public ActionResult BatchUpload(DateTime?date, HttpPostedFileBase file, int?fundid, string text) { if (!date.HasValue) { ModelState.AddModelError("date", "Date is required"); return(View("Batch")); } var fromFile = false; string s; if (file != null) { var buffer = new byte[file.ContentLength]; file.InputStream.Read(buffer, 0, file.ContentLength); System.Text.Encoding enc; if (buffer[0] == 0xFF && buffer[1] == 0xFE) { enc = new System.Text.UnicodeEncoding(); s = enc.GetString(buffer, 2, buffer.Length - 2); } else { enc = new System.Text.ASCIIEncoding(); s = enc.GetString(buffer); } fromFile = true; } else { if (String.IsNullOrWhiteSpace(text)) { ModelState.AddModelError("textarea", "Text is required when no file is uploaded."); return(View("Batch")); } s = text; } try { var id = BatchImportContributions.BatchProcess(s, date.Value, fundid, fromFile); if (id.HasValue) { return(Redirect("/PostBundle/" + id)); } return(RedirectToAction("Batch")); } catch (Exception ex) { return(PageMessage(ViewExtensions2.Markdown(ex.Message).ToString())); } }
private ActionResult FlowList(OnlineRegModel m, string function) { try { var view = ViewExtensions2.RenderPartialViewToString2(this, "Flow/List", m); return(Content(view)); } catch (Exception ex) { return(ErrorResult(m, ex, "In " + function + ex.Message)); } }
public ActionResult EmailBody(string id) { if (id == "0") // used for unlayer, force using a blank empty template with only "click here to edit content" { ViewBag.body = "<div class='bvedit'>Click here to edit content</div>"; ViewBag.design = ""; ViewBag.useUnlayer = true; return(View()); } var i = id.ToInt(); var c = ViewExtensions2.GetContent(i); if (c == null) { return(new EmptyResult()); } var design = string.Empty; var body = string.Empty; if (ContentTypeCode.IsUnlayer(c.TypeID)) { if (!c.Body.HasValue()) { c.Body = "<div class='bvedit'>Click here to edit content</div>"; } else { dynamic payload = JsonConvert.DeserializeObject(c.Body); design = payload.design; body = payload.rawHtml; } } else { body = c.Body; } var doc = new HtmlDocument(); doc.LoadHtml(body); var bvedits = doc.DocumentNode.SelectNodes("//div[contains(@class,'bvedit') or @bvedit]"); if (bvedits == null || !bvedits.Any()) { body = $"<div bvedit='discardthis'>{body}</div>"; } ViewBag.body = body; ViewBag.design = design; ViewBag.useUnlayer = true; return(View()); }
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)); } }
private ActionResult FlowList(OnlineRegModel m, string function) { try { m.UpdateDatum(); var view = m.UseBootstrap ? "Flow2/List" : "Flow/List"; var content = ViewExtensions2.RenderPartialViewToString2(this, view, m); return(Content(content)); } catch (Exception ex) { return(ErrorResult(m, ex, "In " + function + ex.Message)); } }
private void SetHeaders(int id) { Settings setting = null; var org = CurrentDatabase.LoadOrganizationById(id); if (org != null) { SetHeaders2(id); return; } var shell = SetAlternativeManagedGivingShell(); if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id))) { setting = CurrentDatabase.CreateRegistrationSettings(id); shell = DbUtil.Content(CurrentDatabase, setting.Shell, null); } if (!shell.HasValue() && settings != null && settings.ContainsKey(id)) { shell = DbUtil.Content(CurrentDatabase, settings[id].Shell, null); } if (!shell.HasValue()) { shell = DbUtil.Content(CurrentDatabase, "ShellDiv-" + id, DbUtil.Content(CurrentDatabase, "ShellDefault", "")); } var s = shell; if (s.HasValue()) { var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline); var t = re.Match(s).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.jQueryUICss() + "\r\n<link href=\"/Content/styles/onlinereg.css?v=8\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); ViewBag.hasshell = true; var b = re.Match(s).Groups[2].Value; ViewBag.bottom = b; } else { ViewBag.hasshell = false; ViewBag.header = DbUtil.Content(CurrentDatabase, "OnlineRegHeader-" + id, DbUtil.Content(CurrentDatabase, "OnlineRegHeader", "")); ViewBag.top = DbUtil.Content(CurrentDatabase, "OnlineRegTop-" + id, DbUtil.Content(CurrentDatabase, "OnlineRegTop", "")); ViewBag.bottom = DbUtil.Content(CurrentDatabase, "OnlineRegBottom-" + id, DbUtil.Content(CurrentDatabase, "OnlineRegBottom", "")); } }
public void Confirm(Controller controller) { var details = ViewExtensions2.RenderPartialViewToString(controller, "ManageGiving/EmailConfirmation", this); var staff = DbUtil.Db.StaffPeopleForOrg(orgid)[0]; var contributionEmail = (from ex in DbUtil.Db.PeopleExtras where ex.Field == "ContributionEmail" where ex.PeopleId == person.PeopleId select ex.Data).SingleOrDefault(); if (!Util.ValidEmail(contributionEmail)) { contributionEmail = person.FromEmail; } if (!string.IsNullOrEmpty(Setting.Body)) { var text = Setting.Body.Replace("{church}", DbUtil.Db.Setting("NameOfChurch", "church"), ignoreCase: true); // text = text.Replace("{name}", person.Name, ignoreCase: true); text = text.Replace("{date}", DateTime.Now.ToString("d"), ignoreCase: true); text = text.Replace("{email}", person.EmailAddress, ignoreCase: true); text = text.Replace("{phone}", person.HomePhone.FmtFone(), ignoreCase: true); text = text.Replace("{contact}", staff.Name, ignoreCase: true); text = text.Replace("{contactemail}", staff.EmailAddress, ignoreCase: true); text = text.Replace("{contactphone}", Organization.PhoneNumber.FmtFone(), ignoreCase: true); text = text.Replace("{details}", details, ignoreCase: true); var from = Util.TryGetMailAddress(DbUtil.Db.StaffEmailForOrg(orgid)); var mm = new EmailReplacements(DbUtil.Db, text, from); text = mm.DoReplacements(DbUtil.Db, person); Util.SendMsg(Util.SysFromEmail, Util.Host, from, Setting.Subject, text, Util.EmailAddressListFromString(contributionEmail), 0, pid); } Util.SendMsg(Util.SysFromEmail, Util.Host, Util.TryGetMailAddress(contributionEmail), "Managed Giving", $"Managed giving for {person.Name} ({pid})", Util.EmailAddressListFromString(DbUtil.Db.StaffEmailForOrg(orgid)), 0, pid); var msg = GetThankYouMessage(@"<p>Thank you {first}, for managing your recurring giving</p> <p>You should receive a confirmation email shortly.</p>"); msg = msg.Replace("{first}", person.PreferredName, ignoreCase: true); ThankYouMessage = msg; }
public ActionResult LogOn(string returnUrl) { TryLoadAlternateShell(); var dbExists = CmsData.DbUtil.CheckDatabaseExists(CurrentDatabase.Host); var redirect = ViewExtensions2.DatabaseErrorUrl(dbExists); if (redirect != null) { return(Redirect(redirect)); } var user = AccountModel.GetValidToken(CurrentDatabase, Request.QueryString["otltoken"]); return(LoginAs(user, returnUrl)); }
public ActionResult BatchUpload(DateTime date, HttpPostedFileBase file, int?fundid, string text) { var fromFile = false; string s; if (file != null) { var buffer = new byte[file.ContentLength]; file.InputStream.Read(buffer, 0, file.ContentLength); System.Text.Encoding enc; if (buffer[0] == 0xFF && buffer[1] == 0xFE) { enc = new System.Text.UnicodeEncoding(); s = enc.GetString(buffer, 2, buffer.Length - 2); } else { enc = new System.Text.ASCIIEncoding(); s = enc.GetString(buffer); } fromFile = true; } else { s = text; } try { var id = BatchImportContributions.BatchProcess(s, date, fundid, fromFile); if (id.HasValue) { return(Redirect("/PostBundle/" + id)); } return(RedirectToAction("Batch")); } catch (Exception ex) { return(PageMessage(ViewExtensions2.Markdown(ex.Message).ToString())); } }
public object ContributionRowData(PostBundleController ctl, int cid, decimal?othersplitamt = null) { var cinfo = FetchContributions(cid).Single(); var body = ViewExtensions2.RenderPartialViewToString(ctl, "Row", cinfo); var q = from c in DbUtil.Db.Contributions let bh = c.BundleDetails.First().BundleHeader where c.ContributionId == cid select new { row = body, amt = c.ContributionAmount.ToString2("N2"), cid, totalitems = bh.BundleDetails.Sum(d => d.Contribution.ContributionAmount).ToString2("N2"), itemcount = bh.BundleDetails.Count(), othersplitamt = othersplitamt.ToString2("N2") }; return(q.First()); }
private void SetHeaders2(int id) { var org = CurrentDatabase.LoadOrganizationById(id); var shell = GetAlternativeManagedGivingShell(org.OrganizationId); if (!shell.HasValue() && (settings == null || !settings.ContainsKey(id)) && org != null) { var setting = CurrentDatabase.CreateRegistrationSettings(id); shell = CurrentDatabase.ContentOfTypeHtml(setting.ShellBs)?.Body; } if (!shell.HasValue() && settings != null && settings.ContainsKey(id)) { shell = CurrentDatabase.ContentOfTypeHtml(settings[id].ShellBs)?.Body; } if (!shell.HasValue()) { shell = CurrentDatabase.ContentOfTypeHtml("ShellDefaultBs")?.Body; if (!shell.HasValue()) { shell = CurrentDatabase.ContentOfTypeHtml("DefaultShellBs")?.Body; } } if (shell != null && shell.HasValue()) { shell = shell.Replace("{title}", ViewBag.Title); var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline); var t = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css()); ViewBag.hasshell = true; ViewBag.top = t; var b = re.Match(shell).Groups[2].Value; ViewBag.bottom = b; } else { ViewBag.hasshell = false; } }
private IHandlebars RegisterHelpers(PictureDirectoryController ctl) { var handlebars = PythonModel.RegisterHelpers(DbUtil.Db); handlebars.RegisterHelper("SmallUrl", (w, ctx, args) => { GetPictureUrl(ctx, w, ctx.SmallId, Picture.SmallMissingMaleId, Picture.SmallMissingFemaleId, Picture.SmallMissingGenericId); }); handlebars.RegisterHelper("MediumUrl", (w, ctx, args) => { GetPictureUrl(ctx, w, ctx.MediumId, Picture.MediumMissingMaleId, Picture.MediumMissingFemaleId, Picture.MediumMissingGenericId); }); handlebars.RegisterHelper("ImagePos", (w, ctx, args) => { w.Write(ctx.X != null || ctx.Y != null ? $"{ctx.X ?? 0}% {ctx.Y ?? 0}%" : "top"); }); handlebars.RegisterHelper("IfAccess", (w, opt, ctx, args) => { if (HasAccess) { opt.Template(w, (object)ctx); } else { opt.Inverse(w, (object)ctx); } }); handlebars.RegisterHelper("PagerTop", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerTop", this)); }); handlebars.RegisterHelper("PagerBottom", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerBottom", this)); }); handlebars.RegisterHelper("PagerHidden", (w, ctx, args) => { w.Write(ViewExtensions2.RenderPartialViewToString(ctl, "PagerHidden", this)); }); handlebars.RegisterHelper("SortBirthday", (w, ctx, args) => { w.Write(SortLink("Birthday")); }); handlebars.RegisterHelper("SortName", (w, ctx, args) => { w.Write(SortLink("Name")); }); handlebars.RegisterHelper("CityStateZip", (w, ctx, args) => { w.Write(Util.FormatCSZ4(ctx.City, ctx.St, ctx.Zip)); }); handlebars.RegisterHelper("BirthDay", (w, ctx, args) => { var dob = (string)ctx.DOB; w.Write(dob.ToDate().ToString2("m")); }); return(handlebars); }
public ActionResult CloneDraft(int id, string name, Guid queryId) { var content = ViewExtensions2.GetContent(id); var clone = new Content { Name = name.HasValue() ? name : "new draft " + DateTime.Now.FormatDateTm(), TypeID = content.TypeID, RoleID = content.RoleID, OwnerID = Util.UserId, Title = content.Title, Body = content.Body, Archived = null, ArchivedFromId = null, DateCreated = DateTime.Now }; CurrentDatabase.Contents.InsertOnSubmit(clone); CurrentDatabase.SubmitChanges(); return RedirectToAction("Index", new {id = queryId}); }
private void SetHeaders2(int id) { var org = DbUtil.Db.LoadOrganizationById(id); var shell = ""; if ((settings == null || !settings.ContainsKey(id)) && org != null) { var setting = OnlineRegModel.ParseSetting(org.RegSetting, id); shell = DbUtil.Content(setting.ShellBs, null); } if (!shell.HasValue() && settings != null && settings.ContainsKey(id)) { shell = DbUtil.Content(settings[id].ShellBs, null); } if (!shell.HasValue()) { shell = DbUtil.Content("ShellDefaultBs", ""); if (!shell.HasValue()) { shell = DbUtil.Content("DefaultShellBs", ""); } } if (shell.HasValue()) { var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline); var t = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.OnlineReg2Css()); ViewBag.hasshell = true; ViewBag.top = t; var b = re.Match(shell).Groups[2].Value; ViewBag.bottom = b; } else { ViewBag.hasshell = false; } }
public ActionResult EmailBody(string id) { var i = id.ToInt(); var c = ViewExtensions2.GetContent(i); if (c == null) { return(new EmptyResult()); } var doc = new HtmlDocument(); doc.LoadHtml(c.Body); var bvedits = doc.DocumentNode.SelectNodes("//div[contains(@class,'bvedit') or @bvedit]"); if (bvedits == null || !bvedits.Any()) { c.Body = $"<div bvedit='discardthis'>{c.Body}</div>"; } ViewBag.content = c; return(View()); }
protected void TryLoadAlternateShell() { var shell = string.Empty; var logonPageShellSettingKey = LogonPageShellSettingKey; var queryString = Request.QueryString["campus"]; if (!string.IsNullOrWhiteSpace(queryString)) { logonPageShellSettingKey += "-" + queryString.ToUpper(); } var alternateShellSetting = CurrentDatabase.Settings.SingleOrDefault(x => x.Id == logonPageShellSettingKey); if (alternateShellSetting != null) { var alternateShell = CurrentDatabase.Contents.SingleOrDefault(x => x.Name == alternateShellSetting.SettingX); if (alternateShell != null) { shell = alternateShell.Body; } } if (shell.HasValue()) { var re = new Regex(@"(.*<!--FORM START-->\s*).*(<!--FORM END-->.*)", RegexOptions.Singleline); var t = re.Match(shell).Groups[1].Value.Replace("<!--FORM CSS-->", ViewExtensions2.Bootstrap3Css()); t = t.Replace("<html>\r\n<head>\r\n\t<title></title>\r\n</head>\r\n<body> </body>\r\n", ""); ViewBag.hasshell = true; ViewBag.top = t; var b = re.Match(shell).Groups[2].Value; b = b.Replace("</html>", ""); ViewBag.bottom = b; } else { ViewBag.hasshell = false; } }
private ReturnResult AddOrgMembers(int id, int origin, int membertypeid = MemberTypeCode.Member, bool pending = false) { string message = null; if (id > 0) { var org = DbUtil.Db.LoadOrganizationById(id); if (pending == false && PendingList.Count == 1 && org.AllowAttendOverlap != true) { var om = DbUtil.Db.OrganizationMembers.FirstOrDefault(mm => mm.OrganizationId != id && mm.MemberTypeId != 230 && // inactive mm.MemberTypeId != 500 && // inservice mm.Organization.AllowAttendOverlap != true && mm.PeopleId == PendingList[0].PeopleId && mm.Organization.OrgSchedules.Any(ss => DbUtil.Db.OrgSchedules.Any(os => os.OrganizationId == id && os.ScheduleId == ss.ScheduleId))); if (om != null) { message = ViewExtensions2.Markdown($@" **Already a member of {om.OrganizationId} (orgid) with same schedule** You can do one of these things: * Drop the person from the other org first * Use the 'move' feature to transfer them to the new org * Use Allow Attendance Overlap, if appropriate * See <a href=""http://docs.touchpointsoftware.com/Organizations/AlreadyAMember.html"" title=""Already a Member"" target=""_blank"">this help article</a> ").ToString(); message = $@"<div style=""text-align: left"">{message}</div>"; return(new ReturnResult { close = true, how = "CloseAddDialog", error = message, from = AddContext }); } } foreach (var p in PendingList) { AddPerson(p, PendingList, origin, EntryPointId); var om = OrganizationMember.InsertOrgMembers(DbUtil.Db, id, p.PeopleId.Value, membertypeid, Util.Now, null, pending); if (membertypeid == MemberTypeCode.InActive && org.IsMissionTrip == true) { om.AddToGroup(DbUtil.Db, "Sender"); } if (om.CreatedDate.HasValue) { if ((DateTime.Now - om.CreatedDate.Value).TotalSeconds < 5) { var type = pending ? "Pending" : membertypeid == MemberTypeCode.InActive ? "Inactive" : membertypeid == MemberTypeCode.Prospect ? "Prospect" : "Member"; DbUtil.LogActivity($"Org{type} Add", om.OrganizationId, om.PeopleId); } } } DbUtil.Db.SubmitChanges(); DbUtil.Db.UpdateMainFellowship(id); } return(new ReturnResult { close = true, how = "rebindgrids", error = message, from = AddContext }); }
public string getForm() { _controller.ViewData.Model = this; return(ViewExtensions2.RenderPartialViewToString(_controller, "MapForm", this)); }