当前位置: 首页>>代码示例>>C#>>正文


C# CMSDataContext.FinancePeople方法代码示例

本文整理汇总了C#中CmsData.CMSDataContext.FinancePeople方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.FinancePeople方法的具体用法?C# CMSDataContext.FinancePeople怎么用?C# CMSDataContext.FinancePeople使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CmsData.CMSDataContext的用法示例。


在下文中一共展示了CMSDataContext.FinancePeople方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoGiving

        public int DoGiving(CMSDataContext Db)
        {
            var gateway = Db.Setting("TransactionGateway", "");
            AuthorizeNet anet = null;
            SagePayments sage = null;
            if (gateway == "AuthorizeNet")
                anet = new AuthorizeNet(Db, testing: false);
            else if (gateway == "Sage")
                sage = new SagePayments(Db, testing: false);
            else
                return 0;

            TransactionResponse ret = null;
            var total = (from a in Db.RecurringAmounts
                         where a.PeopleId == PeopleId
                         where a.ContributionFund.FundStatusId == 1
                         select a.Amt).Sum();

            if (!total.HasValue || total == 0)
                return 0;

            var preferredtype = (from pi in Db.PaymentInfos
                                 where pi.PeopleId == PeopleId
                                 select pi.PreferredGivingType).Single();

            var t = new Transaction
            {
                TransactionDate = DateTime.Now,
                TransactionId = "started",
                First = Person.FirstName,
                MiddleInitial = Person.MiddleName.Truncate(1) ?? "",
                Last = Person.LastName,
                Suffix = Person.SuffixCode,
                Amt = total,
                Description = "Recurring Giving",
                Testing = false,
                TransactionGateway = gateway,
                Financeonly = true
            };
            Db.Transactions.InsertOnSubmit(t);
            Db.SubmitChanges();

            if (gateway == "AuthorizeNet")
                ret = anet.createCustomerProfileTransactionRequest(PeopleId, total ?? 0, "Recurring Giving", t.Id);
            else
                ret = sage.createVaultTransactionRequest(PeopleId, total ?? 0, "Recurring Giving", t.Id, preferredtype);
            t.TransactionPeople.Add(new TransactionPerson { PeopleId = PeopleId, Amt = total });

            t.Message = ret.Message;
            t.AuthCode = ret.AuthCode;
            t.Approved = ret.Approved;
            t.TransactionId = ret.TransactionId;
            var systemEmail = Db.Setting("SystemEmailAddress", "[email protected]");

            var contributionemail = (from ex in Person.PeopleExtras
                                     where ex.Field == "ContributionEmail"
                                     select ex.Data).SingleOrDefault();
            if (contributionemail.HasValue())
                contributionemail = contributionemail.Trim();
            if (!Util.ValidEmail(contributionemail))
                contributionemail = Person.FromEmail;
            var gift = Db.Setting("NameForPayment", "gift");
            var church = Db.Setting("NameOfChurch", Db.CmsHost);
            if (ret.Approved)
            {
                var q = from a in Db.RecurringAmounts
                        where a.PeopleId == PeopleId
                        select a;

                foreach (var a in q)
                {
                    if (a.ContributionFund.FundStatusId == 1 && a.Amt > 0)
                        Person.PostUnattendedContribution(Db,
                            a.Amt ?? 0,
                            a.FundId,
                            "Recurring Giving", pledge: false);
                }
                var tot = q.Where(aa => aa.ContributionFund.FundStatusId == 1).Sum(aa => aa.Amt);
                NextDate = FindNextDate(DateTime.Today.AddDays(1));
                Db.SubmitChanges();
                if (tot > 0)
                {
                    Util.SendMsg(systemEmail, Db.CmsHost, Util.TryGetMailAddress(contributionemail),
                                 "Recurring {0} for {1}".Fmt(gift, church),
                                 "Your payment of ${0:N2} was processed this morning.".Fmt(tot),
                                 Util.ToMailAddressList(contributionemail), 0, null);
                }
            }
            else
            {
                Db.SubmitChanges();
                var failedGivingMessage = Db.ContentHtml("FailedGivingMessage", Resources.ManagedGiving_FailedGivingMessage);
                var adminEmail = Db.Setting("AdminMail", systemEmail);
                Util.SendMsg(systemEmail, Db.CmsHost, Util.TryGetMailAddress(contributionemail),
                        "Recurring {0} failed for {1}".Fmt(gift, church),
                        failedGivingMessage.Replace("{first}", Person.PreferredName),
                        Util.ToMailAddressList(contributionemail), 0, null);
                foreach (var p in Db.FinancePeople())
                    Util.SendMsg(systemEmail, Db.CmsHost, Util.TryGetMailAddress(adminEmail),
                        "Recurring Giving Failed on " + Db.CmsHost,
//.........这里部分代码省略.........
开发者ID:vs06,项目名称:bvcms,代码行数:101,代码来源:ManagedGiving.cs


注:本文中的CmsData.CMSDataContext.FinancePeople方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。