Exemplo n.º 1
0
        public async Task <ActionResult> RecurringManagment(int PeopleId, int OrgId)
        {
            ViewBag.PeopleId = PeopleId;
            ViewBag.OrgId    = OrgId;
            string payerKey = _resolver.ResolvePayerKey(PeopleId);
            IEnumerable <RecurringPayment> rpList = await _pushpayPayment.GetRecurringPaymentsForAPayer(payerKey);

            if (rpList == null || rpList.Count() == 0)
            {
                string mobile = CurrentDatabase.People.SingleOrDefault(p => p.PeopleId == PeopleId).CellPhone;
                return(NewRecurringGiving(PeopleId, OrgId));
            }
            List <RecurringManagment> model = new List <RecurringManagment>();

            foreach (var item in rpList)
            {
                RecurringManagment mg = new RecurringManagment()
                {
                    NextPayment = item.Schedule.NextPaymentDate,
                    Amount      = item.Amount.Amount,
                    Fund        = item.Fund.Name,
                    Frequency   = item.Schedule.Frequency,
                    LinkToEdit  = item.Links["donorviewrecurringpayment"].Href
                };
                model.Add(mg);
            }
            return(View(model));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> RecurringManagment(int PeopleId)
        {
            var oid = (from o in CurrentDatabase.Organizations
                       where o.RegistrationTypeId == RegistrationTypeCode.ManageGiving
                       select o.OrganizationId).FirstOrDefault();

            if (oid <= 0)
            {
                return(View("OnePageGiving/NotConfigured"));
            }

            ViewBag.PeopleId = PeopleId;
            ViewBag.OrgId    = oid;

            string payerKey = PushpayResolver.ResolvePayerKey(CurrentDatabase, PeopleId);
            IEnumerable <RecurringPayment> rpList = await _pushpayPayment.GetRecurringPaymentsForAPayer(payerKey);

            if (rpList == null || rpList.Count() == 0)
            {
                string mobile = CurrentDatabase.People.SingleOrDefault(p => p.PeopleId == PeopleId).CellPhone;
                return(NewRecurringGiving(PeopleId, oid));
            }
            List <RecurringManagment> model = new List <RecurringManagment>();

            foreach (var item in rpList)
            {
                RecurringManagment mg = new RecurringManagment()
                {
                    NextPayment = item.Schedule.NextPaymentDate,
                    Amount      = item.Amount.Amount,
                    Fund        = item.Fund.Name,
                    Frequency   = item.Schedule.Frequency,
                    LinkToEdit  = item.Links["donorviewrecurringpayment"].Href
                };
                model.Add(mg);
            }
            return(View(model));
        }