示例#1
0
 private void btnUpdateFriends_Click(object sender, EventArgs e)
 {
     List<Friend> friendsToUpdate = new List<Friend>();
     foreach (DataRow row in tblgroupsVsUsers.Rows)
     {
         Friend friend = new Friend();
         friend.username = row["User Name"];
         friend.groupmask = 1;
         foreach (FriendGroup group in groups.Values)
         {
             if ((bool)row[group.name])
             {
                 friend.groupmask += group.BitmapID;
             }
         }
         friendsToUpdate.Add(friend);
     }
     MakeCall.EditFriends(friendsToUpdate.ToArray(), null);
 }
示例#2
0
 private ListViewItem UserDetails(Friend friend, SortedList<int, FriendGroup> groupList)
 {
     List<String> groups = Groups(groupList, friend);
     List<String> details = new List<string>();
     details.Add(friend.UserName ?? "Invalid User Name");
     details.Add(friend.type);
     details.Add(groups.Count.ToString());
     details.AddRange(groups);
     return new ListViewItem(details.ToArray());
 }
示例#3
0
 private List<string> Groups(SortedList<int, FriendGroup> groupList, Friend friend)
 {
     List<string> groups = new List<string>();
     if (friend.groupmask.HasValue)
     {
         BitArray group = new BitArray(new int[] { friend.groupmask.Value });
         //We skip group 0 - it's the default group for all people...
         for (int i = 1; i < group.Length; i++)
         {
             if (group[i])
             {
                 groups.Add(groupList[i].name);
             }
         }
     }
     return groups;
 }