Esempio n. 1
0
        public ActionResult ManageGiving(ManageGivingModel m)
        {
            m.SetCurrentDatabase(CurrentDatabase);
            SetHeaders(m.orgid);

            // only validate if the amounts are greater than zero.
            if (m.FundItemsChosen().Sum(f => f.amt) > 0)
            {
                m.ValidateModel(ModelState);
                if (!ModelState.IsValid)
                {
                    if (m.person == null)
                    {
                        return(Message("person not found"));
                    }
                    m.total = 0;
                    foreach (var ff in m.FundItemsChosen())
                    {
                        m.total += ff.amt;
                    }
                    return(View("ManageGiving/Setup", m));
                }
            }
            else
            {
                ModelState.AddModelError("funds", "You must choose at least one fund to give to.");
                return(View("ManageGiving/Setup", m));
            }
            if (CurrentDatabase.Setting("UseRecaptchaForManageGiving"))
            {
                if (!GoogleRecaptcha.IsValidResponse(HttpContext, CurrentDatabase))
                {
                    ModelState.AddModelError("TranId", "ReCaptcha validation failed.");
                    return(View("ManageGiving/Setup", m));
                }
            }

            try
            {
                m.Update();
            }
            catch (Exception ex)
            {
                if (ex.Message == "InvalidVaultId")
                {
                    m = ClearPaymentInfo(m, ModelState);
                }
                else
                {
                    ModelState.AddModelError("form", ex.Message);
                }
            }
            if (!ModelState.IsValid)
            {
                return(View("ManageGiving/Setup", m));
            }

            RequestManager.SessionProvider.Add("managegiving", m);
            return(Redirect("/OnlineReg/ConfirmRecurringGiving"));
        }
Esempio n. 2
0
        public ActionResult ManageGiving(ManageGivingModel m)
        {
            SetHeaders(m.orgid);

            // only validate if the amounts are greater than zero.
            if (m.FundItemsChosen().Sum(f => f.amt) > 0)
            {
                m.ValidateModel(ModelState);
                if (!ModelState.IsValid)
                {
                    m.total = 0;
                    foreach (var ff in m.FundItemsChosen())
                    {
                        m.total += ff.amt;
                    }
                    return(View("ManageGiving/Setup", m));
                }
            }

            try
            {
                m.Update();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("form", ex.Message);
            }
            if (!ModelState.IsValid)
            {
                return(View("ManageGiving/Setup", m));
            }

            TempData["managegiving"] = m;
            return(Redirect("/OnlineReg/ConfirmRecurringGiving"));
        }
Esempio n. 3
0
        public ActionResult ManageGiving(ManageGivingModel m)
        {
            SetHeaders(m.orgid);

            // only validate if the amounts are greater than zero.
            if (m.FundItemsChosen().Sum(f => f.amt) > 0)
            {
                m.ValidateModel(ModelState);
                if (!ModelState.IsValid)
                {
                    if (m.person == null)
                    {
                        return(Message("person not found"));
                    }
                    m.total = 0;
                    foreach (var ff in m.FundItemsChosen())
                    {
                        m.total += ff.amt;
                    }
                    return(View("ManageGiving/Setup", m));
                }
            }
            if (CurrentDatabase.Setting("UseRecaptchaForManageGiving"))
            {
                if (!GoogleRecaptcha.IsValidResponse(HttpContext, CurrentDatabase))
                {
                    ModelState.AddModelError("TranId", "ReCaptcha validation failed.");
                    return(View("ManageGiving/Setup", m));
                }
            }

            try
            {
                m.Update();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("form", ex.Message);
            }
            if (!ModelState.IsValid)
            {
                return(View("ManageGiving/Setup", m));
            }

            TempData["managegiving"] = m;
            return(Redirect("/OnlineReg/ConfirmRecurringGiving"));
        }
Esempio n. 4
0
		public ActionResult ManageGiving(ManageGivingModel m)
		{
			SetHeaders(m.orgid);
			m.ValidateModel(ModelState);
			if (!ModelState.IsValid)
				return View("ManageGiving/Setup", m);
			try
			{
				m.Update();
			}
			catch (Exception ex)
			{
				ModelState.AddModelError("form", ex.Message);
			}
			if (!ModelState.IsValid)
				return View("ManageGiving/Setup", m);
			TempData["managegiving"] = m;
			return Redirect("/OnlineReg/ConfirmRecurringGiving");
		}