Esempio n. 1
0
        static void Main(string[] args)
        {
            MotobikeAgent motobikeAgent = new MotobikeAgent();
            int           choice        = 0;

            do
            {
                Console.WriteLine("1. Add");
                Console.WriteLine("2. List");
                Console.WriteLine("3. Search");
                Console.WriteLine("4. Iswarrannty");
                Console.WriteLine("5. quit");
                choice = Wrappers.GetInt("Enter your choice: ");

                switch (choice)
                {
                case 1:
                    BuyMotobikeCustomer bmc = GetBuyMotobikeCustomer();
                    motobikeAgent.Add(bmc);
                    break;

                case 2:
                    List(motobikeAgent);
                    break;

                case 3:
                    if (motobikeAgent.GetCount() == 0)
                    {
                        Console.WriteLine("List is empty");
                    }
                    else
                    {
                        string name = Wrappers.GetString("Enter customer name: ");
                        Search(name, motobikeAgent);
                    }
                    break;

                case 4:
                    if (motobikeAgent.GetCount() == 0)
                    {
                        Console.WriteLine("List is empty");
                    }
                    else
                    {
                        string namecus = Wrappers.GetString("Enter customer name: ");
                        string code    = Wrappers.GetString("Enter motobike code: ");
                        Iswarranty(namecus, code, motobikeAgent);
                    }
                    break;

                case 5:
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Invalid your choice");
                    break;
                }
            } while (true);
        }
Esempio n. 2
0
        public static BuyMotobikeCustomer GetBuyMotobikeCustomer()
        {
            BuyMotobikeCustomer buyMotobike = new BuyMotobikeCustomer();
            Motobike            motobike;

            buyMotobike.Name    = Wrappers.GetString("Enter customer name: ");
            buyMotobike.Address = Wrappers.GetString("Enter address: ");
            buyMotobike.Phone   = Wrappers.GetString("Enter phone: ");
            buyMotobike.Email   = Wrappers.GetEmail("Enter email: ");
            Console.WriteLine("Motobike type:");
            Console.WriteLine("1. New motobike");
            Console.WriteLine("2. Old motobike");
            do
            {
                int type = Wrappers.GetInt("Enter your choice: ");

                if (type == 1)
                {
                    motobike = new NewMotobike();
                    break;
                }
                else if (type == 2)
                {
                    motobike = new OldMotobike();
                    break;
                }
                else
                {
                    Console.WriteLine("Invalid your choice");
                }
            } while (true);

            motobike.Code     = Wrappers.GetString("Enter Code: ");
            motobike.Name     = Wrappers.GetString("Enter motobike Name: ");
            motobike.Price    = Wrappers.GetDouble("Enter price: ");
            motobike.SaleDate = Wrappers.GetDateTime("Enter sale date: ");

            buyMotobike.BuyMotobike = motobike;
            return(buyMotobike);
        }
Esempio n. 3
0
 public void Add(BuyMotobikeCustomer buymotobike)
 {
     MotobikeList.Add(buymotobike);
 }