예제 #1
0
        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);
            }
        }
예제 #2
0
        static void Main(string[] args)
        {
            InitializeComponent();
            bool @continue = true;

            do
            {
                string choice = MyConsole1.getString(menu);
                @continue = processing(choice);
            } while (@continue);
        }
예제 #3
0
        private static void readingFeature()
        {
            string title = MyConsole1.getString("Enter the title or part of the title to search");

            Book[] books = mgr.GetAllBooks(title);
            foreach (var bk in books)
            {
                if (bk != null)
                {
                    Console.WriteLine(bk.Title);
                }
            }
        }
예제 #4
0
        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();
        }
예제 #5
0
        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");
            }
        }
예제 #6
0
        static void Main(string[] args)
        {
            List <Customer1> customers = new List <Customer1>();

            customers.Add(new Customer1 {
                CustomerCity = "Bangalore", CustomerID = 143, CustomerName = "Anand P Sharma"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Mysore", CustomerID = 184, CustomerName = "Mohit Kumar"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Chennai", CustomerID = 125, CustomerName = "Srujjan"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Agra", CustomerID = 126, CustomerName = "Sampath"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Mumbai", CustomerID = 117, CustomerName = "Antony"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Pune", CustomerID = 132, CustomerName = "Siad"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Hyderabad", CustomerID = 129, CustomerName = "Joe Biden"
            });
            customers.Add(new Customer1 {
                CustomerCity = "Coimbatore", CustomerID = 133, CustomerName = "Sam Jackson"
            });

            string input = MyConsole1.getString("Enter the criteria of Comparing");
            IComparer <Customer1> comparer = new Customer1Comparer(input);

            customers.Sort(comparer);

            foreach (var cst in customers)
            {
                Console.WriteLine(cst);//cst.ToString();
            }
        }