本文整理汇总了C#中CmsData.CMSDataContext.GetCurrentOnlinePledgeBundle方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.GetCurrentOnlinePledgeBundle方法的具体用法?C# CMSDataContext.GetCurrentOnlinePledgeBundle怎么用?C# CMSDataContext.GetCurrentOnlinePledgeBundle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmsData.CMSDataContext
的用法示例。
在下文中一共展示了CMSDataContext.GetCurrentOnlinePledgeBundle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostUnattendedContribution
public Contribution PostUnattendedContribution(CMSDataContext db, decimal amt, int? fund, string description, bool pledge = false, int? typecode = null, int? tranid = null)
{
if (!typecode.HasValue)
{
typecode = BundleTypeCode.Online;
if (pledge)
typecode = BundleTypeCode.OnlinePledge;
}
var now = Util.Now;
var d = now.Date;
BundleHeader bundle = null;
var spec = db.Setting("OnlineContributionBundleDayTime", "");
if (spec.HasValue())
{
var a = spec.SplitStr(" ", 2);
try
{
var next = DateTime.Parse(now.ToShortDateString() + " " + a[1]);
var dow = Enum.Parse(typeof(DayOfWeek), a[0], ignoreCase: true);
next = next.Sunday().Add(next.TimeOfDay).AddDays(dow.ToInt());
if (now > next)
next = next.AddDays(7);
var prev = next.AddDays(-7);
var bid = BundleTypeCode.MissionTrip == typecode
? db.GetCurrentMissionTripBundle(next, prev)
: BundleTypeCode.OnlinePledge == typecode
? db.GetCurrentOnlinePledgeBundle(next, prev)
: db.GetCurrentOnlineBundle(next, prev);
bundle = db.BundleHeaders.SingleOrDefault(bb => bb.BundleHeaderId == bid);
}
catch (Exception)
{
spec = "";
}
}
if (!spec.HasValue())
{
var nextd = d.AddDays(1);
var bid = BundleTypeCode.MissionTrip == typecode
? db.GetCurrentMissionTripBundle(nextd, d)
: BundleTypeCode.OnlinePledge == typecode
? db.GetCurrentOnlinePledgeBundle(nextd, d)
: db.GetCurrentOnlineBundle(nextd, d);
bundle = db.BundleHeaders.SingleOrDefault(bb => bb.BundleHeaderId == bid);
}
if (bundle == null)
{
bundle = new BundleHeader
{
BundleHeaderTypeId = typecode.Value,
BundleStatusId = BundleStatusCode.Open,
CreatedBy = Util.UserId1,
ContributionDate = d,
CreatedDate = now,
FundId = db.Setting("DefaultFundId", "1").ToInt(),
RecordStatus = false,
TotalCash = 0,
TotalChecks = 0,
TotalEnvelopes = 0,
BundleTotal = 0
};
db.BundleHeaders.InsertOnSubmit(bundle);
}
if (!fund.HasValue)
fund = db.Setting("DefaultFundId", "1").ToInt();
var fundtouse = (from f in db.ContributionFunds
where f.FundId == fund
select f).SingleOrDefault();
//failsafe if fund is not found
if (fundtouse == null)
fund = (from f in db.ContributionFunds
where f.FundStatusId == 1
orderby f.FundId
select f.FundId).First();
var financeManagerId = db.Setting("FinanceManagerId", "").ToInt2();
if (!financeManagerId.HasValue)
{
var qu = from u in db.Users
where u.UserRoles.Any(ur => ur.Role.RoleName == "Finance")
orderby u.Person.LastName
select u.UserId;
financeManagerId = qu.FirstOrDefault();
if (!financeManagerId.HasValue)
financeManagerId = 1;
}
var bd = new BundleDetail
{
BundleHeaderId = bundle.BundleHeaderId,
CreatedBy = financeManagerId.Value,
CreatedDate = now,
};
var typid = ContributionTypeCode.CheckCash;
if (pledge)
typid = ContributionTypeCode.Pledge;
bd.Contribution = new Contribution
{
//.........这里部分代码省略.........