private void BooksListBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     for (var ix = 0; ix < BooksListBox.Items.Count; ++ix)
     {
         if (ix != e.Index)
         {
             BooksListBox.SetItemChecked(ix, false);
         }
     }
     RefreshDateOfBorrowTextBox();
 }
Example #2
0
 private void BooksListBox_ItemCheck(object sender, ItemCheckEventArgs e)
 {
     if (e.NewValue == CheckState.Checked)
     {
         for (var index = 0; index < BooksListBox.Items.Count; ++index)
         {
             if (e.Index != index)
             {
                 BooksListBox.SetItemChecked(index, false);
             }
         }
     }
 }
Example #3
0
        private void SelectedBook(object sender, EventArgs e)
        {
            if (BooksListBox.SelectedItem == null)
            {
                return;
            }
            var selection = (Book)BooksListBox.SelectedItem;

            if (selection.Loans.Count(loan => loan.IsLoanActive()) < selection.NumberOfCopies)
            {
                return;
            }
            MessageBox.Show(@"All Copies Of The Book Are Loaned", @"No Copy Available", MessageBoxButtons.OK, MessageBoxIcon.Error);
            BooksListBox.ClearSelected();
        }