Esempio n. 1
0
        public ActionResult ConfirmPledge(ManagePledgesModel m)
        {
            var staff = DbUtil.Db.StaffPeopleForOrg(m.orgid);

            var desc = "{0}; {1}; {2}, {3} {4}".Fmt(
                m.person.Name,
                m.person.PrimaryAddress,
                m.person.PrimaryCity,
                m.person.PrimaryState,
                m.person.PrimaryZip);

            m.person.PostUnattendedContribution(DbUtil.Db,
                m.pledge ?? 0,
                m.setting.DonationFundId,
                desc, pledge: true);

            var pi = m.GetPledgeInfo();
            var body = m.setting.Body;
            if (!body.HasValue())
                return Content("There is no Confirmation Message (required)");
            body = body.Replace("{amt}", pi.Pledged.ToString("N2"), ignoreCase: true);
            body = body.Replace("{org}", m.Organization.OrganizationName, ignoreCase: true);
            body = body.Replace("{first}", m.person.PreferredName, ignoreCase: true);
            DbUtil.Db.EmailRedacted(staff[0].FromEmail, m.person, m.setting.Subject, body);

            DbUtil.Db.Email(m.person.FromEmail, staff, "Online Pledge", @"{0} made a pledge to {1}".Fmt(m.person.Name, m.Organization.OrganizationName));

            SetHeaders(m.orgid);
            return View(m);
        }
Esempio n. 2
0
 public ActionResult ManagePledge(string id)
 {
     if (!id.HasValue())
         return Content("bad link");
     ManagePledgesModel m = null;
     var td = TempData["mp"];
     if (td != null)
         m = new ManagePledgesModel(td.ToInt(), id.ToInt());
     else
     {
         var guid = id.ToGuid();
         if (guid == null)
             return Content("invalid link");
         var ot = DbUtil.Db.OneTimeLinks.SingleOrDefault(oo => oo.Id == guid.Value);
         if (ot == null)
             return Content("invalid link");
         if (ot.Used)
             return Content("link used");
         if (ot.Expires.HasValue && ot.Expires < DateTime.Now)
             return Content("link expired");
         var a = ot.Querystring.Split(',');
         m = new ManagePledgesModel(a[1].ToInt(), a[0].ToInt());
         ot.Used = true;
         DbUtil.Db.SubmitChanges();
     }
     SetHeaders(m.orgid);
     DbUtil.LogActivity("Manage Pledge: {0} ({1})".Fmt(m.Organization.OrganizationName, m.person.Name));
     return View("ManagePledge/Index", m);
 }
Esempio n. 3
0
 public ActionResult ConfirmPledge(ManagePledgesModel m)
 {
     m.Confirm();
     SetHeaders(m.orgid);
     return View("ManagePledge/Confirm", m);
 }