private static void addingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole1.getNumber("Enter the ISBN no of this book"); bk.Title = MyConsole1.getString("Enter the title of this book"); bk.Author = MyConsole1.getString("Enter the Author of this book"); bk.Price = MyConsole1.getDouble("Enter the Price of this book"); try { bool result = mgr.AddNewBook(bk); if (!result) { Console.WriteLine("No more books could be added"); } else { Console.WriteLine($"Book by title {bk.Title} is added successfully to the database"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private static void deletingFeature() { int id = MyConsole1.getNumber("Enter the ID of the book to remove"); if (mgr.DeleteBook(id)) { Console.WriteLine("Book Deleted successfully"); } else { Console.WriteLine("Could not find the book to delete"); } }
private static void exampleOnCustomer() { Customer cst = new Customer(); int custid = MyConsole1.getNumber("Enter ID"); string cstName = MyConsole1.getString("Enter Name"); string cstAddress = MyConsole1.getString("Enter Address"); cst.addBillAmount(450); cst.addBillAmount(400); cst.addBillAmount(250); cst.addBillAmount(100); cst.addBillAmount(45); cst.addBillAmount(40); cst.DisplayBill(); }
private static void updatingBookFeature() { Book bk = new Book(); bk.BookID = MyConsole1.getNumber("Enter the ISBN no of the book U wish to update"); bk.Title = MyConsole1.getString("Enter the new title of this book"); bk.Author = MyConsole1.getString("Enter the new Author of this book"); bk.Price = MyConsole1.getDouble("Enter the new Price of this book"); bool result = mgr.UpdateBook(bk); if (!result) { Console.WriteLine($"No book by this id {bk.BookID} found to update"); } else { Console.WriteLine($"Book by ID {bk.BookID} is updated successfully to the database"); } }
static void InitializeComponent() { menu = string.Format($"~~~~~~~BOOK STORE MANAGEMENT SOFTWARE~~~~~~~~~~~~~~~~~~~\nTO ADD A NEW BOOK------------->PRESS 1\nTO UPDATE A BOOK------------>PRESS 2\nTO DELETE A BOOK------------PRESS 3\nTO FIND A BOOK------------->PRESS 4\nPS:ANY OTHER KEY IS CONSIDERED AS EXIT THE APP\n"); int size = MyConsole1.getNumber("Enter the no of Books U wish to store in the BookStore"); mgr = BookFactoryComponent.GetComponent(size); mgr.AddNewBook(new Book { BookID = 123, Title = "A Suitable Boy", Author = "Vikram Seth", Price = 1200 }); mgr.AddNewBook(new Book { BookID = 124, Title = "Disclosure", Author = "Micheal Crichton", Price = 500 }); mgr.AddNewBook(new Book { BookID = 125, Title = "The Mahabharatha", Author = "C Rajagoalachari", Price = 350 }); mgr.AddNewBook(new Book { BookID = 126, Title = "The Discovery of India", Author = "J . Nehru", Price = 800 }); }