private void btn_exist_Click(object sender, EventArgs e) { if (lv_students.SelectedIndices.Count == 0) { MessageBox.Show("Оберіть студента для фіксації відвідуваності!"); return; } Student student = _students[lv_students.SelectedIndices[0]]; StudingTheSubject pairStudent = null; foreach (var pair in _currentPair) { if (pair.GroupId == student.GroupId) { pairStudent = pair; break; } } try { _proxy.AttendStudent(student, true, pairStudent); } catch (Exception ex) { MessageBox.Show(ex.Message); } LoadStudents(); }