private void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                SearchAndEdit Search = new SearchAndEdit();
                DBManager manager = new DBManager();
                Book aBook = new Book();
                aBook.SerialNo = serialTextBox.Text;
                aBook.BookName = nameTextBox.Text;
                aBook.AuthorName = writernameTextBox.Text;
                aBook.Edition = comboBox1.SelectedItem.ToString();
                aBook.TypeOfBook = b_type;
                aBook.Quantity = Convert.ToInt16(quantityTextBox.Text);
                aBook.UnitPrice = Convert.ToDouble(uintPriceTextBox.Text);
                aBook.PurchasesDate =dateTimePiker.Text;

                string status =manager.SaveBookS(aBook);
                MessageBox.Show(status,"Message",MessageBoxButtons.OK,MessageBoxIcon.Information);
                ClearAllText();
               serialTextBox.Text=LastAddedInvestlNo().ToString();
               Search.GetALLBooks();
               
            }
                catch(FormatException)
            {
                MessageBox.Show("Please fill up every field properly","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);

                }
            catch (Exception)
            {

                MessageBox.Show("Book id must be unique.","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }
        private void saveButton_Click(object sender, EventArgs e)
        {
            try
            {
                SearchAndEdit Search = new SearchAndEdit();
                DBManager manager = new DBManager();
                Book aBook = new Book();
                aBook.SerialNo = serialTextBox.Text;
                aBook.BookName = nameTextBox.Text;
                aBook.AuthorName = writernameTextBox.Text;
                aBook.Edition = textBox1.Text;
                aBook.TypeOfBook = b_type;
                aBook.BookPrint = book_print;
                aBook.Quantity = Convert.ToInt16(quantityTextBox.Text);
                aBook.UnitPrice = Convert.ToDouble(uintPriceTextBox.Text);
                aBook.PurchasesDate =dateTimePiker.Text;

                string status =manager.SaveBookS(aBook);
                //if (status!=null)
                //{
                //  reader.Dispose();
                //    reader=new SpeechSynthesizer();
                //    reader.SpeakAsync("   Saved");
                    MessageBox.Show(status, "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //}
               
                ClearAllText();
               serialTextBox.Text=LastAddedInvestlNo().ToString();
               Search.GetALLBooks();

                //28-02-2015


               ShowAllBook();
                ShowAllOldBook();
                totalBooks();

                nameTextBox.TabIndex = 0;

            }
                catch(FormatException)
            {
                MessageBox.Show("Please fill up every field properly","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);

                }
            catch (Exception)
            {

                MessageBox.Show("Book Couldn't Save.","Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }