示例#1
0
        //GetInterestForCampaign
        public async Task <IList <InterestInfo> > GetInterestForCampaign(int SiteID)
        {
            NL_Provider provider = new NL_Provider();
            DataSet     ds       = await provider.GetInterestForCampaign(SiteID);

            List <InterestInfo>      finalList = new List <InterestInfo>();
            IList <InterestTempInfo> infos     = new List <InterestTempInfo>();

            if (ds.Tables.Count > 0)
            {
                infos = DataSourceHelper.FillCollection <InterestTempInfo>(ds.Tables[0]);

                List <string> appNames = infos.Select(x => x.AppName).Distinct().ToList();

                foreach (string appName in appNames)
                {
                    List <InterestTempInfo> tempInfos  = infos.ToList <InterestTempInfo>().FindAll(x => x.AppName == appName);
                    List <string>           categories = tempInfos.Select(x => x.CategoryName).Distinct().ToList();
                    foreach (string category in categories)
                    {
                        List <InterestTempInfo> tempCatInfos = tempInfos.FindAll(x => x.CategoryName == category);
                        List <string>           keywords     = tempCatInfos.Select(x => x.KeyWord).ToList();
                        InterestInfo            objInfo      = new InterestInfo();
                        objInfo.AppName      = appName;
                        objInfo.CategoryName = category;
                        objInfo.KeyWordList  = keywords;
                        finalList.Add(objInfo);
                    }
                }
            }
            return(finalList);
        }
示例#2
0
        public async Task <IList <InterestInfo> > GetInterest(int SiteID)
        {
            NL_Provider provider = new NL_Provider();
            DataSet     ds       = await provider.GetCustomerInterest(SiteID);

            List <InterestInfo> finalList = new List <InterestInfo>();

            for (int i = 0; i < ds.Tables.Count; i++)
            {
                IList <InterestTempInfo> infos = DataSourceHelper.FillCollection <InterestTempInfo>(ds.Tables[i]);

                InterestInfo info = new InterestInfo
                {
                    AppName      = infos[0].AppName,
                    CategoryName = infos[0].CategoryName
                };

                List <string> lstKeyword = infos.Select(x => x.KeyWord).Distinct().ToList();
                info.KeyWordList = lstKeyword;

                finalList.Add(info);
            }
            return(finalList);
        }