protected void BtnDeleteBook_ServerClick(object sender, EventArgs e)
 {
     SourceBookEdit.Delete();
     GrdBooks.DataBind();
     GrdLibraryIndex.DataBind();
     ScriptManager.RegisterStartupScript(BtnDeleteBook, GetType(), "DeleteBookModal",
                                         @"$('#DeleteBookModal').modal('hide');", true);
 }
        protected void BtnDeleteAuthor_ServerClick(object sender, EventArgs e)
        {
            SourceAuthorEdit.Delete();
            GrdAuthors.DataBind();
            GrdBooks.DataBind();
            GrdLibraryIndex.DataBind();

            DrpAuthors.Items.Clear();
            DrpAuthors.DataBind();
            ScriptManager.RegisterStartupScript(BtnDeleteAuthor, GetType(), "DeleteAuthorModal",
                                                @"$('#DeleteAuthorModal').modal('hide');", true);
        }
 protected void BtnEditBook_ServerClick(object sender, EventArgs e)
 {
     if (IsValid)
     {
         Books.UpdateItem(true);
         GrdBooks.DataBind();
         GrdLibraryIndex.DataBind();
         ScriptManager.RegisterStartupScript(BtnEditBook, GetType(), "EditBookModal",
                                             @"$('#EditBookModal').modal('hide');", true);
         ScriptManager.RegisterStartupScript(BtnEditBook, GetType(), "UpdateNotifModal",
                                             @"$('#UpdateNotifModal').modal('toggle');", true);
     }
 }
        protected void BtnDeletePub_ServerClick(object sender, EventArgs e)
        {
            if (IsValid)
            {
                SourcePublisherEdit.Delete();
                GrdPublishers.DataBind();
                GrdBooks.DataBind();
                GrdLibraryIndex.DataBind();

                DrpPublishers.Items.Clear();
                DrpPublishers.DataBind();
                ScriptManager.RegisterStartupScript(BtnDeletePub, GetType(), "DeletePublisher",
                                                    @"$('#DeletePublisher').modal('hide');", true);
            }
        }
        protected void FvBtnUpdatePub_ServerClick(object sender, EventArgs e)
        {
            if (IsValid)
            {
                FormView1.UpdateItem(true);
                GrdPublishers.DataBind();
                GrdBooks.DataBind();
                GrdLibraryIndex.DataBind();

                DrpPublishers.Items.Clear();
                DrpPublishers.DataBind();
                ScriptManager.RegisterStartupScript(FvBtnUpdatePub, GetType(), "EditAuthorModal",
                                                    @"$('#EditPublisherModal').modal('hide');", true);
                ScriptManager.RegisterStartupScript(FvBtnUpdatePub, GetType(), "UpdateNotifModal",
                                                    @"$('#UpdateNotifModal').modal('toggle');", true);
            }
        }
        protected void TbxSearchBookGrid_TextChanged(object sender, EventArgs e)
        {
            if (TbxSearchBookGrid.Text != string.Empty)
            {
                string h_title = CleanString(TbxSearchBookGrid.Text);
                SourceBooks.SelectCommand = "SELECT * FROM BookDisplay WHERE " +
                                            $"CONTAINS(title,'\"{h_title}*\"') OR " +
                                            $"CONTAINS(author,'\"{h_title}*\"') OR " +
                                            $"CONTAINS(ISBN,'\"{h_title}*\"') OR " +
                                            $"CONTAINS(publisherName,'\"{h_title}*\"') OR " +
                                            $"CONTAINS(genre,'\"{h_title}*\"') OR " +
                                            "bookID IN (SELECT bookID FROM LibraryIndexNamed WHERE " +
                                            $"CONTAINS(callNumber, '\"{h_title}*\"'))";
            }

            GrdBooks.DataBind();
        }
 protected void BtnAddBook_ServerClick(object sender, EventArgs e)
 {
     ReqValPositive.Validate();
     ReqValNonExistentTitle.Validate();
     if (IsValid)
     {
         TbxTitle.Text = TbxTitle.Text.Replace("''''''''", "''''''''''''");
         SourceBooks.Insert();
         TbxTitle.Text    = "";
         TbxISBN.Text     = "";
         TbxEdition.Text  = "1";
         TbxPubYearA.Text = DateTime.Now.Year.ToString();
         TbxQuantity.Text = "1";
         GrdBooks.DataBind();
         GrdLibraryIndex.DataBind();
         ScriptManager.RegisterStartupScript(BtnAddBook, GetType(), "AddBookModal",
                                             @"$('#AddBookModal').modal('hide');", true);
         ScriptManager.RegisterStartupScript(BtnAddBook, GetType(), "AdditionNotifModal",
                                             @"$('#AdditionNotifModal').modal('toggle');", true);
     }
 }