Beispiel #1
0
        public static void ManagerNavigation()
        {
            //navigation system for the manager with all its options.
            Console.WriteLine("\nPlease pick a option.\n[1] Look at sale data.\n[2] Input sale data.\n[3] See all reservations.\n[4] Look at the expected amount of customers.\n[0] Exit application.");
            int choice = Program.ChoiceInput(0, 4);

            while (choice != 0)
            {
                if (choice == 1)
                {
                    //show sale data
                    SaleData.ShowSaleData();
                }
                else if (choice == 2)
                {
                    //input sale data
                    SaleData.SaleDatainput();
                }
                else if (choice == 3)
                {
                    //see all reservations
                    Reservations.ReservationMain();
                }
                else if (choice == 4)
                {
                    //look at expected customers
                    expected.ExpectedCustomers();
                }
                Console.WriteLine("\nPlease pick a option.\n[1] Look at sale data.\n[2] Input sale data.\n[3] See all reservations.\n[4] Look at the expected amount of customers.\n[0] Exit application.");
                choice = Program.ChoiceInput(0, 4);
            }
            //see al reservations
            Environment.Exit(0);
        }
Beispiel #2
0
        //navigation system for the owner with all its options.
        public static void OwnerNavigation()
        {
            Console.WriteLine("\nPlease pick a option.\n[1] Look at sale data.\n[2] Adjust seat prices.\n[3] Show all movies.\n[4] Add, edit or remove Films\n[5] Show all upcoming movies.\n[6] Add, edit or remove upcoming Films\n[7] See all Reservations.\n[8] Look at the expected amount of customers.\n[9] Go to the comments / reviews.\n[0] Exit application.");
            int choice = Program.ChoiceInput(0, 9);

            while (choice != 0)
            {
                if (choice == 1)
                {
                    //look at sale data
                    SaleData.ShowSaleData();
                }
                else if (choice == 2)
                {
                    //adjust seat prices
                    Rooms.Manager();
                }
                else if (choice == 3)
                {
                    //show all movies
                    Console.WriteLine("\n" + File.ReadAllText(@"filmlist.txt"));
                }
                else if (choice == 4)
                {
                    //add, edit or remove films
                    Films.FilmMain();
                }
                else if (choice == 5)
                {
                    Console.WriteLine("\n" + File.ReadAllText(@"futurefilm.txt"));
                }
                else if (choice == 6)
                {
                    //add, edit or remove Future films
                    FutureFilm.FutureMain();
                }
                else if (choice == 7)
                {
                    //see all reservations
                    Reservations.ShowReservations();
                }
                else if (choice == 8)
                {
                    //look at expected customers
                    expected.ExpectedCustomers();
                }
                else if (choice == 9)
                {
                    //go to the comments / revies
                    OwnerComment.CoMaMain();
                }
                Console.WriteLine("\nPlease pick a option.\n[1] Look at sale data.\n[2] Adjust seat prices.\n[3] Show all movies.\n[4] Add, edit or remove Films\n[5] Show all upcoming movies.\n[6] Add, edit or remove upcoming Films\n[7] See all Reservations.\n[8] Look at the expected amount of customers.\n[9] Go to the comments.\n[0] Exit application.");
                choice = Program.ChoiceInput(0, 9);
            }
            Environment.Exit(0);
        }
Beispiel #3
0
        public static void ShoppingcartCheckout(User user)
        {
            double totalPrice           = ShoppingcartTotalPrice(user);
            int    creditcardMaxNumbers = 5;
            bool   creditcardCheck      = false;
            string ticketData           = "";

            Console.WriteLine("Your total is: $" + totalPrice + "\nPlease enter the 5 characters of your creditcard to complete the transaction.");
            var creditcardInput = Console.ReadLine();

            while (creditcardCheck == false)
            {
                if (int.TryParse(creditcardInput, out int integer) && creditcardInput.Length == creditcardMaxNumbers)
                {
                    //add to foodOrders
                    string   filename2 = "allOrders.json";
                    string   rawJSON   = File.ReadAllText(filename2);
                    string[] data2     = JsonConvert.DeserializeObject <string[]>(rawJSON);
                    if (data2.Length == 0)
                    {
                        data2 = new string[1];
                    }
                    for (int i = 0; i < data.Length; i++)
                    {
                        if (data[i][0] == user.username)
                        {
                            string s = "";
                            for (int j = 0; j < data[i].Length; j++)
                            {
                                s += data[i][j] + " ";
                            }
                            if (data2[0] == null)
                            {
                                Array.Resize(ref data2, data2.Length + 1);
                            }
                            data2[data2.Length - 1] = s;
                            string newJSON = JsonConvert.SerializeObject(data2);
                            File.WriteAllText(filename2, newJSON);
                        }
                        else
                        {
                            for (int j = 0; j < data[i].Length; j++)
                            {
                                ticketData += data[i][j] + " ";
                            }
                            ticketData += " | ";
                            double TicketPrice;
                            double.TryParse(data[i][0], out TicketPrice);
                            SaleData.AddData(data[i][2], TicketPrice);
                        }
                    }
                    creditcardCheck = true;
                    //add to sale data
                }
                else
                {
                    Console.WriteLine("Invalid input, please try again.");
                    creditcardInput = Console.ReadLine();
                }
            }

            //Reservation code
            string reservationCode = "";

            if (ticketData != "")
            {
                using (var reader = new StreamReader(@"ReservationID.txt")) {
                    int R = 0;

                    while (!reader.EndOfStream)
                    {
                        string line = reader.ReadLine();
                        R = Convert.ToInt32(line);
                        //checking last created reservationcode
                    }
                    R = R + 1;
                    //making it unique
                    reservationCode = R.ToString();
                }
                using (StreamWriter sw = File.AppendText(@"ReservationID.txt")) {
                    sw.Write(reservationCode);
                }
                using (StreamWriter sw = File.AppendText("ReservationCodes+TicketOrders.txt")) {
                    sw.WriteLine("[" + reservationCode + "] " + ticketData);
                    sw.Close();
                }

                //foreach (var r in reservatedMovies)
                //{
                //  Console.WriteLine(r);
                //}
                Console.WriteLine("Thank you for your purchase!\nHere is your reservation code: {0}", reservationCode);
            }
            //clearing data list and deleting json shoppingcart file
            if (creditcardCheck == true)
            {
                Array.Clear(data, 0, data.Length);
                string filename = $"{user.username}-ShoppingCart.json";
                File.Delete(filename);
            }
            Navigation.CustomerNavigation(user);
        }