Exemple #1
0
        public string RequestForThisBook(Book book, BookReader reader)
        {
            BookGateway aBookGateway = new BookGateway();

            if (aBookGateway.CheckIfthisBookExist(book))
            {
                if (aBookGateway.CheckBookQuantity(book) > 0)
                {
                    if (aRequestGateway.RequestForThisBook(book, reader))
                    {
                        return("Request Successfull");
                    }
                    else
                    {
                        return("Error found");
                    }
                }
                else
                {
                    return("Not Available now");
                }
            }
            else
            {
                return("This book is not exist in the library");
            }
        }
Exemple #2
0
 public List <Book> GetAllBooksByNumber(string number)
 {
     aBookGateWay = new BookGateway();
     books        = new List <Book>();
     books        = aBookGateWay.GetAllBooksByNumber(number);
     return(books);
 }
Exemple #3
0
        public Book GetBookByTitle(string title)
        {
            aBook        = new Book();
            aBookGateWay = new BookGateway();

            aBook = aBookGateWay.GetBookByTitle(title);
            return(aBook);
        }
        public List <Book> GetAllBooks()
        {
            BookGateway bGateway1 = new BookGateway();

            //List<Book> books = bGateway1.GetALLBooks();

            return(null);
        }
Exemple #5
0
        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);
        }
Exemple #6
0
        public string UpdateBookQuantity(string bookID)
        {
            BookGateway aGateway = new BookGateway();

            if (aGateway.UpdateBookQuantity(bookID))
            {
                return("Book list Updated");
            }
            return("Book list update failed");
        }
Exemple #7
0
        public bool ReturnThisBook(string bookID, string readerID)
        {
            BookGateway       aBookGateway       = new BookGateway();
            BookReaderGateway aBookReaderGateway = new BookReaderGateway();
            RequestGateway    aRequestGateway    = new RequestGateway();

            if (aBookGateway.UpdateReturnBookQuantity(bookID) && aBookReaderGateway.UpdateBookReaderTakenBook(readerID) &&
                aRequestGateway.ReturnBook(bookID) && aRequestGateway.UpdateReturnDate(readerID))
            {
                return(true);
            }
            return(false);
        }
        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");
            }
        }
Exemple #9
0
        public List <Book> GetAllBook(string searchBook)
        {
            BookGateway bookGateway = new BookGateway();

            return(bookGateway.GetAllBookFromDB(searchBook));
        }
Exemple #10
0
 public BookBLL()
 {
     aBookGateway = new BookGateway();
 }
Exemple #11
0
 public List <Book> GetAllBooks()
 {
     aBookGateWay = new BookGateway();
     return(aBookGateWay.GetAllBook());
 }