Exemplo n.º 1
0
        public List <GroupScoreRank> getGroupScoreRank(DateTime fromDate, DateTime toDate)
        {
            var result           = new List <GroupScoreRank>();
            var metaDataService  = new MetadataService();
            var groupMap         = getGroupAndUserMap();
            var eightDayMetaData = metaDataService.GetAllMetaData(fromDate, toDate);

            metaDataService.dealRewardMetadata(eightDayMetaData);
            foreach (var metaData in eightDayMetaData)
            {
                if (!groupMap.ContainsKey(metaData.WechatId))
                {
                    continue;
                }
                var groupInfo   = new GroupScoreRank();
                var currentDate = result.Find(g => g.ScoreData == metaData.CreatedDate && g.GroupName == (groupMap.ContainsKey(metaData.WechatId) ? groupMap[metaData.WechatId] : "Other"));
                if (currentDate != null)
                {
                    currentDate.Score += metaData.Score;
                }
                else
                {
                    groupInfo.GroupName = groupMap.ContainsKey(metaData.WechatId) ? groupMap[metaData.WechatId] : "Other";
                    groupInfo.Score     = metaData.Score;
                    groupInfo.ScoreData = metaData.CreatedDate;
                    result.Add(groupInfo);
                }
            }
            return(DealSumScore(result, fromDate));
        }
Exemplo n.º 2
0
 private string createInsertGroupRankStr(GroupScoreRank group)
 {
     return(string.Format("INSERT INTO Innocellence_GSK_WeChat_HM_GroupScoreRank values ('{0}',N'{1}','{2}','{3}','{4}','{5}') ", null, group.GroupName, group.Rank, group.Score, group.ScoreData, group.TotalScore));
 }