コード例 #1
0
        public void addFacebookStats(FacebookStats fbstats)
        {
            using (NHibernate.ISession session = SessionFactory.GetNewSession())
            {
                using (NHibernate.ITransaction transaction = session.BeginTransaction())
                {
                    session.Save(fbstats);
                    transaction.Commit();

                }
            }
        }
コード例 #2
0
        public void getfbFriendsGenderStatsForFanPage(dynamic profile, Guid userId, ref FacebookAccount objfbacnt)
        {
            FacebookStats objfbStats = new FacebookStats();
            FacebookStatsRepository objFBStatsRepo = new FacebookStatsRepository();
            //int malecount = 0;
            //int femalecount = 0;
            //foreach (var item in data["data"])
            //{
            //    if (item["gender"] == "male")
            //        malecount++;
            //    else if (item["gender"] == "female")
            //        femalecount++;
            //}
            objfbStats.EntryDate = DateTime.Now;
            objfbStats.FbUserId = profile["id"].ToString();
            //objfbStats.FemaleCount = femalecount;
            objfbStats.Id = Guid.NewGuid();
            //objfbStats.MaleCount = malecount;
            objfbStats.UserId = userId;
            objfbStats.FanCount = objfbacnt.Friends;
            //objfbStats.ShareCount = getShareCount();
            //objfbStats.CommentCount = getCommentCount();
            //objfbStats.LikeCount = getLikeCount();
            objFBStatsRepo.addFacebookStats(objfbStats);
            FacebookInsightStatsHelper objfbinshlpr = new FacebookInsightStatsHelper();
            string pId = profile["id"].ToString();
            //string pId = "329139457226886";
            objfbinshlpr.getPageImpresion(pId, userId, 7);

        }
コード例 #3
0
        public void getfbFriendsGenderStats(dynamic data, dynamic profile, Guid userId)
        {
            FacebookStats objfbStats = new FacebookStats();
            FacebookStatsRepository objFBStatsRepo = new FacebookStatsRepository();
            int malecount = 0;
            int femalecount = 0;
            foreach (var item in data["data"])
            {
                if (item["gender"] == "male")
                    malecount++;
                else if (item["gender"] == "female")
                    femalecount++;
            }
            objfbStats.EntryDate = DateTime.Now;
            objfbStats.FbUserId = profile["id"].ToString();
            objfbStats.FemaleCount = femalecount;
            objfbStats.Id = Guid.NewGuid();
            objfbStats.MaleCount = malecount;
            objfbStats.UserId = userId;
            objfbStats.FanCount = getfanCount(ref objfbStats);
            objFBStatsRepo.addFacebookStats(objfbStats);

        }
コード例 #4
0
        public int getfanCount(ref FacebookStats objfbsts)
        {
            int friendscnt = 0;
            long friendscount = 0;
            try
            {

                FacebookClient fb = new FacebookClient();

                string accessToken = HttpContext.Current.Session["accesstoken"].ToString();

                fb.AccessToken = accessToken;


                var client = new FacebookClient();

                dynamic me = fb.Get("me");


                dynamic friedscount = fb.Get("fql", new { q = "SELECT friend_count FROM user WHERE uid=me()" });

                foreach (var friend in friedscount.data)
                {
                    friendscount = friend.friend_count;
                }

                friendscnt = Convert.ToInt32(friendscount);


            }
            catch (Exception ex)
            {
                //logger.Error(ex.StackTrace);
                //Console.WriteLine(ex.StackTrace);

            }
            return friendscnt;
        }
コード例 #5
0
 public void updateFacebookStats(FacebookStats fbaccount)
 {
     throw new NotImplementedException();
 }