Beispiel #1
0
        public IEnumerable <PledgeGift> FetchPledgeData(ExcelWorksheet ws)
        {
            FetchHeaderColumns(ws);
            const string sheet = "Pledges";

            CheckColumn("IndividualId", sheet);
            CheckColumn("PledgeAmount", sheet);
            CheckColumn("PledgeDate", sheet);
            CheckColumn("FundId", sheet);
            CheckColumn("FundName", sheet);
            CheckColumn("FundDescription", sheet);

            var r = 2;

            while (r <= ws.Dimension.End.Row)
            {
                var row = new PledgeGift
                {
                    IndividualId    = ws.Cells[r, Names["IndividualId"]].Value,
                    Amount          = GetDecimal(ws.Cells[r, Names["PledgeAmount"]].Value),
                    Date            = GetDate(ws.Cells[r, Names["PledgeDate"]].Value) ?? DateTime.MinValue,
                    FundId          = GetInt(ws.Cells[r, Names["FundId"]].Value) ?? 0,
                    FundName        = GetString(ws.Cells[r, Names["FundName"]].Value),
                    FundDescription = GetString(ws.Cells[r, Names["FundDescription"]].Value)
                };
                r++;
                yield return(row);
            }
        }
Beispiel #2
0
        public IEnumerable <PledgeGift> FetchContributionData(ExcelWorksheet ws)
        {
            FetchHeaderColumns(ws);
            const string sheet = "Gift Data";

            CheckColumn("IndividualId", sheet);
            CheckColumn("Amount", sheet);
            CheckColumn("Date", sheet);
            CheckColumn("FundId", sheet);
            CheckColumn("FundName", sheet);
            CheckColumn("FundDescription", sheet);
            var r = 2;

            while (r <= ws.Dimension.End.Row)
            {
                var row = new PledgeGift()
                {
                    IndividualId    = ws.Cells[r, Names["IndividualId"]].Value,
                    Amount          = GetDecimal(ws.Cells[r, Names["Amount"]].Value),
                    Date            = GetDate(ws.Cells[r, Names["Date"]].Value) ?? DateTime.MinValue,
                    FundId          = GetInt(ws.Cells[r, Names["FundId"]].Value) ?? 0,
                    FundDescription = GetString(ws.Cells[r, Names["FundDescription"]].Value),
                    FundName        = GetString(ws.Cells[r, Names["FundName"]].Value),
                };
                if (Names.ContainsKey("CheckNo"))
                {
                    row.CheckNo = GetString(ws.Cells[r, Names["CheckNo"]].Value);
                }

                r++;
                yield return(row);
            }
        }