Exemplo n.º 1
0
        private void PerformRestroSpecificAction(IRestro restro)
        {
            while (true)
            {
                Console.WriteLine("\tEnter your choice :");
                Console.WriteLine("\t1. Admin");
                Console.WriteLine("\t2. Customer");
                Console.WriteLine("\t3. Change Restraunt");

                int choice = Convert.ToInt32(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    restro.PerformRestroAction();
                    break;

                case 2:
                    restro.RegisterCustomer()
                    .PerformCustomerAction(restro);
                    break;

                case 3:
                    RestrauntChooser(restro);
                    break;
                }
            }
        }
Exemplo n.º 2
0
        private void ChooseYourRole(IRestro restro)
        {
            while (true)
            {
                Console.WriteLine("\n 1. Customer \n 2. Admin \n 3. Change Restaurant");
                Console.Write("Select Option   : ");
                string innerchoice = Console.ReadLine();
                Console.WriteLine("------------------------------------");
                switch (innerchoice)
                {
                case "1":
                    Customer customer = new Customer(Guid.NewGuid().GetHashCode(), restro);
                    restro.RegisterCustomer(customer);
                    customer.CustomerOrder();
                    break;

                case "2":
                    AdminRestro admin = new AdminRestro(restro);
                    admin.OptionsToAdmin();
                    break;

                case "3":
                    ChooseYourRestro();
                    break;

                default:
                    Console.WriteLine("Enter Valid Option");
                    break;
                }
            }
        }
Exemplo n.º 3
0
        internal void UpdateInformation(AdminClass admin, IRestro restro, Customer customer)
        {
            SetCustomersName();
            var choice = ChooseWhatToDo(restro, customer);

            ProceedAsPerTheChoice(customer, admin, restro, choice);
        }
Exemplo n.º 4
0
        public IRestro chooseRestro()
        {
            IRestro restro = null;
            int     choice = 0;

            do
            {
                Console.WriteLine("1. Dominos");
                Console.WriteLine("2. KFC");
                Console.WriteLine("Enter your choice");
                choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    restro = DominosRestro;

                    break;

                case 2:
                    restro = KfcRestro;
                    break;

                default:
                    break;
                }
            } while (choice > 2);

            return(restro);
        }
Exemplo n.º 5
0
        public void StartApplication()
        {
start:
            IRestro iRestro = chooseRestro();

            while (true)
            {
                Console.WriteLine("1. Admin");
                Console.WriteLine("2. Customer");
                Console.WriteLine("3. Back to Restro choice");
                Console.WriteLine("Please Enter Your Choice");
                int choice = Convert.ToInt32(Console.ReadLine());

                switch (choice)
                {
                case 1:
                    iRestro.ShowAdmin();
                    break;

                case 2:
                    User user = new User();
                    user.ShowCustomer(iRestro);
                    break;

                case 3:
                    goto start;

                default:
                    Console.WriteLine("Wrong choice");
                    Environment.Exit(0);
                    break;
                }
            }
            Console.ReadKey();
        }
Exemplo n.º 6
0
        public void ShowCustomer(IRestro restro)
        {
            UserInfo();

            restro.BookTable();

            restro.Order(UserName);
        }
Exemplo n.º 7
0
        public void PerformCustomerAction(IRestro crostino)
        {
            this.restro = crostino; //Restraunt is assigned to Customer

            BookTable();

            OrderItem();
        }
Exemplo n.º 8
0
 public Program(Crostino crostino, Dominos dominos, Kfc kfc, Panino panino, Pizzahut pizzahut)
 {
     this.Crostino = crostino;
     this.Dominos  = dominos;
     this.Kfc      = kfc;
     this.Panino   = panino;
     this.Pizzahut = pizzahut;
 }
Exemplo n.º 9
0
 private static void DisplayAdminMenu(IRestro restro)
 {
     while (true)
     {
         int choice = restro.ShowMenuList();
         restro.ActionToPerformedByAdminChoice(choice);
         if (choice == 7)
         {
             break;
         }
     }
 }
Exemplo n.º 10
0
        private int ChooseWhatToDo(IRestro restro, Customer customer)
        {
            int option;

            do
            {
                Console.WriteLine("1. Available tables");
                Console.WriteLine("2. Available Items");
                Console.WriteLine("3. Order Items");
                Console.WriteLine("4. Exit");
                Console.WriteLine("Enter Choice");
                option = Convert.ToInt16(Console.ReadLine());
            } while (option == null);
            return(option);
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            //Restro restro = new Restro {restroName="Happy Food Junction",restroBranch="Mihan, Nagpur" };
            IRestro         restro    = null;
            IUnityContainer container = new UnityContainer();

            ContainerActions.RegisterElements(container);



            while (true)
            {
                Console.WriteLine("Select which menu to display");
                Console.WriteLine("1 : Admin");
                Console.WriteLine("2 : Customer");
                Console.WriteLine("3 : Exit");
                var a = Console.ReadLine();
                switch (a)
                {
                case "1":
                {
                    restro = container.Resolve <IRestro>(ChooseRestraunt());
                    DisplayAdminMenu(restro);
                };
                    break;

                case "2":
                {
                    restro = container.Resolve <IRestro>(ChooseRestraunt());
                    Customer customer = new Customer(Guid.NewGuid())
                    {
                        restro = restro
                    };

                    customer.CustomerActions();
                }
                break;

                case "3": Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Please select from above options only ");
                    break;
                }
            }
        }
Exemplo n.º 12
0
        private void ProceedAsPerTheChoice(Customer customer, AdminClass admin, IRestro restro, int choice)
        {
            int ans;

            switch (choice)
            {
            case 1:
                restro.ShowTables();
                break;

            case 2:
                restro.ShowItems();
                break;

            case 3:
                restro.PlaceOrder(admin, customer);
                break;

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

            default:
                Console.WriteLine("Invalid Option");
                break;
            }
askAgain:
            Console.WriteLine("Do you want to continue:\n1. Yes\n2. No");
            ans = Convert.ToInt16(Console.ReadLine());
            if (ans == 1)
            {
                Program.Start(admin);
            }
            else if (ans == 2)
            {
                Environment.Exit(0);
            }
            else
            {
                Console.WriteLine("Invalid Option");
                goto askAgain;
            }
        }
Exemplo n.º 13
0
        private static void ChooseYourRole(IRestro restro, AdminClass admin)
        {
            Console.WriteLine("\nChoose Your Role\n");
            Console.WriteLine("1. Admin\n2. Customer\n3.Exit");
            Console.WriteLine("---------------------------------------------");
            var choice = Convert.ToInt16(Console.ReadLine());

            Console.WriteLine("---------------------------------------------");
            switch (choice)
            {
            case 1:
                admin.ShowFunctionalityOfAdmin(admin);
                break;

            case 2:
                Customer customer = new Customer();
                customer.UpdateInformation(admin, restro, customer);
                break;
            }
        }
Exemplo n.º 14
0
        public static void Start(AdminClass admin)
        {
            IRestro restro = null;

            Console.WriteLine("Select a Restaurant");
            Console.WriteLine("1. McD \n2.Pizza Hut");
            var choice = Convert.ToInt16(Console.ReadLine());

            switch (choice)
            {
            case 1:
                restro = new RestroMcD();
                ChooseYourRole(restro, admin);
                break;

            case 2:
                restro = new RestroPizzaHut();
                ChooseYourRole(restro, admin);
                break;
            }
        }
Exemplo n.º 15
0
        private void ChooseYourRestro()
        {
            string choice = "";

            do
            {
                IRestro restro = null;
                Console.WriteLine("\n 1.Dominos \n 2.KFC");
                Console.Write("Choose Restro   : ");
                choice = Console.ReadLine();
                switch (choice)
                {
                case "1":
                    Console.WriteLine("************************Welcome to Dominos***********************");
                    restro = Dominos;
                    break;

                case "2":
                    Console.WriteLine("************************Welcome to KFC***********************");
                    restro = Kfc;
                    break;

                case "3":
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Enter Valid Option");
                    break;
                }
                if (restro != null)
                {
                    ChooseYourRole(restro);
                }

                Console.WriteLine("Do you want to Continue (y/n) ?");
                choice = Console.ReadLine();
            } while (choice.Equals("y", StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 16
0
        private void StartProgram()
        {
            IRestro restro = null;

            while (true)
            {
                RestrauntChooser(restro);

                Console.WriteLine("\tDo you want to continue ?");
                Console.WriteLine("\t1 - Yes");
                Console.WriteLine("\t2 - No");

                int choice = Convert.ToInt32(Console.ReadLine());
                if (choice == 2)
                {
                    break;
                }
                else
                {
                    continue;
                }
            }
        }
Exemplo n.º 17
0
        private void RestrauntChooser(IRestro restro)
        {
RestroChooser:
            int choice = ShowDiffrentRestroOption();

            switch (choice)
            {
            case 1:
                restro = Crostino;
                break;

            case 2:
                restro = Dominos;
                break;

            case 3:
                restro = Kfc;
                break;

            case 4:
                restro = Panino;
                break;

            case 5:
                restro = Pizzahut;
                break;
            }
            if (restro != null)
            {
                PerformRestroSpecificAction(restro);
            }
            else
            {
                Console.WriteLine("\tInvalid Input Please try again.");
                goto RestroChooser;
            }
        }
Exemplo n.º 18
0
 private void ChooseTable(IRestro restro, Customer customer)
 {
     TableId = restro.BookTable(customer);
 }
Exemplo n.º 19
0
 Program(IRestro Dominos, IRestro Kfc)
 {
     this.Dominos = Dominos;
     this.Kfc     = Kfc;
 }
Exemplo n.º 20
0
 public AdminRestro(IRestro restro)
 {
     this.restro = restro;
 }
Exemplo n.º 21
0
 public Customer(int id, IRestro restro)
 {
     CustomerId   = id;
     this.Restro  = restro;
     RestroEvents = new RestroEvents();
 }
Exemplo n.º 22
0
 public MainRestro(IRestro kfc, IRestro domino)
 {
     KfcRestro     = kfc;
     DominosRestro = domino;
 }