private void SignUpGroupForEvent(ListView.SelectedListViewItemCollection selectedItems, Dictionary <String, Event> events, SignUpGroupForm signUpGroup) { foreach (ListViewItem item in selectedItems) { string key = item.SubItems[0].Text; signUpGroup.SelectedEvent = events[key]; } }
private void btnSignUpGroup_Click(object sender, EventArgs e) { if (listInPersonEvents.SelectedItems.Count == 0 && listVirtualEvents.SelectedItems.Count == 0) { MessageBox.Show("Select which event you want the group to be signed up to."); return; } SignUpGroupForm signUpGroup = new SignUpGroupForm(); SignUpGroupForEvent(listInPersonEvents.SelectedItems, db.InPersonEvents, signUpGroup); SignUpGroupForEvent(listVirtualEvents.SelectedItems, db.VirtualEvents, signUpGroup); signUpGroup.ShowDialog(); listUpcomingEventsRefresh(); }