Exemple #1
0
        /// <summary>
        /// Gets the current master offer data from WinOasis
        /// </summary>
        /// <returns></returns>
        private List <MasterOffers> GetWinOasisMasterOffers()
        {
            WinOasisDAL         winOasisDAL  = new WinOasisDAL();
            List <MasterOffers> masterOffers = winOasisDAL.GetMasterOffers();

            return(masterOffers);
        }
Exemple #2
0
        /// <summary>
        /// Helper method. Takes 2 lists; MasterOffer and Offer and builds the PlayerSegment entity
        /// </summary>
        /// <param name="offers"></param>
        /// <param name="masterOffers"></param>
        /// <returns>A list of PlayerSegments</returns>
        private List <PlayerSegments> BuildPlayerSegmentFile(List <Offer> offers, List <MasterOffers> masterOffers)
        {
            // initialize 3 PlayerOfferMap. Each map will contain players associated with specific type of offers
            List <PlayerOfferMap> playerPromoOffers    = new List <PlayerOfferMap>();
            List <PlayerOfferMap> playerCampaignOffers = new List <PlayerOfferMap>();
            List <PlayerOfferMap> playerEventOffers    = new List <PlayerOfferMap>();
            List <PlayerOfferMap> AllOffersPlayers     = new List <PlayerOfferMap>();

            // populate the 3 lists from the DB.
            WinOasisDAL dal = new WinOasisDAL();

            playerPromoOffers    = dal.GetPlayersPromoOffers(offers);
            playerCampaignOffers = dal.GetPlayersCampaignOffers(masterOffers);
            playerEventOffers    = dal.GetPlayersEventOffers(masterOffers);

            // Combine the 3 lists into 1 for easier processing
            AllOffersPlayers.AddRange(playerPromoOffers);
            AllOffersPlayers.AddRange(playerCampaignOffers);
            AllOffersPlayers.AddRange(playerEventOffers);

            // update the segment name in AllOffersPlayers from the original offers list
            List <PlayerOfferMap> result = AllOffersPlayers.Join(offers, d => d.OfferID, s => s.OfferId, (d, s) =>
            {
                d.SegmentName = s.OfferName;
                return(d);
            }).ToList();

            // create a PlayerSegment list from the playerOfferMap list and return it
            List <PlayerSegments> playerSegmentList = result.Select(x => new PlayerSegments
            {
                SegmentName = x.SegmentName,
                PlayerID    = x.PlayerID,
            }).ToList();

            return(playerSegmentList);
        }