Esempio n. 1
0
        //Add book
        private void btAddBook_Click(object sender, EventArgs e)
        {
            string   ISBN   = txtIsbn.Text;
            Book     bok1   = new Book();
            BookCopy kopia1 = new BookCopy();

            bok1.Description = txtDescription.Text;
            bok1.Title       = txtTitle.Text;
            int  isbn   = bok1.ISBN;
            bool isAInt = int.TryParse(ISBN, out isbn);

            bok1.Author = (Author)lbBooksByAuthor.SelectedItem;
            kopia1.Book = bok1;


            if (bok1.Author != null && txtDescription.Text != null && txtIsbn.Text != null && isAInt == true)
            {
                LibraryForm library = new LibraryForm();
                _bookService.Add(bok1);
                _bookCopyService.Add(kopia1);

                this.Close();
            }
            else
            {
                MessageBox.Show("You have to select an author and add description. ISBN have to be a number");
            }
        }
Esempio n. 2
0
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            ListView.SelectedListViewItemCollection items = listView1.SelectedItems;
            ListViewItem item = items[0];
            string       name = item.SubItems[2].Text;
            string       code = item.SubItems[4].Text;

            LibraryForm form = new LibraryForm(this, name, code);

            form.ShowDialog();
        }
        public MemberForm(LibraryForm libraryForm)
        {
            InitializeComponent();

            LibraryContext context = new LibraryContext();

            RepositoryFactory repFactory = new RepositoryFactory(context);

            this.memberService = new MemberService(repFactory);
            this.libraryForm   = libraryForm;

            ShowAllMembers(memberService.All());

            memberService.Updated += MemberService_Updated;
        }
        public BookAndAuthorForm(LibraryForm libraryForm)
        {
            InitializeComponent();

            LibraryContext context = new LibraryContext();

            RepositoryFactory repFactory = new RepositoryFactory(context);


            this.bookService   = new BookService(repFactory);
            this.authorService = new AuthorService(repFactory);
            this.libraryForm   = libraryForm;

            ShowAllAuthors(authorService.All());
            ShowAllBooks(bookService.All());

            authorService.Updated += Service_Updated;
            bookService.Updated   += Service_Updated;
        }
Esempio n. 5
0
        public LoanForm(LibraryForm libraryForm)
        {
            InitializeComponent();

            LibraryContext context = new LibraryContext();

            RepositoryFactory repFactory = new RepositoryFactory(context);

            this.bookService     = new BookService(repFactory);
            this.authorService   = new AuthorService(repFactory);
            this.memberService   = new MemberService(repFactory);
            this.bookCopyService = new BookCopyService(repFactory);
            this.loanService     = new LoanService(repFactory);
            this.libraryForm     = libraryForm;

            ShowAllBooks(bookService.All());
            ShowAllBookCopies(bookCopyService.AllAvailableCopies());
            ShowAllMembers(memberService.All());
            ShowAllAuthors(authorService.All());
            ShowAllLoans(loanService.AllCurrentLoans());
            ShowAllReturns(loanService.Returns());

            loanService.Updated += LoanService_Updated;
        }
Esempio n. 6
0
 public AddBook(LibraryForm pForm, string code)
 {
     form = pForm;
     InitializeComponent();
     table_name = code;
 }