Ejemplo n.º 1
0
 private static void ShowCustomerList(MgrCustomer mgrCustomer)
 {
     Console.WriteLine("Customer Infomations");
     foreach (var item in mgrCustomer.GetCustomers())
     {
         Console.WriteLine("Name : {0}", item.CustomerName);
         Console.WriteLine("Tel : {0}", item.CustomerTel);
     }
 }
Ejemplo n.º 2
0
        private static void Rental(MgrBook mgrbook, MgrCustomer mgrCustomer, MgrRental mgrRental)
        {
            string msg = string.Empty;

            Console.Write("Enter rental customer name : ");
            var customerName = Console.ReadLine();

            Console.Write("Enter rental customer tel : ");
            var customerTel = Console.ReadLine();

            Customer customer = mgrCustomer.GetCustomer(customerName, customerTel);

            if (customer == null)
            {
                Console.WriteLine("Unregistration customer.");
                return;
            }

            Console.Write("Enter rental book name : ");
            var bookName = Console.ReadLine();

            Book book = mgrbook.GetBook(bookName);

            if (book == null)
            {
                Console.WriteLine("Unregistration book.");
                return;
            }

            Console.Write("Enter rental days : ");
            var rentalDays = Console.ReadLine();

            int iRentalDays = 0;

            int.TryParse(rentalDays, out iRentalDays);
            if (iRentalDays > 0)
            {
                if (mgrRental.AddRental(customer, book, iRentalDays, ref msg))
                {
                    Console.WriteLine(msg);
                }
                else
                {
                    Console.WriteLine(msg);
                }
            }
            else
            {
                Console.WriteLine("Zero day not allowd.");
            }
        }
Ejemplo n.º 3
0
        private static void UnRegistrationCustomer(MgrCustomer mgrCustomer)
        {
            Console.Write("Enter customer name : ");
            var name = Console.ReadLine();

            Console.Write("Enter customer tel : ");
            var tel = Console.ReadLine();


            if (mgrCustomer.RemoveCustomer(name, tel))
            {
                Console.WriteLine("{0}, {1} unregistration is complete.", name, tel);
            }
            else
            {
                Console.WriteLine("{0}, {1} unregistration is not complete.", name, tel);
            }
        }
Ejemplo n.º 4
0
        private static void RegistrationCustomer(MgrCustomer mgrCustomer)
        {
            Console.Write("Enter customer name : ");
            var name = Console.ReadLine();

            Console.Write("Enter customer tel : ");
            var tel = Console.ReadLine();

            Customer cust = new Customer {
                CustomerName = name,
                CustomerTel  = tel
            };

            if (mgrCustomer.AddCustomer(cust))
            {
                Console.WriteLine("{0} registration is complete.", name);
            }
            else
            {
                Console.WriteLine("{0} registration is not complete.", name);
            }
        }
Ejemplo n.º 5
0
        static void Main(string[] args)
        {
            Console.WriteLine("도서 대여 관리 프로그램");

            //book 관리 class
            MgrBook mgrbook = new MgrBook();

            //customer 관리 class
            MgrCustomer mgrCustomer = new MgrCustomer();

            //rental 관리 class
            MgrRental mgrRental = new MgrRental();

            while (true)
            {
                Console.WriteLine("SELECT MENU :");
                Console.WriteLine("************************Book************************");
                Console.WriteLine("1.BOOK REGISTRATION, 2.SHOW BOOK LIST, 3.BOOK UNREGISTRATION, 4.SEARH BOOK (BOOK NAME)");
                Console.WriteLine("************************Customer************************");
                Console.WriteLine("5.CUSTOMER REGISTRATION, 6.CUSTOMER UNREGISTRATION, 7.SHOW CUSTOMER LIST");
                Console.WriteLine("************************Rental************************");
                Console.WriteLine("8.RENTAL, 9. SHOW RENTAL LIST");
                Console.WriteLine("99.EXIT");
                string input = Console.ReadLine();

                switch (input)
                {
                case "1":
                    RegistrationBook(mgrbook);
                    break;

                case "2":
                    ShowBookList(mgrbook);
                    break;

                case "3":
                    UnregistrationBook(mgrbook);
                    break;

                case "4":
                    SearchBook(mgrbook);
                    break;

                case "5":
                    RegistrationCustomer(mgrCustomer);
                    break;

                case "6":
                    UnRegistrationCustomer(mgrCustomer);
                    break;

                case "7":
                    ShowCustomerList(mgrCustomer);
                    break;

                case "8":
                    Rental(mgrbook, mgrCustomer, mgrRental);
                    break;

                case "9":
                    ShowRentalList(mgrRental);
                    break;

                case "99":
                    Console.WriteLine("Program terminate.");
                    System.Threading.Thread.Sleep(1000);
                    return;

                default:
                    Console.WriteLine("Not yet implement.");
                    break;
                }
                Console.WriteLine("Enter any key. ");
                Console.ReadLine();
                Console.Clear();
            }
        }