Exemplo n.º 1
0
        public ActionResult ConfirmVolunteerSlots(VolunteerModel m)
        {
            m.UpdateCommitments();
            if (m.SendEmail || !m.IsLeader)
            {
                List<Person> Staff = null;
                Staff = DbUtil.Db.StaffPeopleForOrg(m.OrgId);
                var staff = Staff[0];

                var summary = m.Summary(this);
                var text = Util.PickFirst(m.setting.Body, "confirmation email body not found");
                text = text.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.Org.PhoneNumber.FmtFone(), ignoreCase: true);
                text = text.Replace("{details}", summary, ignoreCase: true);
                DbUtil.Db.Email(staff.FromEmail, m.Person, m.setting.Subject, text);

                DbUtil.Db.Email(m.Person.FromEmail, Staff, "Volunteer Commitments managed", @"{0} managed volunteer commitments to {1}<br/>
            The following Committments:<br/>
            {2}".Fmt(m.Person.Name, m.Org.OrganizationName, summary));
            }
            ViewData["Organization"] = m.Org.OrganizationName;
            SetHeaders(m.OrgId);
            if (m.IsLeader)
                return View("ManageVolunteer", m);
            return View(m);
        }