示例#1
0
 public static void AddNewFriends(List <int> newfriends, string owner)
 {
     foreach (int friend in newfriends)
     {
         MySqlQuery.InsertNewUsers(owner, friend.ToString());
     }
 }
示例#2
0
        public static List <int> CheckCurrentFriends(List <int> friendsId)
        {
            DataTable  friendsCount;
            int        countFriends;
            List <int> currentFriendsList     = new List <int>();
            List <int> diffrerenceFriendsList = new List <int>();

            friendsCount = MySqlQuery.ReturnIdFriendsCount();
            countFriends = friendsCount.Rows[0].Field <int>("count(FriendID)");
            DataTable currentFriendsTable = MySqlQuery.ReturnIdFriends();

            for (int i = 0; i <= countFriends; i++)
            {
                currentFriendsList[i] = currentFriendsTable.Rows[i].Field <int>("FriendID");
            }
            diffrerenceFriendsList = friendsId.Except(currentFriendsList).ToList();

            return(diffrerenceFriendsList);
        }
示例#3
0
        public static void UpdateAllFriends(string currentOwnerId)
        {
            UserUpdater.AddNewFriends(UserUpdater.CheckCurrentFriends(UserUpdater.ReturnFriendsList(currentOwnerId)), currentOwnerId);
            List <int>       friendsId = Parser.ParseFriendsId(ApiVkRequests.GetUserFriends(currentOwnerId));
            List <PostModel> postsList = new List <PostModel>();

            foreach (int friend in friendsId)
            {
                MySqlQuery.DeleteFriendPosts(friend.ToString());

                List <int> postsId = Parser.GetUserPosts(ApiVkRequests.GetUserPosts(friend));


                for (int j = 0; j < postsId.Count; j++)
                {
                    PostModel postModel = new PostModel();
                    postModel.userId = friend;
                    postModel.id     = postsId[j];
                    postModel.Date   = Parser.GetDate(ApiVkRequests.GetUserPosts(friend), postsId[j]);
                    postsList.Add(postModel);
                }
                MySqlQuery.insertNewPosts(postsList, friend.ToString());
            }
        }
示例#4
0
 public static void InsertFriends(List <UserModel> friends)
 {
     MySqlQuery.insertFriends(friends);
 }
示例#5
0
 public static void InsertMainUser(UserModel user)
 {
     MySqlQuery.insertMainUser(user);
 }