예제 #1
0
        private void Print_Movie(Hall hall, Session session)
        {
            Console.Clear();
            UI.Menu menu = new UI.Menu("Select hall");

            menu.menus.Add(Back());
            UI.MenuItem tmp = new UI.MenuItem();
            foreach (var item in dataBase.movies)
            {
                if (session == null)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = item.ToString(),
                        action = () => { Add_Session(hall, item); }
                    };
                }
                else
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = item.ToString(),
                        action = () => { Edit_Session(session, hall, item); }
                    };
                }
                // action += Pop_Back;



                menu.menus.Add(tmp);
            }
            Add_Back(menu);
            Pop_Back();
        }
예제 #2
0
 private UI.MenuItem Back()
 {
     UI.MenuItem back = new UI.MenuItem()
     {
         Text   = "Back              ",
         action = () => { Pop_Back(); }
     };
     return(back);
 }
예제 #3
0
 private void Main_Menu()
 {
     Console.Clear();
     UI.Menu     MainMenu = new UI.Menu("Main Menu");
     UI.MenuItem HallMenu = new UI.MenuItem()
     {
         Text   = "Hall menu      ",
         action = () => { Hall_Menu(); }
     };
     UI.MenuItem MovieMenu = new UI.MenuItem()
     {
         Text   = "Movie menu     ",
         action = () => { Movie_Menu(); }
     };
     UI.MenuItem TicketMenu = new UI.MenuItem()
     {
         Text   = "Ticket menu    ",
         action = () => Show_Movie("Select Movie")
     };
     UI.MenuItem StatisticsMenu = new UI.MenuItem()
     {
         Text   = "Statistics menu",
         action = () => Statistic_Menu()
     };
     UI.MenuItem SessionMenu = new UI.MenuItem()
     {
         Text   = "Session menu   ",
         action = () => { Session_Menu(); }
     };
     UI.MenuItem Exit = new UI.MenuItem()
     {
         Text   = "Exit           ",
         action = () => { Exit_save(); }
     };
     MainMenu.menus.Add(HallMenu);
     MainMenu.menus.Add(MovieMenu);
     MainMenu.menus.Add(SessionMenu);
     MainMenu.menus.Add(TicketMenu);
     MainMenu.menus.Add(StatisticsMenu);
     MainMenu.menus.Add(Exit);
     Add_Back(MainMenu);
     // MainMenu.Run();
 }
예제 #4
0
        private void Print_Hall(Session session)
        {
            Console.Clear();

            UI.Menu menu = new UI.Menu("Select hall");
            Action  action;

            menu.menus.Add(Back());
            foreach (var item in dataBase.halls)
            {
                UI.MenuItem tmp = new UI.MenuItem()
                {
                    Text   = item.ToString(),
                    action = () => { Print_Movie(item, session); }
                };

                menu.menus.Add(tmp);
            }
            Add_Back(menu);
        }
예제 #5
0
        private void Show_Hall(string str, Session session = null)
        {
            Console.Clear();
            UI.Menu ShowHall = new UI.Menu(str);


            ShowHall.menus.Add(Back());
            UI.MenuItem tmp = new UI.MenuItem();
            Action      action;

            foreach (Hall hall in dataBase.halls)
            {
                if (str == "Edit hall")
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = hall.ToString(),
                        action = () => { Edit_Hall(hall); }
                    };
                }
                else if (str == "Remove hall")
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = hall.ToString(),
                        action = () => { Remove_Hall(hall); }
                    };
                }
                else
                {
                    tmp = new UI.MenuItem()
                    {
                        Text = hall.ToString(),
                    };
                }
                ShowHall.menus.Add(tmp);
            }


            Add_Back(ShowHall);
        }
예제 #6
0
        private void Hall_Menu()
        {
            Console.Clear();

            UI.Menu HallMenu = new UI.Menu("Hall Menu");

            UI.MenuItem showAll = new UI.MenuItem()
            {
                Text   = "Show all halls    ",
                action = () => { Show_Hall("Show Hall"); }
            };
            UI.MenuItem AddHall = new UI.MenuItem()
            {
                Text   = "Add hall          ",
                action = () => { Add_Hall(); }
            };

            Action ac = () => Edit_Hall(null);

            UI.MenuItem EditHall = new UI.MenuItem()
            {
                Text   = "Edit hall         ",
                action = () => { Show_Hall("Edit hall"); }
            };


            UI.MenuItem RemoveHall = new UI.MenuItem()
            {
                Text   = "Remove hall       ",
                action = () => { Show_Hall("Remove hall"); }
            };

            HallMenu.menus.Add(showAll);
            HallMenu.menus.Add(AddHall);
            HallMenu.menus.Add(EditHall);
            HallMenu.menus.Add(RemoveHall);
            HallMenu.menus.Add(Back());
            Add_Back(HallMenu);
        }
예제 #7
0
        private void Session_Menu()
        {
            Console.Clear();

            UI.Menu SessionMenu = new UI.Menu("Session Menu");

            UI.MenuItem showAll = new UI.MenuItem()
            {
                Text   = "Show all Sessions    ",
                action = () => { Show_Session("Show Session"); }
            };
            UI.MenuItem AddSession = new UI.MenuItem()
            {
                Text   = "Add Session          ",
                action = () => { Print_Hall(null); }
            };

            //Action ac = () => Edit_Session(null);
            UI.MenuItem EditSession = new UI.MenuItem()
            {
                Text   = "Edit Session         ",
                action = () => { Show_Session("Edit Session"); }
            };


            UI.MenuItem RemoveSession = new UI.MenuItem()
            {
                Text   = "Remove Session       ",
                action = () => { Show_Session("Remove Session"); }
            };

            SessionMenu.menus.Add(showAll);
            SessionMenu.menus.Add(AddSession);
            SessionMenu.menus.Add(EditSession);
            SessionMenu.menus.Add(RemoveSession);
            SessionMenu.menus.Add(Back());
            Add_Back(SessionMenu);
        }
예제 #8
0
        private void Change_Movie(Movie movie)
        {
            UI.Menu Change = new UI.Menu($"Choose state for '{movie.title}'");

            UI.MenuItem Past = new UI.MenuItem()
            {
                Text   = "Past",
                action = () => { movie.ConditionStr = "Past"; }
            };
            UI.MenuItem Current = new UI.MenuItem()
            {
                Text   = "Current",
                action = () => { movie.ConditionStr = "Current"; }
            };
            UI.MenuItem Future = new UI.MenuItem()
            {
                Text   = "Future",
                action = () => { movie.ConditionStr = "Future"; }
            };

            switch (movie.ConditionStr)
            {
            case "Past": Past.IsCursor = true; break;

            case "Current": Current.IsCursor = true; break;

            case "Future": Future.IsCursor = true; break;

            default:
                break;
            }
            Change.menus.Add(Back());

            Change.menus.Add(Past);
            Change.menus.Add(Current);
            Change.menus.Add(Future);
            Add_Back(Change);
        }
예제 #9
0
        private void Movie_Menu()
        {
            Console.Clear();
            UI.Menu     MovieMenu     = new UI.Menu("Movie Menu");
            UI.MenuItem ShowAllMovies = new UI.MenuItem()
            {
                Text   = "Show all movies   ",
                action = () => { Show_Movie("Show movie"); }
            };
            UI.MenuItem AddMovies = new UI.MenuItem()
            {
                Text   = "Add movies        ",
                action = () => { Add_Movie(); }
            };
            UI.MenuItem EditMovies = new UI.MenuItem()
            {
                Text   = "Edit movies       ",
                action = () => { Show_Movie("Edit movie"); }
            };
            UI.MenuItem ChangeMovie = new UI.MenuItem()
            {
                Text   = "Change movie state",
                action = () => Show_Movie("Change Movie")
            };
            UI.MenuItem RemoveMovies = new UI.MenuItem()
            {
                Text   = "Remove movies     ",
                action = () => { Show_Movie("Remove movie"); }
            };

            MovieMenu.menus.Add(ShowAllMovies);
            MovieMenu.menus.Add(AddMovies);
            MovieMenu.menus.Add(EditMovies);
            MovieMenu.menus.Add(ChangeMovie);
            MovieMenu.menus.Add(RemoveMovies);
            MovieMenu.menus.Add(Back());
            Add_Back(MovieMenu);
        }
예제 #10
0
        private void Statistic_Menu()
        {
            Console.Clear();

            UI.Menu StatisticMenu = new UI.Menu("Statistic Menu");

            UI.MenuItem StatisticMovie = new UI.MenuItem()
            {
                Text   = "Statistic of Movie    ",
                action = () => { Show_Session("Statistic of Movie"); }
            };
            UI.MenuItem StatisticSesseoin = new UI.MenuItem()
            {
                Text   = "Statistic of Sesseoin",
                action = () => { Show_Session("Statistic of Sesseoin"); }
            };


            StatisticMenu.menus.Add(StatisticSesseoin);
            StatisticMenu.menus.Add(StatisticMovie);
            StatisticMenu.menus.Add(Back());
            Add_Back(StatisticMenu);
        }
예제 #11
0
        private void Show_Session(string str, Movie movie = null)
        {
            Console.Clear();
            UI.Menu ShowSession = new UI.Menu(str);


            ShowSession.menus.Add(Back());
            UI.MenuItem tmp = new UI.MenuItem();
            if (str == "Tecket Session")
            {
                var MovieTec = from ds in dataBase.sessions where ds.movie.title == movie.title select ds;
                MovieTec = from mt in MovieTec orderby mt.time.ToString().Sum(c => Convert.ToInt32(c)) select mt;

                foreach (Session session in MovieTec)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = session.ToString(),
                        action = () => { Ticket_Run(session); }
                    };

                    ShowSession.menus.Add(tmp);
                }
            }
            else if (str == "Statistic of Sesseoin")
            {
                foreach (Session session in dataBase.sessions)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = session.ToString(),
                        action = () => { Statistic_Session(session); }
                    };

                    ShowSession.menus.Add(tmp);
                }
            }
            else if (str == "Statistic of Movie")
            {
                foreach (Session session in dataBase.sessions)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = session.movie.ToString(),
                        action = () => { Statistic_Movie(session); }
                    };

                    ShowSession.menus.Add(tmp);
                }
            }
            else
            {
                foreach (Session session in dataBase.sessions)
                {
                    if (str == "Edit Session")
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text   = session.ToString(),
                            action = () => { Print_Hall(session); }
                        };
                    }
                    else if (str == "Remove Session")
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text   = session.ToString(),
                            action = () => { Remove_Session(session); }
                        };
                    }
                    else
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text = session.ToString(),
                        };
                    }


                    ShowSession.menus.Add(tmp);
                }
            }


            Add_Back(ShowSession);
        }
예제 #12
0
        private void Show_Movie(string str)
        {
            Console.Clear();
            UI.Menu ShowMovie = new UI.Menu(str);
            ShowMovie.menus.Add(Back());
            UI.MenuItem tmp = new UI.MenuItem();

            var Past = from dm in dataBase.movies where dm.ConditionStr == "Past" select dm;

            var Current = from dm in dataBase.movies where dm.ConditionStr == "Current" select dm as Movie;
            var Future  = from dm in dataBase.movies where dm.ConditionStr == "Future" select dm as Movie;

            if (str == "Show movie")
            {
                //Console.WriteLine(Past.ToString());
                if (Past != null)
                {
                    UI.MenuSeparator P_S = new MenuSeparator()
                    {
                        Text = "-Past-----------"
                    };
                    ShowMovie.menus.Add(P_S);
                    foreach (Movie movie in Past)
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text = movie.ToString(),
                            //action = () => { Edit_Movie(movie); }
                        };
                        ShowMovie.menus.Add(tmp);
                    }
                }


                UI.MenuSeparator P_C = new MenuSeparator()
                {
                    Text = "-Current-----------"
                };
                ShowMovie.menus.Add(P_C);
                foreach (Movie movie in Current)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text = movie.ToString(),
                        //action = () => { Edit_Movie(movie); }
                    };
                    ShowMovie.menus.Add(tmp);
                }

                UI.MenuSeparator P_F = new MenuSeparator()
                {
                    Text = "-Future-----------"
                };
                ShowMovie.menus.Add(P_F);
                foreach (Movie movie in Future)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text = movie.ToString(),
                        // action = () => { Edit_Movie(movie); }
                    };
                    ShowMovie.menus.Add(tmp);
                }
            }
            else if (str == "Select Movie")
            {
                foreach (Movie movie in Current)
                {
                    tmp = new UI.MenuItem()
                    {
                        Text   = movie.ToString(),
                        action = () => { Show_Session("Tecket Session", movie); }
                    };
                    ShowMovie.menus.Add(tmp);
                }
            }
            else
            {
                foreach (Movie movie in dataBase.movies)
                {
                    if (str == "Edit movie")
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text   = movie.ToString(),
                            action = () => { Edit_Movie(movie); }
                        };
                    }
                    else if (str == "Remove movie")
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text   = movie.ToString(),
                            action = () => { Remove_Movie(movie); }
                        };
                    }
                    else if (str == "Change Movie")
                    {
                        tmp = new UI.MenuItem()
                        {
                            Text   = movie.ToString(),
                            action = () => { Change_Movie(movie); }
                        };
                    }
                    ShowMovie.menus.Add(tmp);
                }
            }
            Add_Back(ShowMovie);
        }