示例#1
0
 internal override void Generate(int numberToGenerate)
 {
     Members membersDb = new Members();
     GenerateMultiple(numberToGenerate, () =>
                                            {
                                                var member = GenerateMember();
                                                membersDb.Insert(member);
                                            });
 }
        internal void Generate()
        {
            logAction("Generating donations...");
            //TODO: output percentage completion like the other generators

            // only want to generate donations for committed campaigns
            var committedCampaigns = campaigns.Where(c => c.IsCommitted).ToList();
            var members = new Members();
            var donations = new Donations();

            foreach (var campaign in committedCampaigns)
            {
                var membersForCampaign = members.GetByCampaignId(campaign.Id);

                foreach (var member in membersForCampaign)
                {
                    GenerateCampaignDonationsForMember(donations, campaign, member);
                }
            }

            logAction("Donations generated successfully");
        }