Esempio n. 1
0
        public static void initFriends()
        {
            FriendCandidate ganesh = new FriendCandidate();

            ganesh.Name           = "Ganesh";
            ganesh.GrabScore      = 400;
            ganesh.TraditionScore = 400;
            ganesh.SetApprovedProp(true);
            ganesh.UID = "UID_ganesh";

            FriendCandidate abdul = new FriendCandidate();

            abdul.Name           = "abdul";
            abdul.GrabScore      = 100;
            abdul.TraditionScore = 100;
            abdul.SetApprovedProp(true);
            abdul.UID = "UID_abdul";

            if (!friend.ContainsKey(ganesh.UID))
            {
                friend.Add(ganesh.UID, ganesh);
            }

            if (!friend.ContainsKey(abdul.UID))
            {
                friend.Add(abdul.UID, abdul);
            }
        }
        public SocialFriendCreditScore Calculate(SocialScoreComputerInpute input)
        {
            //TotalPersonCount = 1000;
            SocialFriendCreditScore socialFriend = new SocialFriendCreditScore();
            int    totalCount = 100;
            double score      = 0;

            foreach (var f in input.FriendUids)
            {
                FriendCandidate candidate = SmsAnalyzeService.service.RepositoryService.GetFriend(f);
                if (candidate != null)
                {
                    score = score + (candidate.TraditionScore);
                }
                else
                {
                    totalCount--;
                }
            }
            socialFriend.updateScore(score / totalCount);
            return(socialFriend);
        }