Ejemplo n.º 1
0
        private static void addingBookFeature()
        {
            Book bk = new Book();

            bk.BookID = MyConsole.getNumber("Enter the ISBN no of this book");
            bk.Title  = MyConsole.getString("Enter the title of this book");
            bk.Author = MyConsole.getString("Enter the Author of this book");
            bk.Price  = MyConsole.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);
            }
        }
Ejemplo n.º 2
0
        private static void deletingCustomer()
        {
            int id = MyConsole.getNumber("Enter the ID of the customer to remove");

            if (mgr.DeleteCustomer(id))
            {
                Console.WriteLine("Customer Deleted successfully");
            }
            else
            {
                Console.WriteLine("Could not find the Customer to delete");
            }
        }
Ejemplo n.º 3
0
        private static void deletingFeature()
        {
            int id = MyConsole.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 serializingXml()
        {
            Student stud = new Student();

            stud.Name    = MyConsole.getString("Enter the name");
            stud.Address = MyConsole.getString("Enter the address");
            stud.Phone   = MyConsole.getNumber("Enter the landline Phone no");
            FileStream    fs = new FileStream("Xmlfile.xml", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            XmlSerializer sl = new XmlSerializer(typeof(Student));

            sl.Serialize(fs, stud);
            fs.Flush();//Clears the buffer into the destination so that no unused stream is left over before U close the Stream...
            fs.Close();
        }
Ejemplo n.º 5
0
        private static void addingCustomerData()
        {
            Customer cus = new Customer();

            cus.CustomerID = MyConsole.getNumber("Enter the ID of the Customer");
            cus.Name       = MyConsole.getString("Enter the Name of Customer");
            cus.Address    = MyConsole.getString("Enter the Address of Customer");

            try
            {
                bool result = mgr.AddNewCustomer(cus);
                Console.WriteLine($"Customer by name {cus.Name} is added successfully to the database");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 6
0
        private static void updatingCustomerData()
        {
            Customer cus = new Customer();

            cus.CustomerID = MyConsole.getNumber("Enter the ID  of the Customer U wish to update");
            cus.Name       = MyConsole.getString("Enter the new name of this customer");
            cus.Address    = MyConsole.getString("Enter the new Address of this customer");

            bool result = mgr.UpdateCustomer(cus);

            if (!result)
            {
                Console.WriteLine($"No Customer by this id {cus.CustomerID} found to update");
            }
            else
            {
                Console.WriteLine($"Customer by ID {cus.CustomerID} is updated successfully to the database");
            }
        }
Ejemplo n.º 7
0
        private static void updatingBookFeature()
        {
            Book bk = new Book();

            bk.BookID = MyConsole.getNumber("Enter the ISBN no of the book U wish to update");
            bk.Title  = MyConsole.getString("Enter the new title of this book");
            bk.Author = MyConsole.getString("Enter the new Author of this book");
            bk.Price  = MyConsole.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");
            }
        }