private LibraryClientController controller;  //Holds a reference to the controller for Library Client

        /// <summary>
        /// Constructor for LibrarianReport
        /// Initializes fields and populates the listBox with all MLibrarians in the collection
        /// </summary>
        /// <param name="controller"></param>
        public LibrarianReport(LibraryClientController controller)
        {
            InitializeComponent();

            this.controller = controller;
            LoadList();
        }
        }                                       //The Book that the window is currently displaying the contents of

        /// <summary>
        /// Constructor for BookDetailsWindow
        /// Initializes controls, fields and Properties depending on the contents of the Book
        /// and whether the user is a librarian or patron
        /// </summary>
        /// <param name="book">Book which details will be displayed</param>
        /// <param name="controller">Controller for the Library Client</param>
        /// <param name="isNewBook">If true, notifies the window that the Book object to be displayed
        /// is a new Book, or already exists in the database.</param>
        public BookDetails(Book book, LibraryClientController controller, bool isNewBook)
        {
            InitializeComponent();

            //Initialize fields and Properties
            this.controller     = controller;
            Book                = book;
            originalAuthor      = Book.Author;
            changedAuthor       = null;
            edited              = false;
            searchResultsWindow = null;
            this.isNewBook      = isNewBook;

            //Subscribe to OnDatabaseError vent
            this.controller.OnDatabaseError += OnDatabaseErrorHandler;

            //Initialize Controls
            InitializeButtons();

            ErrorLabel.Content = string.Empty;
            SetUserType();

            PopulateWindow();

            //If the user is a librarian and Book is new, automatically enable edit buttons
            if (controller.IsLibrarian && isNewBook)
            {
                EnableEditing();
            }
        }
        private LibraryClientController controller;  //Holds a reference to controller for Library Client

        /// <summary>
        /// Constructor for OverdueReport
        /// Initializes fields and Populates the list with overdue logs.
        /// </summary>
        /// <param name="controller"></param>
        public OverdueReport(LibraryClientController controller)
        {
            InitializeComponent();

            this.controller = controller;
            LoadOverdueList();
        }
        private LibraryClientController controller;  //holds a reference to the controller for Library Client

        /// <summary>
        /// Constructor for CardholdersReport.
        /// Initializes fields and loads the report into the CardholdersTreeView
        /// </summary>
        /// <param name="controller">controller for library client</param>
        public CardholdersReport(LibraryClientController controller)
        {
            InitializeComponent();

            this.controller = controller;
            LoadCardHoldersTree();
        }
Beispiel #5
0
        private LibraryClientController controller;  //Holds a reference to the controller of the library client

        /// <summary>
        /// Constructor for AuthorsReport
        /// Initializes fields and populate the AuthorsListView with all MAuthor objects in collection
        /// </summary>
        /// <param name="controller"></param>
        public AuthorsReport(LibraryClientController controller)
        {
            InitializeComponent();

            this.controller = controller;

            //Populate AuthorsTreeView
            LoadAuthorsList();
        }
        private LibraryClientController controller;  //Holds a reference to controller for Library Client

        /// <summary>
        /// Constructor for LogIn
        /// Initializes fields and preps window for user interaction
        /// </summary>
        /// <param name="controller">controller for Library Client</param>
        public LogIn(LibraryClientController controller)
        {
            InitializeComponent();

            //initialize field
            this.controller = controller;

            //prep controls
            ErrorLabel.Content   = string.Empty;
            UserNameTextBox.Text = string.Empty;

            UserNameTextBox.Focus();
        }
Beispiel #7
0
        private LibraryClientController controller;  //Holds a reference to the controller for Library Client

        /// <summary>
        /// Constructor for CheckInWindow
        /// Initializes fields and prepares the controls for user interaction
        /// </summary>
        /// <param name="controller">controller for library client</param>
        public CheckInWindow(LibraryClientController controller)
        {
            InitializeComponent();

            //intialize fields
            this.controller = controller;

            //subscribe to OnDatabaseError event
            this.controller.OnDatabaseError += OnDatabaseErrorHandler;

            //prep the controls for user interaction
            ResetSearchBar();
            CheckInButton.IsEnabled = false;
            ErrorLabel.Content      = string.Empty;
        }
Beispiel #8
0
        private LibraryClientController controller;  //Holds a reference to the controller for the Library Client

        /// <summary>
        /// Constructor for MainWindow
        /// Initializes fields and preps window for user interaction
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            //initialize fields
            controller = new LibraryClientController();  //create a new LibraryClientController

            //subscribe to OnDatabaseError event
            controller.OnDatabaseError += OnDatabaseErrorHandler;

            //Set the user type
            SetUserType();

            ErrorLabel.Content = string.Empty;
        }
Beispiel #9
0
        private ObservableCollection <Book> books;  //A list of books to check out

        /// <summary>
        /// Constructor for CheckOutWindow
        /// Initializes fields and preps the window for user interaction
        /// </summary>
        /// <param name="controller"></param>
        public CheckOutWindow(LibraryClientController controller)
        {
            InitializeComponent();

            //initialize fields
            this.controller = controller;
            cardHolder      = null;

            books = new ObservableCollection <Book>();
            BooksListView.ItemsSource = books;

            //subscribe to OnDatabaseError event
            this.controller.OnDatabaseError += OnDatabaseErrorHandler;

            //preps window for user interaction
            ResetWindow();
        }
        private MenuPhase phase;                    //the current phase of the window

        /// <summary>
        /// Constructor for LibrarianMenu.
        /// Initializes fields and preps the window for user interaction.
        /// </summary>
        /// <param name="controller">controller for library blient</param>
        /// <param name="mainWindow">reference to the MainWindow that opened this menu</param>
        public LibrarianMenu(LibraryClientController controller, MainWindow mainWindow)
        {
            InitializeComponent();

            //initialize fields
            this.controller    = controller;
            this.mainWindow    = mainWindow;
            phase              = MenuPhase.Start;
            reportsButtonArray = new Button[] { LibrariansReportButton, CardholdersReportButton,
                                                AuthorsReportButton, OverdueBooksReportButton };
            mainButtonArray       = new Button[] { SearchButton, CheckOutInButton, ReportsButton, AddBook };
            checkOutInButtonArray = new Button[] { CheckOutButton, CheckInButon };

            //prep buttons for user interaction
            InitializeReportsButtons();
            InitializeCheckOutInButtons();
        }
Beispiel #11
0
        }                                            //The Result of the dialog window

        /// <summary>
        /// Constructor for EditAuthorDialog
        /// Initializes the fields and Properties and preps the window for user interaction
        /// </summary>
        /// <param name="bookDetails"></param>
        /// <param name="controller"></param>
        public EditAuthorDialog(BookDetails bookDetails, LibraryClientController controller)
        {
            InitializeComponent();

            //Initialize fields and properties
            Owner           = bookDetails;
            this.controller = controller;

            LoadAuthors();
            DataContext = authorList;  //sets the DataContext to all available authors (shows all authors)

            //subscribe to OnDatabaseError event
            this.controller.OnDatabaseError += OnDatabaseErrorHandler;

            //prep controls for user interaction
            ResetSearchBar();
            SelectButton.IsEnabled = false;
        }
        }                                       //Book object that corresponds to the inputted ISBN, initialized to null.

        /// <summary>
        /// Constructor for AddBookDialog
        /// Initializes fields and preps the Window for user interaction
        /// </summary>
        /// <param name="controller"></param>
        public AddBookDialog(LibraryClientController controller)
        {
            //intialize fields and Properties
            InitializeComponent();

            controls = new Control[] { QuestionLabel, YesButon, NoButton, ISBNEntryTextBox };

            this.controller = controller;
            Book            = null;
            ISBN            = string.Empty;

            //subscribe to OnDatabaseError event
            this.controller.OnDatabaseError += OnDatabaseErrorHandler;

            //Initialize the controls
            InitializeControls();

            ResetDialog();
        }
        }                                            //Property to show whether search token has yielded any results

        /// <summary>
        /// Constructor for SearchResults
        /// Initializes fields and preps the window for user interaction
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="searchToken"></param>
        public SearchResults(LibraryClientController controller, string searchToken)
        {
            InitializeComponent();

            //initialize fields
            this.controller  = controller;
            this.searchToken = searchToken;

            //prep controls for user interaction
            SearchLabel.Content = String.Format("Search: {0}", searchToken);

            //populate ResultsListView with search results
            LoadSearchList();

            //Set the name of the UserLabel
            if (controller.IsLibrarian)
            {
                UserTypeLabel.Content = "Librarian";
            }
            else
            {
                UserTypeLabel.Content = "Patron";
            }
        }
 /// <summary>
 /// Constructor for BookDetails
 /// Initializes the Window controls to display the contents of a Book after selecting the Book
 /// from a SearchResults window
 /// </summary>
 /// <param name="book">Book which details will be displayed</param>
 /// <param name="controller">Controller for the library client</param>
 /// <param name="searchResults">SearchResults window that created theis BookDetails Window</param>
 public BookDetails(Book book, LibraryClientController controller, SearchResults searchResults) : this(book, controller, false)
 {
     //store reference to SearchResults Window
     searchResultsWindow = searchResults;
 }