public bool SetData() { if (_firstIteration) { foreach (var institution in _institutionRepo.GetAllInstitutions()) { institutionComboBox.Items.Add(institution.Name); } _firstIteration = false; } if (_memberRepo.GetAllMembers().Count == 0) { MessageBox.Show("No student or professor has been added yet", "Member not exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); nameTextBox.Text = ""; surnameTextBox.Text = ""; dateOfBirthPicker.Value = DateTime.Now; institutionComboBox.Text = ""; isProfessorCheckBox.Checked = false; btnSave.Enabled = false; } if (_memberRepo.GetAllMembers().Count <= _index || _index < 0) { return(false); } nameTextBox.Text = _memberRepo.GetAllMembers()[_index].Person.Name; surnameTextBox.Text = _memberRepo.GetAllMembers()[_index].Person.Surname; dateOfBirthPicker.Value = _memberRepo.GetAllMembers()[_index].Person.DateOfBirth.Value; institutionComboBox.Text = _memberRepo.GetAllMembers()[_index].Institution.Name; isProfessorCheckBox.Checked = _memberRepo.GetAllMembers()[_index].Professor; return(true); }
public bool SetData() { if (_memberRepo.GetAllMembers().Count == 0) { MessageBox.Show("No student or professor has been added yet", "Member not exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); nameTextBox.Text = ""; surnameTextBox.Text = ""; dateOfBirthPicker.Value = DateTime.Now; institutionComboBox.Text = ""; btnDelete.Enabled = false; } if (_memberRepo.GetAllMembers().Count <= _index || _index < 0) { return(false); } nameTextBox.Text = _memberRepo.GetAllMembers()[_index].Person.Name; surnameTextBox.Text = _memberRepo.GetAllMembers()[_index].Person.Surname; dateOfBirthPicker.Value = _memberRepo.GetAllMembers()[_index].Person.DateOfBirth.Value; institutionComboBox.Text = _memberRepo.GetAllMembers()[_index].Institution.Name; return(true); }
public static List <Member> GetAllMembers() { Console.WriteLine("Fetching members"); return(MemberRepo.GetAllMembers()); }