Ejemplo n.º 1
0
        public LibraryForm()
        {
            InitializeComponent();
            this.WindowState = FormWindowState.Maximized;
            mainPanel.Dock = DockStyle.Fill;

            RepositoryFactory bookRepoFactory = new RepositoryFactory();
            _bookService = new BookService(bookRepoFactory);
            _bookService.Updated += showBookBtn_Click;

            RepositoryFactory authorRepoFactory = new RepositoryFactory();
            _authorService = new AuthorService(authorRepoFactory);
            _authorService.Updated += allAuthorsBtn_Click;

            RepositoryFactory memberRepoFactory = new RepositoryFactory();
            _memberService = new MemberService(memberRepoFactory);
            _memberService.Updated += allMemberBtn_Click;

            RepositoryFactory loanRepoFactory = new RepositoryFactory();
            _loanService = new LoanService(loanRepoFactory);
            _loanService.Updated += memberLoanBtn_Click;

            RepositoryFactory bookCopyRepoFactory = new RepositoryFactory();
            _bookCopyService = new BookCopyService(bookCopyRepoFactory);
            _bookCopyService.Updated += showBookBtn_Click;

            CreateLibrary();
        }
Ejemplo n.º 2
0
        public LibraryForm()
        {
            InitializeComponent();

            // Start on "Books" tab
            tbc_Main.SelectedIndex = 0;

            // Init services
            RepositoryFactory repoFactory = new RepositoryFactory();

            _bookCopyService = new BookCopyService(repoFactory);
            _bookService = new BookService(repoFactory);
            _authorService = new AuthorService(repoFactory);
            _memberService = new MemberService(repoFactory);
            _loanService = new LoanService(repoFactory);

            // Subscribe to events
            _bookService.Updated += _bookService_Updated;
            _bookCopyService.Updated += _bookService_Updated;
            _memberService.Updated += _memberService_Updated;
            _loanService.Updated += _bookService_Updated;
            _loanService.Updated += _memberService_Updated;
            _loanService.Updated += _loanService_Updated;

            // Fill the three main gridviews on startup
            UpdateMembers(_memberService.All());
            UpdateLoans(_loanService.Search(null, false));
            UpdateBooks(_bookService.All());
        }
Ejemplo n.º 3
0
        public NewBookForm(BookService bookService, AuthorService authorService)
        {
            InitializeComponent();

            _authorService = authorService;
            _bookService = bookService;

            // Keep combobox updated
            _authorService.Updated += _authorService_Updated;
            _authorService_Updated(this, new EventArgs());

            for (int i = 1; i < 11; i++)
            {
                cbx_NoOfCopies.Items.Add(i);
            }

            cbx_NoOfCopies.SelectedIndex = 0;
        }