private string CheckStatus(Meeting m1) { List <Participant> RequestedPs = m1.GetRequestedPs(); List <bool> allpending = new List <bool>(); foreach (Participant p in RequestedPs) { List <Meeting> Pending = p.GetPending(); if (Pending.Contains(m1)) { allpending.Add(true); } else { allpending.Add(false); } } if (!allpending.Contains(false)) { return("All Accepted"); } else if (User.GetPending().Contains(m1)) { return("Awaiting Other Participants"); } else { return("Pending"); } }
public participantDisplay(List <Participant> allUsers, List <Meeting> MeetingAll, List <Participant> MeetingAttendees, Participant user) { User = user; allMeetings = m.returnAllList(); InvitedMeeting = User.GetInvites(); ScheduledMeeting = User.GetSchedule(); pendingMeet = User.GetPending(); InitializeComponent(); InitializeMeetings(); UpdateScheduleTable(); }
public void InitializeMeetings() { UpdateLists(); //disable Accept buttons button1.Enabled = false; button3.Enabled = false; button5.Enabled = false; button7.Enabled = false; button9.Enabled = false; //disable decline buttons button2.Enabled = false; button4.Enabled = false; button6.Enabled = false; button8.Enabled = false; button10.Enabled = false; label52.Text = User.GetName(); label14.Text = User.GetPsType(); Meeting m1 = new Meeting(); Participant p = new Participant(); for (int i = 0; i <= this.tableLayoutPanel2.ColumnCount; i++) { for (int j = 0; j <= this.tableLayoutPanel2.RowCount; j++) { Control c = this.tableLayoutPanel2.GetControlFromPosition(i, j); //ROW ONE if (i < 4 && j == 0) { if (0 < InvitedMeeting.Count) { button1.Enabled = true; button2.Enabled = true; if (InvitedMeeting[0] != null) { m1 = InvitedMeeting[0]; if (i == 0) { c.Text = m1.GetInitiator(); } if (i == 1) { c.Text = m1.GetTitle(); } if (i == 2) { c.Text = CheckStatus(m1); } if (i == 3) { c.Text = m1.GetLocation(); } } } else { if (i == 0) { c.Text = "N/A"; } if (i == 1) { c.Text = "N/A"; } if (i == 2) { c.Text = "N/A"; } if (i == 3) { c.Text = "N/A"; } } } if (i == 4 && j == 0) { if (0 < InvitedMeeting.Count) { if (InvitedMeeting[0] != null) { m1 = InvitedMeeting[0]; for (int k = 0; k < m1.GetSlot().Count; k++) { listBox1.Items.Add(m1.GetSlot()[k]); } } } else { listBox1.Items.Clear(); } } if (i == 5 && j == 0) { if (0 < InvitedMeeting.Count) { List <string> p1 = new List <string>(); List <string> s1 = new List <string>(); p1 = User.GetPreferredSlots(); s1 = m1.GetSlot(); for (int k = 0; k < p1.Count; k++) { for (int t = 0; t < s1.Count; t++) { if (p1[k] == s1[t]) { listBox2.Items.Add(p1[k]); } } } } else { listBox2.Items.Clear(); } } //ROW 2 if (i < 4 && j == 1) { if (1 < InvitedMeeting.Count) { button3.Enabled = true; button4.Enabled = true; if (InvitedMeeting[1] != null) { m1 = InvitedMeeting[1]; if (i == 0) { c.Text = m1.GetInitiator(); } if (i == 1) { c.Text = m1.GetTitle(); } if (i == 2) { c.Text = m1.GetStatus().ToString(); } if (i == 3) { c.Text = m1.GetLocation(); } } } else { if (i == 0) { c.Text = "N/A"; } if (i == 1) { c.Text = "N/A"; } if (i == 2) { c.Text = "N/A"; } if (i == 3) { c.Text = "N/A"; } } } if (i == 4 && j == 1) { if (1 < InvitedMeeting.Count) { if (InvitedMeeting[1] != null) { m1 = InvitedMeeting[1]; for (int k = 0; k < m1.GetSlot().Count; k++) { listBox5.Items.Add(m1.GetSlot()[k]); } } } else { listBox5.Items.Clear(); } } if (i == 5 && j == 1) { if (1 < InvitedMeeting.Count) { List <string> p1 = new List <string>(); List <string> s1 = new List <string>(); p1 = User.GetPreferredSlots(); s1 = m1.GetSlot(); for (int k = 0; k < p1.Count; k++) { for (int t = 0; t < s1.Count; t++) { if (p1[k] == s1[t]) { listBox3.Items.Add(p1[k]); } } } } else { listBox3.Items.Clear(); } } //ROW 3 if (i < 4 && j == 2) { if (2 < InvitedMeeting.Count) { button5.Enabled = true; button6.Enabled = true; if (InvitedMeeting[2] != null) { m1 = InvitedMeeting[2]; if (i == 0) { c.Text = m1.GetInitiator(); } if (i == 1) { c.Text = m1.GetTitle(); } if (i == 2) { c.Text = m1.GetStatus().ToString(); } if (i == 3) { c.Text = m1.GetLocation(); } } } else { if (i == 0) { c.Text = "N/A"; } if (i == 1) { c.Text = "N/A"; } if (i == 2) { c.Text = "N/A"; } if (i == 3) { c.Text = "N/A"; } } } if (i == 4 && j == 2) { if (2 < InvitedMeeting.Count) { if (InvitedMeeting[2] != null) { m1 = InvitedMeeting[2]; for (int k = 0; k < m1.GetSlot().Count; k++) { listBox4.Items.Add(m1.GetSlot()[k]); } } } else { listBox4.Items.Clear(); } } if (i == 5 && j == 2) { if (2 < InvitedMeeting.Count) { List <string> p1 = new List <string>(); List <string> s1 = new List <string>(); p1 = User.GetPreferredSlots(); s1 = m1.GetSlot(); for (int k = 0; k < p1.Count; k++) { for (int t = 0; t < s1.Count; t++) { if (p1[k] == s1[t]) { listBox8.Items.Add(p1[k]); } } } } else { listBox8.Items.Clear(); } } //ROW 4 if (i < 4 && j == 3) { if (3 < InvitedMeeting.Count) { button7.Enabled = true; button8.Enabled = true; if (InvitedMeeting[3] != null) { m1 = InvitedMeeting[3]; if (i == 0) { c.Text = m1.GetInitiator(); } if (i == 1) { c.Text = m1.GetTitle(); } if (i == 2) { c.Text = m1.GetStatus().ToString(); } if (i == 3) { c.Text = m1.GetLocation(); } } } else { if (i == 0) { c.Text = "N/A"; } if (i == 1) { c.Text = "N/A"; } if (i == 2) { c.Text = "N/A"; } if (i == 3) { c.Text = "N/A"; } } } if (i == 4 && j == 3) { if (3 < InvitedMeeting.Count) { if (InvitedMeeting[3] != null) { m1 = InvitedMeeting[3]; for (int k = 0; k < m1.GetSlot().Count; k++) { listBox6.Items.Add(m1.GetSlot()[k]); } } } else { listBox6.Items.Clear(); } } if (i == 5 && j == 3) { if (3 < InvitedMeeting.Count) { List <string> p1 = new List <string>(); List <string> s1 = new List <string>(); p1 = User.GetPreferredSlots(); s1 = m1.GetSlot(); for (int k = 0; k < p1.Count; k++) { for (int t = 0; t < s1.Count; t++) { if (p1[k] == s1[t]) { listBox7.Items.Add(p1[k]); } } } } else { listBox7.Items.Clear(); } } //ROW 5 if (i < 4 && j == 4) { if (4 < InvitedMeeting.Count) { button9.Enabled = true; button10.Enabled = true; if (InvitedMeeting[4] != null) { m1 = InvitedMeeting[4]; if (i == 0) { c.Text = m1.GetInitiator(); } if (i == 1) { c.Text = m1.GetTitle(); } if (i == 2) { c.Text = m1.GetStatus().ToString(); } if (i == 3) { c.Text = m1.GetLocation(); } } } else { if (i == 0) { c.Text = "N/A"; } if (i == 1) { c.Text = "N/A"; } if (i == 2) { c.Text = "N/A"; } if (i == 3) { c.Text = "N/A"; } } } if (i == 4 && j == 4) { if (4 < InvitedMeeting.Count) { if (InvitedMeeting[4] != null) { m1 = InvitedMeeting[4]; for (int k = 0; k < m1.GetSlot().Count; k++) { listBox10.Items.Add(m1.GetSlot()[k]); } } } else { listBox10.Items.Clear(); } } if (i == 5 && j == 4) { if (4 < InvitedMeeting.Count) { List <string> p1 = new List <string>(); List <string> s1 = new List <string>(); p1 = User.GetPreferredSlots(); s1 = m1.GetSlot(); for (int k = 0; k < p1.Count; k++) { for (int t = 0; t < s1.Count; t++) { if (p1[k] == s1[t]) { listBox11.Items.Add(p1[k]); } } } } else { listBox11.Items.Clear(); } } } } listBox9.Items.Clear(); foreach (Meeting m in User.GetPending()) { listBox9.Items.Add(m.GetTitle() + ", " + m.GetStatus() + ", " + m.GetLocation()); } }