Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public static List <Member> GetAllMembers()
 {
     Console.WriteLine("Fetching members");
     return(MemberRepo.GetAllMembers());
 }