Пример #1
0
        public void Add(Attendee att)
        {
            bool found = false;
            for (int i = 0; i < a.Count; i++)
            {
                if (((Attendee)a[i]).Name.ToLower() == att.Name.ToLower())
                {
                    found = true;
                    a[i] = att;
                }
            }

            if (!found)
            {
                a.Add(att);
            }
        }
Пример #2
0
 public double GetPercentage(Attendee att)
 {
     // This would make more sense to have in the Attendee class, but each record has no clean way of knowing totalMinutes.
     return ((double)att.NumMinutes / (double)totalMinutes);
 }
Пример #3
0
        private void AddOrUpdateListItem(Attendee att)
        {
            ListViewItem item;
            for (int i = 0; i < lvAttendance.Items.Count; i++)
            {
                item = lvAttendance.Items[i];
                if (item.Text == att.Name)
                {
                    item.SubItems[1].Text = att.NumMinutes.ToString();
                    item.ImageIndex = att.ImageIndex;
                    lvAttendance.Items[i] = item;
                    return;
                }
            }

            item = new ListViewItem(att.Name);
            item.SubItems.Add(att.NumMinutes.ToString());
            item.ImageIndex = att.ImageIndex;
            lvAttendance.Items.Add(item);
            return;
        }