Beispiel #1
0
 public void sendRequestToUser(int groupID, int userID, SocialNetwork socialNetwork)
 {
     if (socialNetwork.users[userID].myGroups.Contains(groupID))
     {
         Notify?.Invoke(this, "This user is already member of Group " + groupID);
     }
     else
     {
         socialNetwork.users[userID].getRequest(groupID, socialNetwork, this.userID);
         Notify?.Invoke(this, "The request was sent");
     }
 }
Beispiel #2
0
 public void sendRequest(int groupID, SocialNetwork socialNetwork)
 {
     if (myGroups.Contains(groupID))
     {
         Notify?.Invoke(this, "You are already member of this group");
     }
     if (groupID >= 0 && socialNetwork.groups.Count < groupID)
     {
         socialNetwork.groups[groupID].getRequest(userID, socialNetwork);
         Notify?.Invoke(this, "You have sent request to Group " + groupID);
     }
     else
     {
         Notify?.Invoke(this, "Wrong group ID");
     }
 }
Beispiel #3
0
 public void checkInvites(SocialNetwork socialNetwork)
 {
     Notify?.Invoke(this, "\nMy invites: ");
     if (myInvites.Count == 0)
     {
         Notify?.Invoke(this, "You have no invites");
     }
     else
     {
         for (int i = 0; i < myInvites.Count; i++)
         {
             Notify?.Invoke(this, "You was invited to Group " + myInvites[i] + ". Don't you want to join it?" +
                            "(write Yes or No)");
             while (true)
             {
                 string answer = Console.ReadLine();
                 if (answer.ToLower() == "yes")
                 {
                     socialNetwork.groups[myInvites[i]].members.Add(socialNetwork.users[userID]);
                     myGroups.Add(myInvites[i]);
                     myInvites.Remove(myInvites[i]);
                     i--;
                     Notify?.Invoke(this, $"You joined to Group !");
                     break;
                 }
                 else if (answer.ToLower() == "no")
                 {
                     myInvites.RemoveAt(i);
                     i--;
                     break;
                 }
                 else
                 {
                     Notify?.Invoke(this, "Wrong format, try again");
                 }
             }
         }
     }
 }
Beispiel #4
0
 public void getRequest(int id, SocialNetwork socialNetwork)
 {
     groupRequests.Add(socialNetwork.users[id]);
 }
Beispiel #5
0
 private void getRequest(int groupID, SocialNetwork socialNetwork, int invitorID)
 {
     myNews.Add(socialNetwork.users[invitorID].surname +
                " is inviting you to Group " + groupID);
     myInvites.Add(groupID);
 }
Beispiel #6
0
 public void createGroup(SocialNetwork socialNetwork)
 {
     socialNetwork.createGroup(userID);
     myGroups.Add(socialNetwork.groups.Count - 1);
 }