Пример #1
0
        /// <summary>
        ///     Load all campaigns from the database.
        /// </summary>
        /// <returns></returns>
        private CampaignSet LoadCampaignSet()
        {
            var campaignSet = new CampaignSet();

            // Get the collection from the ORM data layer
            var metaData = new LinqMetaData();

            IQueryable <CampaignEntity> campaigns = from c in metaData.Campaign select c;

            var campaignCollection = ((ILLBLGenProQuery)campaigns).Execute <CampaignCollection>();

            // Fill the entity set from the data collection
            if (campaignCollection.Count > 0)
            {
                foreach (var campaignEntity in campaignCollection)
                {
                    var campaign = new Campaign(campaignEntity);
                    campaign.CampaignType   = ServiceManagerProvider.GetCampaignTypeManager().GetCampaignType(campaign.CampaignTypeId);
                    campaign.RedemptionCode = ServiceManagerProvider.GetRedemptionCodeManager().GetRedemptionCode(campaign.RedemptionCodeId);

                    campaignSet.Add(campaign);
                }
            }

            // Return the entity set
            return(campaignSet);
        }