Exemplo n.º 1
0
 private List <ChartDTO> GetChartContributions(CMSDataContext db, int year, int[] fundIds = null)
 {
     if (fundIds.IsNotNull())
     {
         return((from c in Contribution.GetContributionsPerYear(db, year, fundIds)
                 group c by new { c.ContributionDate.Value.Month }
                 into grp
                 select new ChartDTO
         {
             Name = grp.First().ContributionDate.Value.ToString("MMM", CultureInfo.InvariantCulture),
             Count = Convert.ToInt32(grp.Sum(t => t.ContributionAmount).Value)
         }).ToList());
     }
     else
     {
         return((from c in Contribution.GetContributionsPerYear(db, year)
                 group c by new { c.ContributionDate.Value.Month }
                 into grp
                 select new ChartDTO
         {
             Name = grp.First().ContributionDate.Value.ToString("MMM", CultureInfo.InvariantCulture),
             Count = Convert.ToInt32(grp.Sum(t => t.ContributionAmount).Value)
         }).ToList());
     }
 }
Exemplo n.º 2
0
        public static List <Contribution> GetContributionsPerYear(CMSDataContext db, int?year, int[] fundids = null, bool includeReturnedReversed = false, bool includePledges = false)
        {
            var yearFlag = year.IsNull();

            return((from c in Contribution.GetContributions(db, fundids, includeReturnedReversed, includePledges)
                    where (!yearFlag ? c.ContributionDate.Value.Year == (year) : 1 == 1)
                    select c).ToList());
        }
Exemplo n.º 3
0
 public BundleHeader GetBundleHeader(
     DateTime date,
     DateTime now,
     int?btid             = null,
     DateTime?depositDate = null,
     decimal?bundleTotal  = null)
 {
     return(Contribution.GetBundleHeader(db, date, now, btid, depositDate, bundleTotal));
 }
Exemplo n.º 4
0
 protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (e.CommandName.StartsWith("Re"))
     {
         var id = e.CommandArgument.ToInt();
         var c = DbUtil.Db.Contributions.Single(ic => ic.ContributionId == id);
         var now = Util.Now;
         var r = new Contribution
         {
             ContributionStatusId = ContributionStatusCode.Recorded,
             CreatedBy = Util.UserId1,
             CreatedDate = now,
             PeopleId = c.PeopleId,
             ContributionAmount = c.ContributionAmount,
             ContributionDate = now.Date,
             PostingDate = now,
             FundId = c.FundId,
         };
         DbUtil.Db.Contributions.InsertOnSubmit(r);
         switch (e.CommandName)
         {
             case "Reverse":
                 c.ContributionStatusId = ContributionStatusCode.Reversed;
                 r.ContributionTypeId = ContributionTypeCode.Reversed;
                 r.ContributionDesc = "Reversed Contribution Id = " + c.ContributionId;
                 break;
             case "Return":
                 c.ContributionStatusId = ContributionStatusCode.Returned;
                 r.ContributionTypeId = ContributionTypeCode.ReturnedCheck;
                 r.ContributionDesc = "Returned Check for Contribution Id = " + c.ContributionId;
                 break;
         }
         DbUtil.Db.SubmitChanges();
         ListView1.DataBind();
     }
 }
Exemplo n.º 5
0
 private static Contribution CreateContributionRecord(Contribution c)
 {
     var now = Util.Now;
     var r = new Contribution
     {
         ContributionStatusId = ContributionStatusCode.Recorded,
         CreatedBy = Util.UserId1,
         CreatedDate = now,
         PeopleId = c.PeopleId,
         ContributionAmount = c.ContributionAmount,
         ContributionDate = now.Date,
         PostingDate = now,
         FundId = c.FundId,
     };
     return r;
 }
Exemplo n.º 6
0
 public BundleDetail AddContributionDetail(DateTime date, int fundid,
                                           string amount, string checkno, string routing, string account, int contributionTypeId, int?pid = null, string description = null)
 {
     return(Contribution.AddContributionDetail(db, date, fundid, amount, checkno, routing, account, contributionTypeId, pid, description));
 }
Exemplo n.º 7
0
 public BundleDetail AddContributionDetail(DateTime date, int fundid,
                                           string amount, string checkno, string routing, string account)
 {
     return(Contribution.AddContributionDetail(db, date, fundid, amount, checkno, routing, account));
 }
Exemplo n.º 8
0
 public BundleDetail AddContribution(DateTime date, int fundid, string amount, string checkno, string description, int peopleid, int contributionTypeId)
 {
     return(Contribution.AddContribution(db, date, fundid, amount, checkno, description, peopleid, contributionTypeId));
 }
Exemplo n.º 9
0
 public void FinishBundle(BundleHeader bh)
 {
     Contribution.FinishBundle(db, bh);
 }
Exemplo n.º 10
0
 private void detach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ContributionStatus = null;
 }
Exemplo n.º 11
0
 private void detach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ContributionStatus = null;
 }
Exemplo n.º 12
0
 private void attach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ContributionType = this;
 }
Exemplo n.º 13
0
 private void attach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ContributionFund = this;
 }
Exemplo n.º 14
0
 public BundleHeader GetBundleHeader(DateTime date, DateTime now, int?btid = null)
 {
     return(Contribution.GetBundleHeader(db, date, now, btid));
 }
Exemplo n.º 15
0
 private void detach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ExtraDatum = null;
 }
Exemplo n.º 16
0
 private void detach_Contributions(Contribution entity)
 {
     this.SendPropertyChanging();
     entity.ExtraDatum = null;
 }