Exemple #1
0
        private void FillDetails()
        {
            dateOfBorrowDTP.Value = _bookBorrow.BorrowDate;
            if (_bookBorrow.ReturnDate != null)
            {
                dateOfReturnDTP.Value = _bookBorrow.ReturnDate.Value;
            }

            allStudentsListBox.Items.Clear();
            allStudentsListBox.Items.Add($"{_bookBorrow.Student.StudentId}. {_bookBorrow.Student.FirstName} {_bookBorrow.Student.LastName}");
            allStudentsListBox.SetSelected(0, true);
            foreach (var student in _bookBorrowsRepository.GetAllStudentsWhoCanBorrow())
            {
                if (student.StudentId != _bookBorrow.StudentId)
                {
                    allStudentsListBox.Items.Add($"{student.StudentId}. {student.FirstName} {student.LastName}");
                }
            }

            allBooksListBox.Items.Clear();

            allBooksListBox.DataSource    = _bookBorrowsRepository.GetAllBooksForBorrow();
            allBooksListBox.DisplayMember = "Name";
            allBooksListBox.ValueMember   = "BookId";
            allBooksListBox.SelectedItem  = _bookBorrow.Book;
        }
Exemple #2
0
        private void FillDetails()
        {
            allStudentsListBox.Items.Clear();

            foreach (var student in _bookBorrowsRepository.GetAllStudentsWhoCanBorrow())
            {
                allStudentsListBox.Items.Add($"{student.StudentId}. {student.FirstName} {student.LastName}");
            }

            allBooksListBox.Items.Clear();

            allBooksListBox.DataSource    = _bookBorrowsRepository.GetAllBooksForBorrow();
            allBooksListBox.DisplayMember = "Name";
            allBooksListBox.ValueMember   = "BookId";
        }