/// <summary> /// загрузка данных студента в текстбоксы и комбобоксы /// </summary> /// <param name="student">текущий студент</param> public void ChangeBoxes(Student student) { _student = student; SurnameTextBox.Text = _student.Surname; NameTextBox.Text = _student.Name; MiddlenameTextBox.Text = _student.MiddleName; CityTextBox.Text = _student.City; AddressTextBox.Text = _student.Street; TelefonTextBox.Text = _student.TelefonNumber; EmailTextBox.Text = _student.Email; FacultyComboBox.ValueMember = nameof(Faculty.ID); FacultyComboBox.SelectedValue = _student.FacultyID; SpecialityComboBox.ValueMember = nameof(Speciality.ID); SpecialityComboBox.SelectedValue = _student.SpecialityID; CourceComboBox.ValueMember = nameof(Cource.ID); CourceComboBox.SelectedValue = _student.CourceID; GroupComboBox.ValueMember = nameof(Group.ID); GroupComboBox.SelectedValue = _student.GroupID; if (_student.Photo) { _manager.LoadFoto(_student, PhotoPictureBox); PhotoPictureBox.Name = _student.Guid.ToString(); } else { _manager.LoadDefaultPhoto(PhotoPictureBox); } }
/// <summary> /// Изменение данных в текстбоксах и pictureBox /// </summary> /// <param name="currentStudent"></param> private void ChangeStudentInfo(Student currentStudent) { SurnameTextBox.Text = currentStudent.Surname; NameTextBox.Text = currentStudent.Name; MiddlenameTextBox.Text = currentStudent.MiddleName; CityTextBox.Text = currentStudent.City; AddressTextBox.Text = currentStudent.Street; TelefonTextBox.Text = currentStudent.TelefonNumber; EmailTextBox.Text = currentStudent.Email; //если фото выбрано загружается фото if (currentStudent.Photo) { _manager.LoadFoto(currentStudent, PhotoPictureBox); } //если фото не выбрано загружается дефолтная картинка else { _manager.LoadDefaultPhoto(PhotoPictureBox); } }