LastSet() public method

public LastSet ( ) : int
return int
        public void DoWork()
        {
            Db = DbUtil.Create(Host);
            Db.CommandTimeout = 1200;

            var noaddressok = Db.Setting("RequireAddressOnStatement", "true") == "false";
            showCheckNo = Db.Setting("RequireCheckNoOnStatement", "false").ToLower() == "true";
            showNotes = Db.Setting("RequireNotesOnStatement", "false").ToLower() == "true";
            const bool UseMinAmt = true;

            var qc = APIContribution.contributors(Db, fd, td, 0, 0, 0, noaddressok, UseMinAmt, StartsWith, Sort, tagid: TagId, excludeelectronic: ExcludeElectronic);
            var runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
            runningtotals.Count = qc.Count();
            Db.SubmitChanges();
            if (showCheckNo || showNotes)
            {
                var c = new ContributionStatementsExtra
                {
                    FromDate = fd,
                    ToDate = td,
                    typ = 3,
                    ShowCheckNo = showCheckNo,
                    ShowNotes = showNotes
                };
                using (var stream = new FileStream(OutputFile, FileMode.Create))
                    c.Run(stream, Db, qc);
                LastSet = c.LastSet();
                var sets = c.Sets();
                foreach (var set in sets)
                    using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                        c.Run(stream, Db, qc, set);
                runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.LastSet = LastSet;
                runningtotals.Sets = string.Join(",", sets);
                runningtotals.Completed = DateTime.Now;
                Db.SubmitChanges();
            }
            else
            {
                var c = new ContributionStatements
                {
                    FromDate = fd,
                    ToDate = td,
                    typ = 3
                };
                using (var stream = new FileStream(OutputFile, FileMode.Create))
                    c.Run(stream, Db, qc);
                LastSet = c.LastSet();
                var sets = c.Sets();
                foreach (var set in sets)
                    using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                        c.Run(stream, Db, qc, set);
                runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.LastSet = LastSet;
                runningtotals.Sets = string.Join(",", sets);
                runningtotals.Completed = DateTime.Now;
                Db.SubmitChanges();
            }
        }
        public void DoWork(ContributionStatements.StatementSpecification cs)
        {
            Db = DbUtil.Create(Host);
            DbUtil.Db.CommandTimeout = 1200;

            var noaddressok = !DbUtil.Db.Setting("RequireAddressOnStatement", true);

            showCheckNo = DbUtil.Db.Setting("RequireCheckNoOnStatement");
            showNotes   = DbUtil.Db.Setting("RequireNotesOnStatement");
            const bool UseMinAmt = true;

            var qc            = APIContribution.Contributors(DbUtil.Db, fd, td, 0, 0, 0, cs.Funds, noaddressok, UseMinAmt, StartsWith, Sort, tagid: TagId, excludeelectronic: ExcludeElectronic);
            var runningtotals = DbUtil.Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();

            runningtotals.Count = qc.Count();
            DbUtil.Db.SubmitChanges();
            if (showCheckNo || showNotes)
            {
                var c = new ContributionStatementsExtra
                {
                    FromDate    = fd,
                    ToDate      = td,
                    typ         = 3,
                    ShowCheckNo = showCheckNo,
                    ShowNotes   = showNotes
                };
                using (var stream = new FileStream(OutputFile, FileMode.Create))
                {
                    c.Run(stream, Db, qc, cs);
                }

                LastSet = c.LastSet();
                var sets = c.Sets();
                foreach (var set in sets)
                {
                    using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                    {
                        c.Run(stream, Db, qc, cs, set);
                    }
                }

                runningtotals           = DbUtil.Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.LastSet   = LastSet;
                runningtotals.Sets      = string.Join(",", sets);
                runningtotals.Completed = DateTime.Now;
                DbUtil.Db.SubmitChanges();
            }
            else
            {
                var c = new ContributionStatements
                {
                    FromDate = fd,
                    ToDate   = td,
                    typ      = 3
                };
                using (var stream = new FileStream(OutputFile, FileMode.Create))
                {
                    c.Run(stream, Db, qc, cs);
                }

                LastSet = c.LastSet();
                var sets = c.Sets();
                foreach (var set in sets)
                {
                    using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                    {
                        c.Run(stream, Db, qc, cs, set);
                    }
                }

                runningtotals           = DbUtil.Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.LastSet   = LastSet;
                runningtotals.Sets      = string.Join(",", sets);
                runningtotals.Completed = DateTime.Now;
                DbUtil.Db.SubmitChanges();
            }
        }
Exemplo n.º 3
0
        public void DoWork()
        {
            Db = new CMSDataContext(Util.GetConnectionString(Host));
            Db.Host = Host;
            Db.CommandTimeout = 1200;

            var noaddressok = Db.Setting("RequireAddressOnStatement", "true") == "false";
            showCheckNo = Db.Setting("RequireCheckNoOnStatement", "false").ToLower() == "true";
            showNotes = Db.Setting("RequireNotesOnStatement", "false").ToLower() == "true";

            var qc = APIContribution.contributors(Db, fd, td, 0, 0, 0, noaddressok, useMinAmt: true, startswith: StartsWith, sort: Sort);
            var runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
            runningtotals.Count = qc.Count();
            Db.SubmitChanges();
            if (PDF)
            {
                if (showCheckNo || showNotes)
                {
                    var c = new ContributionStatementsExtra
                    {
                        FromDate = fd,
                        ToDate = td,
                        typ = 3,
                        ShowCheckNo = showCheckNo,
                        ShowNotes = showNotes
                    };
                    using (var stream = new FileStream(OutputFile, FileMode.Create))
                        c.Run(stream, Db, qc);
                    LastSet = c.LastSet();
                    var sets = c.Sets();
                    foreach (var set in sets)
                        using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                            c.Run(stream, Db, qc, set);
                    runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                    runningtotals.LastSet = LastSet;
                    runningtotals.Sets = string.Join(",", sets);
                    runningtotals.Completed = DateTime.Now;
                    Db.SubmitChanges();
                }
                else
                {
                    var c = new ContributionStatements
                    {
                        FromDate = fd,
                        ToDate = td,
                        typ = 3
                    };
                    using (var stream = new FileStream(OutputFile, FileMode.Create))
                        c.Run(stream, Db, qc);
                    LastSet = c.LastSet();
                    var sets = c.Sets();
                    foreach (var set in sets)
                        using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                            c.Run(stream, Db, qc, set);
                    runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                    runningtotals.LastSet = LastSet;
                    runningtotals.Sets = string.Join(",", sets);
                    runningtotals.Completed = DateTime.Now;
                    Db.SubmitChanges();
                }
            }
            else
            {
                textStream = new StreamWriter(OutputFile);
                foreach (var c in qc)
                {
                    pageStatement = 1;
                    writeHeader(c);
                    writeContributions(c);
                    string hdrGift = "   Date        Fund Name          Description of Gift-in-Kind Given as of {0:d}\n\n".Fmt(td);
                    rWrite(hdrGift);
                    writeSummary(c);
                    runningtotals.Processed += 1;
                    Db.SubmitChanges();
                }
                textStream.Close();
                runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.Completed = DateTime.Now;
                Db.SubmitChanges();
            }
        }
Exemplo n.º 4
0
        public void DoWork()
        {
            Db                = new CMSDataContext(Util.GetConnectionString(Host));
            Db.Host           = Host;
            Db.CommandTimeout = 1200;

            var noaddressok = Db.Setting("RequireAddressOnStatement", "true") == "false";

            showCheckNo = Db.Setting("RequireCheckNoOnStatement", "false").ToLower() == "true";
            showNotes   = Db.Setting("RequireNotesOnStatement", "false").ToLower() == "true";

            var qc            = APIContribution.contributors(Db, fd, td, 0, 0, 0, noaddressok, useMinAmt: true, startswith: StartsWith, sort: Sort, tagid: TagId);
            var runningtotals = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();

            runningtotals.Count = qc.Count();
            Db.SubmitChanges();
            if (PDF)
            {
                if (showCheckNo || showNotes)
                {
                    var c = new ContributionStatementsExtra
                    {
                        FromDate    = fd,
                        ToDate      = td,
                        typ         = 3,
                        ShowCheckNo = showCheckNo,
                        ShowNotes   = showNotes
                    };
                    using (var stream = new FileStream(OutputFile, FileMode.Create))
                        c.Run(stream, Db, qc);
                    LastSet = c.LastSet();
                    var sets = c.Sets();
                    foreach (var set in sets)
                    {
                        using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                            c.Run(stream, Db, qc, set);
                    }
                    runningtotals           = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                    runningtotals.LastSet   = LastSet;
                    runningtotals.Sets      = string.Join(",", sets);
                    runningtotals.Completed = DateTime.Now;
                    Db.SubmitChanges();
                }
                else
                {
                    var c = new ContributionStatements
                    {
                        FromDate = fd,
                        ToDate   = td,
                        typ      = 3
                    };
                    using (var stream = new FileStream(OutputFile, FileMode.Create))
                        c.Run(stream, Db, qc);
                    LastSet = c.LastSet();
                    var sets = c.Sets();
                    foreach (var set in sets)
                    {
                        using (var stream = new FileStream(Output(OutputFile, set), FileMode.Create))
                            c.Run(stream, Db, qc, set);
                    }
                    runningtotals           = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                    runningtotals.LastSet   = LastSet;
                    runningtotals.Sets      = string.Join(",", sets);
                    runningtotals.Completed = DateTime.Now;
                    Db.SubmitChanges();
                }
            }
            else
            {
                textStream = new StreamWriter(OutputFile);
                foreach (var c in qc)
                {
                    pageStatement = 1;
                    writeHeader(c);
                    writeContributions(c);
                    string hdrGift = "   Date        Fund Name          Description of Gift-in-Kind Given as of {0:d}\n\n".Fmt(td);
                    rWrite(hdrGift);
                    writeSummary(c);
                    runningtotals.Processed += 1;
                    Db.SubmitChanges();
                }
                textStream.Close();
                runningtotals           = Db.ContributionsRuns.OrderByDescending(mm => mm.Id).First();
                runningtotals.Completed = DateTime.Now;
                Db.SubmitChanges();
            }
        }