NewBundleDetail() static private method

static private NewBundleDetail ( System.DateTime date, int fundid, string amount ) : CmsData.BundleDetail
date System.DateTime
fundid int
amount string
return CmsData.BundleDetail
示例#1
0
        private static int?Import(CsvReader csv, DateTime date, int?fundid)
        {
            BundleHeader bundleHeader = null;
            var          fid          = fundid ?? BatchImportContributions.FirstFundId();

            var details = new List <BundleDetail>();

            while (csv.ReadNextRecord())
            {
                var batchDate = csv[2].ToDate();
                var amount    = csv[5];

                var paymentMethod = csv[7];
                var payerName     = csv[8];

                if (bundleHeader == null)
                {
                    bundleHeader = BatchImportContributions.GetBundleHeader(batchDate.Value, DateTime.Now);
                }

                var bd = BatchImportContributions.NewBundleDetail(date, fid, amount);

                var eac = Util.Encrypt(paymentMethod);
                var q   = from kc in DbUtil.Db.CardIdentifiers
                          where kc.Id == eac
                          select kc.PeopleId;

                var pid = q.SingleOrDefault();
                if (pid != null)
                {
                    bd.Contribution.PeopleId = pid;
                }

                bd.Contribution.BankAccount      = paymentMethod;
                bd.Contribution.ContributionDesc = payerName;

                details.Add(bd);
            }

            details.Reverse();
            foreach (var bd in details)
            {
                bundleHeader.BundleDetails.Add(bd);
            }

            BatchImportContributions.FinishBundle(bundleHeader);

            return(bundleHeader.BundleHeaderId);
        }