示例#1
0
        private void Populate()
        {
            var q = from mm in DbUtil.Db.OrganizationMembers
                    let ts = DbUtil.Db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == mm.TranId && tt.PeopleId == mm.PeopleId)
                             where mm.OrganizationId == OrgId && mm.PeopleId == PeopleId
                             select new
            {
                mm.Person.Name,
                mm.Organization.OrganizationName,
                om = mm,
                mt = mm.Organization.IsMissionTrip ?? false,
                ts
            };
            var i = q.SingleOrDefault();

            if (i == null)
            {
                return;
            }

            Name               = i.Name;
            OrgName            = i.OrganizationName;
            om                 = i.om;
            isMissionTrip      = i.mt;
            TransactionSummary = i.ts;
            Due                = isMissionTrip
                ? MissionTripFundingModel.TotalDue(peopleId, orgId)
                : i.ts != null ? i.ts.TotDue ?? 0 : 0;
        }
 private void Populate()
 {
     var q = from mm in DbUtil.Db.OrganizationMembers
             let ts = DbUtil.Db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == mm.TranId && tt.PeopleId == mm.PeopleId)
             where mm.OrganizationId == OrgId && mm.PeopleId == PeopleId
             select new
             {
                 mm.Person.Name,
                 mm.Organization.OrganizationName,
                 om = mm,
                 mt = mm.Organization.IsMissionTrip ?? false,
                 ts
             };
     var i = q.SingleOrDefault();
     if (i == null)
         return;
     Name = i.Name;
     OrgName = i.OrganizationName;
     om = i.om;
     isMissionTrip = i.mt;
     TransactionSummary = i.ts;
     Due = isMissionTrip
         ? MissionTripFundingModel.TotalDue(peopleId, orgId)
         : i.ts != null ? i.ts.TotDue ?? 0 : 0;
 }
示例#3
0
        private void Populate()
        {
            var i = (from mm in DbUtil.Db.OrganizationMembers
                     where mm.OrganizationId == OrgId && mm.PeopleId == PeopleId
                     select new
            {
                mm,
                mm.Person.Name,
                mm.Organization.OrganizationName,
                mm.Organization.RegSetting,
                mm.Organization,
                mm.OrgMemMemTags,
                mm.Organization.IsMissionTrip,
                ts = DbUtil.Db.ViewTransactionSummaries.SingleOrDefault(tt => tt.RegId == mm.TranId && tt.PeopleId == PeopleId)
            }).SingleOrDefault();

            if (i == null)
            {
                throw new Exception("missing OrgMember at oid={0}, pid={1}".Fmt(OrgId, PeopleId));
            }
            om = i.mm;
            TransactionSummary = i.ts;
            this.CopyPropertiesFrom(om);
            Name = i.Name;

            IsMissionTrip = i.IsMissionTrip ?? false;
            if (TransactionSummary != null)
            {
                AmountPaidTransactions = IsMissionTrip
                    ? om.TotalPaid(DbUtil.Db)
                    : TransactionSummary.IndPaid;
                AmountDue = IsMissionTrip
                    ? om.AmountDue(DbUtil.Db)
                    : TransactionSummary.IndDue;
            }

            OrgName       = i.OrganizationName;
            Organization  = i.Organization;
            OrgMemMemTags = i.OrgMemMemTags.ToList();
            Setting       = new Settings(i.RegSetting, DbUtil.Db, OrgId ?? 0);
        }