private void borrowBtn_Click(object sender, EventArgs e)
        {
            LibraryDataContext dbContext = new LibraryDataContext();
            String             borrowStr = borrowTxt.Text;

            Book book = null;

            if (borrowCombo.SelectedItem.ToString().Equals("Name"))
            {
                book = dbContext.Books.SingleOrDefault(x => x.B_NAME == borrowStr);
            }
            else if (borrowCombo.SelectedItem.ToString().Equals("Book ID"))
            {
                book = dbContext.Books.SingleOrDefault(x => x.B_ID == borrowStr);
            }
            Borrow borrow = new Borrow();

            borrow.ID     = ID;
            borrow.B_ID   = book.B_ID;
            borrow.B_NAME = book.B_NAME;
            borrow.TOPIC  = book.TOPIC;
            dbContext.Borrows.InsertOnSubmit(borrow);
            dbContext.SubmitChanges();
            MessageBox.Show("Book borrowed!");
            table.DataSource = dbContext.Books;
        }
        private void removeBtn_Click(object sender, EventArgs e)
        {
            String bookID = bookIDTxt.Text;

            LibraryDataContext dbContext = new LibraryDataContext();
            Book book = dbContext.Books.SingleOrDefault(x => x.B_ID == bookID);

            dbContext.Books.DeleteOnSubmit(book);
            dbContext.SubmitChanges();
            MessageBox.Show("Book Removed!");
            table.DataSource = dbContext.Books;
        }
        private void updateBtn_Click(object sender, EventArgs e)
        {
            String bookID = bookIDTxt.Text;

            LibraryDataContext dbContext = new LibraryDataContext();
            Book book = dbContext.Books.SingleOrDefault(x => x.B_ID == bookID);

            book.B_NAME = bookNameTxt.Text;
            book.TOPIC  = bookTopicTxt.Text;
            book.T_QTY  = Int32.Parse(tQtyTxt.Text);
            book.A_QTY  = Int32.Parse(aQtyTxt.Text);
            dbContext.SubmitChanges();
            MessageBox.Show("Information Updated!");
            table.DataSource = dbContext.Books;
        }
        private void addBtn_Click(object sender, EventArgs e)
        {
            LibraryDataContext dbContext = new LibraryDataContext();
            Book book = new Book();

            book.B_ID   = bookIDTxt.Text;
            book.B_NAME = bookNameTxt.Text;
            book.TOPIC  = bookTopicTxt.Text;
            book.T_QTY  = Int32.Parse(tQtyTxt.Text);
            book.A_QTY  = Int32.Parse(aQtyTxt.Text);
            dbContext.Books.InsertOnSubmit(book);
            dbContext.SubmitChanges();
            MessageBox.Show("Book Added!");
            table.DataSource = dbContext.Books;
        }
        private void registerBtn_Click(object sender, EventArgs e)
        {
            Credential cred = new Credential();

            cred.ID = idTxt.Text;
            String p1 = passTxt.Text;
            String p2 = passReTxt.Text;

            if (!p1.Equals(p2))
            {
                MessageBox.Show("Password do not match!");
                return;
            }
            cred.PASS = passTxt.Text;
            cred.ROLE = "STUDENT";
            LibraryDataContext dbContext = new LibraryDataContext();

            dbContext.Credentials.InsertOnSubmit(cred);
            dbContext.SubmitChanges();
            MessageBox.Show("Registration Successful!");
        }