public List<Book> GetAllBooks()
       {
           BookGateway bGateway1 = new BookGateway();
           //List<Book> books = bGateway1.GetALLBooks();

           return null;
       }
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                BookGateway gateway=new BookGateway();
                List<Book> books = new List<Book>();
                int count = dataGridView1.RowCount;
                for (int i = 0; i < count; i++)
                {
                    DataGridViewRow row = this.dataGridView1.Rows[i];

                    string s1 = row.Cells["S#No"].Value.ToString();
                    string name = row.Cells["Name"].Value.ToString();
                    string writer = row.Cells["Writer"].Value.ToString();
                    string edition = row.Cells["Edition"].Value.ToString();
                    string type = row.Cells["Type"].Value.ToString();
                    string print = row.Cells["Book_Print"].Value.ToString();
                    int quantity = Convert.ToInt16(row.Cells["Quantiy"].Value);
                    double bookUnitPrice = Convert.ToDouble(row.Cells["B_Unit_Price"].Value);
                    //double totalPrice = Convert.ToDouble(row.Cells["Total_Price"].Value);
                    string date = row.Cells["Purchase_Date"].Value.ToString();
                    Book aBook=new Book();
                    aBook.SerialNo = s1;
                    aBook.BookName = name;
                    aBook.AuthorName = writer;
                    aBook.Edition = edition;
                    aBook.TypeOfBook = type;
                    aBook.BookPrint = print;
                    aBook.Quantity = quantity;
                    aBook.UnitPrice = bookUnitPrice;
                    aBook.PurchasesDate = date;

                    gateway.SaveBook(aBook);
                    //books.Add(aBook);
                    
                }
                
            }
            catch (Exception exception)
            {

                MessageBox.Show("Saved");
            }
        }
 private void editToolStripMenuItem_Click(object sender, EventArgs e)
 {
     int index = listView1.SelectedIndices[0];
     ListViewItem item = listView1.Items[index];
     Book aBook = (Book)item.Tag;
     BookGateway gateway = new BookGateway();
     string i = gateway.DeleteInfo(aBook);
     MessageBox.Show(i);
    
     
    
    
 }