Ejemplo n.º 1
0
        private void OnModifyBook(object sender, RoutedEventArgs e)
        {
            if (dgLibrarianDocuments.SelectedIndex != -1 && dgLibrarianDocuments.SelectedItems[0] != null)
            {
                DocumentsTable docRow = dgLibrarianDocuments.SelectedItems[0] as DocumentsTable;
                Window         page   = null;
                switch (docRow.docType)
                {
                case "Book":
                    page = new ModifyBookPage(docRow.docID, this);
                    break;

                case "Journal":
                    page = new ModifyJournalPage(docRow.docID, this);
                    break;

                case "AV":
                    page = new ModifyAVPage(docRow.docID, this);
                    break;

                default:
                    throw new Exception("Unhandled doc type!");
                }
                page.ShowDialog();
            }
        }
Ejemplo n.º 2
0
        private void OnDeleteBook(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure to remove this entry?", "Attention", MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                try
                {
                    Librarian      lib     = (Librarian)SDM.CurrentUser;
                    DocumentsTable doc_row = dgLibrarianDocuments.SelectedItems[0] as DocumentsTable;
                    int            doc_id  = doc_row.docID;
                    lib.DeleteDoc(doc_id);
                    UpdateTable();
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.ToString(), "Error");
                }
                break;

            case MessageBoxResult.No:
                break;
            }
        }
Ejemplo n.º 3
0
        private void OnRequestBook(object sender, RoutedEventArgs e)
        {
            DocumentsTable docRow = dgLibrarianDocuments.SelectedItems[0] as DocumentsTable;

            Librarian lb = (Librarian)SDM.CurrentUser;

            lb.OutstandingRequest(docRow.docID);

            UpdateTable();
            MessageBox.Show("You have successfully deleted users queue for that document.", "Success!", MessageBoxButton.OK);
        }
Ejemplo n.º 4
0
        /// <summary> Trying to check out selected doc </summary>
        private void OnCheckOut(object sender, RoutedEventArgs e)
        {
            if (docTable.SelectedIndex == -1)
            {
                return;
            }

            MessageBoxResult result = MessageBox.Show(SDM.Strings.CHECK_OUT_CONFIRMATION_TEXT,
                                                      SDM.Strings.ATTENTION_TEXT, MessageBoxButton.YesNo);

            switch (result)
            {
            case MessageBoxResult.Yes:
                DocumentsTable lb_row        = docTable.SelectedItems[0] as DocumentsTable;
                int            bookID        = lb_row.docID;
                Patron         currentPatron = (Patron)SDM.CurrentUser;
                MessageBox.Show(currentPatron.CheckOut(bookID));
                UpdateUI();
                break;

            case MessageBoxResult.No:
                break;
            }
        }