Exemplo n.º 1
0
        static void Main(string[] args)
        {
            CheckForLateMovies = new System.Threading.Thread(delegate()
            {
                while (true)
                {
                    System.Threading.Thread.Sleep(10000);
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    BLLRentedMovie.CheckForLateMovies();
                    Console.ResetColor();
                }
            });
            //CheckForLateMovies.Start();

            System.Threading.Thread Main = new System.Threading.Thread(delegate()
            {
                while (true)
                {
                    Run();
                    if (userQuit)
                    {
                        break;
                    }
                }
            });
            Main.Start();
        }
Exemplo n.º 2
0
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            int  rentIDToReturn    = int.Parse(dropdown_rentedmovieids.SelectedValue);
            bool returnSuccessfull = BLLRentedMovie.RemoveRentedMovie(rentIDToReturn);

            lbl_resultMSG.Text =
                (returnSuccessfull ?
                 "movie returned successfully" :
                 "movie was not returned");
        }
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            int   movieToBeHiredID = int.Parse(dropdown_movieids.SelectedValue);
            Movie movieToBeHired   = BLLMovie.ReturnMovieWithID(movieToBeHiredID);

            int      customerThatsHiringID = int.Parse(dropdown_customerids.SelectedValue);
            Customer customerThatsHiring   = BLLCustomer.ReturnCustomerWithID(customerThatsHiringID);

            BLLRentedMovie.HireMovie(customerThatsHiring, movieToBeHired);
            lbl_resultMSG.Text = customerThatsHiring.CustomerName + " hired " + movieToBeHired.MovieName;
        }
Exemplo n.º 4
0
        private static void PrintRentedMovies()
        {
            List <RentedMovie> rentedMovies = BLLRentedMovie.ReturnAllRentedMovies();

            Console.WriteLine("*Rented Movies");
            Console.WriteLine();
            foreach (var rentedMovie in rentedMovies)
            {
                Console.WriteLine($"{rentedMovie.Movie.MovieName.ToUpper()} is currently with {rentedMovie.Customer.CustomerName.ToUpper()} \nLast day of return: {rentedMovie.ReturnDate.ToString("dd.MM.yyyy")}");
                Console.WriteLine();
            }
            Console.WriteLine("...............");
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List <RentedMovie> rentals = BLLRentedMovie.GetRentedMovies();//todo:
            StringBuilder      sb      = new StringBuilder();

            foreach (var r in rentals)
            {
                sb.Append(string.Format($"{r.RentedID}# {r.Movie.MovieName} hired by {r.Customer.CustomerName}"));
                sb.Append("<br/><br>");
                //POPULATE THE DROPBOX WITH THE RENTEDID's
                ListItem currentRentedMovie = new ListItem(r.RentedID + " " + r.Movie.MovieName + " (" + r.Customer.CustomerName + ")", r.RentedID.ToString());
                dropdown_rentedmovieids.Items.Add(currentRentedMovie);
            }

            hiredmoviesID.InnerHtml = sb.ToString();
        }
Exemplo n.º 6
0
        public void ListAllUnavailableMovies()
        {
            //retrieve all movies and list them in the html innertext element
            List <RentedMovie> movies = BLLRentedMovie.ReturnAllRentedMovies();

            StringBuilder sb = new StringBuilder();

            sb.Append("Unavailable Movies:");
            sb.Append("<br/><br/>");
            sb.Append("..............................");
            sb.Append("<br/><br/>");
            foreach (var movie in movies)
            {
                sb.Append(string.Format($"Title: {movie.Movie.MovieName} <br/>Director: {movie.Movie.MovieDirector} <br/>Genre: {movie.Movie.Genre.GenreName}"));
                sb.Append("<br/><br/>");
            }
            sb.Append("..............................");
            movieslisted.InnerHtml = sb.ToString();
        }
Exemplo n.º 7
0
        public static void Run()
        {
            Console.WriteLine("1. Print all Customers");
            Console.WriteLine("2. Register new customer");
            Console.WriteLine("3. Print movies (and currently hired movies)");
            Console.WriteLine("4. Hire Movie");
            Console.WriteLine("5. Return Movie");
            Console.WriteLine("6. Register New Movie");
            Console.WriteLine("e. Exit application");
            string choice = Console.ReadLine();

            switch (choice)
            {
            case "1":
                PrintCustomers();
                Console.ReadKey();
                Console.Clear();
                break;

            case "2":
                RegisterNewCustomer();
                Console.ReadKey();
                Console.Clear();
                break;

            case "3":
                PrintMovies();
                PrintRentedMovies();
                Console.ReadKey();
                Console.Clear();
                break;

            case "4":
                #region retrieve availabla movies to hire
                List <Movie> availableMovies = BLLMovie.ReturnAvailableMovies();   //TODO: returning movies that should not be available
                Console.WriteLine("Currently available movies: ");
                foreach (var m in availableMovies)
                {
                    Console.WriteLine(m.MovieId + " " + m.MovieName);
                }
                Console.WriteLine("Choose which movie to hire >> ");
                int   movieToBeHiredID = int.Parse(Console.ReadLine());
                Movie movieToBeHired   = BLLMovie.ReturnMovieWithID(movieToBeHiredID);

                Console.WriteLine(movieToBeHired.MovieName + " (" + movieToBeHired.Genre.GenreName + ") was choosen");
                Console.WriteLine();
                #endregion

                #region choose who will hire the movie
                List <Customer> customers = BLLCustomer.ReturnAllCustomers();
                foreach (var c in customers)
                {
                    Console.WriteLine(c.CustomerID + " " + c.CustomerName);
                }
                Console.Write("Who is going to make the hire >> ");
                int      customerThatsHiringID = int.Parse(Console.ReadLine());
                Customer customerThatsHiring   = BLLCustomer.ReturnCustomerWithID(customerThatsHiringID);
                #endregion

                BLLRentedMovie.HireMovie(customerThatsHiring, movieToBeHired);

                Console.WriteLine();
                Console.ReadKey();
                Console.Clear();
                break;

            case "5":
                List <RentedMovie> rentals = BLLRentedMovie.GetRentedMovies();   //todo:
                foreach (var rental in rentals)
                {
                    Console.WriteLine(rental.RentedID + " " + rental.Movie.MovieName + " HIRED BY: " + rental.Customer.CustomerName);
                }
                Console.Write("Which movie do you wish to return? >> ");
                int  rentIDToReturn    = int.Parse(Console.ReadLine());
                bool returnSuccessfull = BLLRentedMovie.RemoveRentedMovie(rentIDToReturn);
                Console.WriteLine(returnSuccessfull ? "movie returned successfully" : "movie was not returned");
                Console.ReadKey();
                Console.Clear();
                break;

            case "6":
                RegisterNewMovie();
                break;

            case "e":
                userQuit = true;
                Console.Clear();
                Console.WriteLine("Goodbye...");
                break;

            default:
                Console.WriteLine("Please enter a valid command");
                Console.ReadKey();
                Console.Clear();
                break;
            }
        }