Exemple #1
0
        void RemoveDebaterFromRounds(TreeIter storeIter)
        {
            EditableDebater d = (EditableDebater)store.GetValue(storeIter, 0);

            // removing a judge from existing rounds is easy
            // but everything else is not (consider non-complete teams...)
            // so, we rely on the issued warning and hope the user knows
            // what to do
            if (!d.Role.IsJudge)
            {
                return;
            }

            foreach (RoundData round in Tournament.I.Rounds)
            {
                RoundDebater rd = round.AllJudges.Find(delegate(RoundDebater obj) {
                    return(obj.Equals(d));
                });
                // if not found, continue!
                if (rd == null)
                {
                    continue;
                }
                // d is Judge, so check Chair and Judges in rooms
                foreach (RoomData room in round.Rooms)
                {
                    if (rd.Equals(room.Chair))
                    {
                        room.Chair = null;
                    }
                    else
                    {
                        // if judge isn't there, can't be removed...
                        room.Judges.Remove(rd);
                    }
                }
                // remove from all judges
                round.AllJudges.Remove(rd);
            }
        }