예제 #1
0
        public ActionResult UpdateNotifyIds(int id, int topid, string field)
        {
            var t             = CurrentDatabase.FetchOrCreateTag(CurrentDatabase.CurrentSessionId, CurrentDatabase.UserPeopleId, DbUtil.TagTypeId_AddSelected);
            var selected_pids = (from p in t.People(CurrentDatabase)
                                 orderby p.PeopleId == topid ? "0" : "1"
                                 select p.PeopleId).ToArray();
            var o         = CurrentDatabase.LoadOrganizationById(id);
            var notifyids = string.Join(",", selected_pids);

            switch (field.ToLower())
            {
            case "notifyids":
                o.NotifyIds = notifyids;
                break;

            case "giftnotifyids":
                o.GiftNotifyIds = notifyids;
                break;
            }
            CurrentDatabase.TagPeople.DeleteAllOnSubmit(t.PersonTags);
            CurrentDatabase.Tags.DeleteOnSubmit(t);
            CurrentDatabase.SubmitChanges();
            ViewBag.OrgId = id;
            ViewBag.field = field;
            var view = ViewExtensions2.RenderPartialViewToString(this, "Registration/NotifyList", notifyids);

            return(Content(view));
            //return View("NotifyList2", notifyids);
        }
예제 #2
0
        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;
        }
예제 #3
0
        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));
        }
예제 #4
0
        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));
        }
예제 #5
0
        public ActionResult ManageGiving2(int id)
        {
            var m = new ManageGivingModel(id);

            m.testing = true;
            var body = ViewExtensions2.RenderPartialViewToString(this, "ManageGiving2", m);

            return(Content(body));
        }
예제 #6
0
        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));
        }
예제 #7
0
        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));
        }
예제 #8
0
 private ActionResult FlowList(OnlineRegModel m)
 {
     try
     {
         m.UpdateDatum();
         m.Log(fromMethod);
         var content = ViewExtensions2.RenderPartialViewToString(this, "Flow2/List", m);
         return(Content(content));
     }
     catch (Exception ex)
     {
         return(ErrorResult(m, ex, "In " + fromMethod + "<br>" + ex.Message));
     }
 }
예제 #9
0
        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;
        }
예제 #10
0
        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());
        }
예제 #11
0
        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);
        }
예제 #12
0
 public string getForm()
 {
     _controller.ViewData.Model = this;
     return(ViewExtensions2.RenderPartialViewToString(_controller, "MapForm", this));
 }