public void UpdateMovieTest() { Movie movie = new Movie(); movie.Name = "Harry Potter and the Philosopher's Stone"; movie.Date = new DateTime(2001, 11, 4); movie.Producer = "Chris Columbus"; movie.Actors = "Daniel Radcliffe, Rupert Grint, Emma Watson"; movie.Genre = "fantasy"; movie.Duration = 152; MovieDAO movieDAO = new MovieDAO(); movieDAO.AddMovie(movie); List <Movie> list = movieDAO.GetMoviesByName(movie.Name); movie = list[list.Count - 1]; movie.Name = "Harry Potter 1"; movieDAO.UpdateMovie(movie); list = movieDAO.GetMoviesByName(movie.Name); string expected = ToStringWithoutId(movie); string actual = ToStringWithoutId(list[list.Count - 1]); Assert.AreEqual(expected, actual); }
//retorna uma nova instância de locação private Location GetNewLocation() { var location = new Location(); location.MovieList = MovieDAO.FindAll(); return(location); }
public void GetOrderDetail(string orderID) { OrderDAO orderDao = new OrderDAO(); ScheduleDAO scheduleDAO = new ScheduleDAO(); MovieDAO movieDAO = new MovieDAO(); OrderDTO order = orderDao.CheckOrder(orderID); if (order != null) { ScheduleDTO schedule = scheduleDAO.GetScheduleByID(order.ScheduleID); string movieTitle = movieDAO.GetMovieTitle(schedule.MovieID); this.orderDetail.Visible = true; this.lblOrderID.Text = order.OrderID; this.invalidCode.Visible = false; this.lbMovieName.Text = movieTitle; this.lbDate.Text = schedule.ScheduleDate.ToShortDateString(); this.lbTime.Text = schedule.ScheduleDate.ToShortTimeString(); this.lbRoom.Text = schedule.RoomID.ToString(); this.lbPrice.Text = (schedule.PriceOfTicket * (order.ListOfSeat).Count) + ""; string seat = ""; foreach (string s in order.ListOfSeat) { seat += (s + " "); } this.lbSeat.Text = seat; } else { this.invalidCode.CssClass = "error_message_show"; this.orderDetail.Visible = false; } }
private void frmTheatre_Load(object sender, EventArgs e) { ticketPrice = Times.TicketPrice; lblInformation.Text = "Team4H Cinema - Nhà văn hóa sinh viên | " + Times.CinemaName + " | " + Times.MovieName; lblTime.Text = Times.Time.ToShortDateString() + " | " + Times.Time.ToShortTimeString() + " - " + Times.Time.AddMinutes(Movie.Time).ToShortTimeString(); if (Movie.Poster != null) { picFilm.Image = MovieDAO.byteArrayToImage(Movie.Poster); } rdoAdult.Checked = true; chkCustomer.Enabled = false; grpLoaiVe.Enabled = false; LoadDataCinema(Times.CinemaName); ShowOrHideLablePoint(); listSeat = TicketDAO.GetListTicketsByShowTimes(Times.ID); LoadSeats(listSeat); }
private void MovieInfoWindow_Load(object sender, EventArgs e) { this.CenterToScreen(); MovieDAO movieDao = new MovieDAO(); Movie movie = movieDao.GetMovieData(movieId); pbMoviePoster.Image = (Image)AgileProject.Properties.Resources.ResourceManager.GetObject(movieId); lbMovieName.Text = movie.movieName; lbMovieYear.Text = movie.year.ToString(); lbMovieTime.Text = movie.movieLength.ToString() + " minutes"; lbGenre.Text = movie.genre; tbDescription.Text = movie.movieDescription; btnPurchase.Text = "$" + movie.purchasePrice.ToString() + " Buy"; Label[] lbCredits = { lbCredit1, lbCredit2, lbCredit3, lbCredit4 }; TextBox[] tbCredits = { tbCredit1, tbCredit2, tbCredit3, tbCredit4 }; String[] creditTitle = { "Actors", "Producers", "Directors", "Writers" }; String[] creditInfo = { movie.actors, movie.producers, movie.directors, movie.writers }; int i = 0; for (int j = 0; j < 4; j++) { if (creditInfo[j] != "") { lbCredits[i].Text = creditTitle[j]; tbCredits[i].Text = creditInfo[j]; i++; } } initializeButtons(); }
public ControllerClass(CinemaContext db) { hallDAO = new HallDAO(db); movieDAO = new MovieDAO(db); seanceDAO = new SeanceDAO(db); ticketDAO = new TicketDAO(db); view = new ViewClass(hallDAO.GetHalls(), hallDAO.GetSeats()); }
public ActorController() { //initializes the connection, so it doesn't keep having to go to the AppSettings string connection = ConfigurationManager.ConnectionStrings["DataSource"].ConnectionString; _actorDAO = new ActorDAO(connection); _movieDAO = new MovieDAO(connection); }
public ControllerClass() { hallDAO = new HallDAO(); movieDAO = new MovieDAO(); seanceDAO = new SeanceDAO(); ticketDAO = new TicketDAO(); fullTextSearch = new FullTextSearch(); view = new ViewClass(hallDAO.GetHalls(), hallDAO.GetSeats()); }
public ActionResult Index() { //se não tiver alguém logado retorna pra tela de login if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } return(View(MovieDAO.FindAll())); }
//PerformanceViewModel constructor public PerformancesViewModel() { //grab current Date/Time //dt = new DateTime(); //use predetermined Date/Time for demo purpose dt = new DateTime(2019, 01, 05); _dao = new MovieDAO(); }
private void txtFormatID_TextChanged(object sender, EventArgs e) { string movieID = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Mã phim"].Value; Movie movieSelecting = MovieDAO.GetMovieByID(movieID); //This is the Movie that we're currently selecting in dtgv if (movieSelecting == null) { return; } //cboFormat_MovieID.SelectedItem = movieSelecting; int indexMovie = -1; int iMovie = 0; foreach (Movie item in cboFormat_MovieID.Items) { if (item.Name == movieSelecting.Name) { indexMovie = iMovie; break; } iMovie++; } cboFormat_MovieID.SelectedIndex = indexMovie; string screenName = (string)dtgvFormat.SelectedCells[0].OwningRow.Cells["Tên MH"].Value; ScreenType screenTypeSelecting = ScreenTypeDAO.GetScreenTypeByName(screenName); //This is the ScreenType that we're currently selecting in dtgv if (screenTypeSelecting == null) { return; } //cboFormat_ScreenID.SelectedItem = screenTypeSelecting; int indexScreen = -1; int iScreen = 0; foreach (ScreenType item in cboFormat_ScreenID.Items) { if (item.Name == screenTypeSelecting.Name) { indexScreen = iScreen; break; } iScreen++; } cboFormat_ScreenID.SelectedIndex = indexScreen; }
public DataManager() { var context = new DataModelContainer(); _userDAO = new UserDAO(context); _movieDAO = new MovieDAO(context); _ratingDAO = new RatingDAO(context); _commentDAO = new CommentDAO(context); var includeThisDllPleaseDotNet = typeof(System.Data.Entity.SqlServer.SqlProviderServices); }
void DeleteMovie(string id) { if (MovieDAO.DeleteMovie(id)) { MessageBox.Show("Xóa phim thành công"); } else { MessageBox.Show("Xóa phim thất bại"); } }
void InsertMovie(string id, string name, string desc, float length, DateTime startDate, DateTime endDate, string productor, string director, int year, byte[] image) { if (MovieDAO.InsertMovie(id, name, desc, length, startDate, endDate, productor, director, year, image)) { MessageBox.Show("Thêm phim thành công"); } else { MessageBox.Show("Thêm phim thất bại"); } }
private void BillingFormWindow_Load(object sender, EventArgs e) { this.CenterToScreen(); MovieDAO movieDAO = new MovieDAO(); Movie movie = movieDAO.GetMovieData(movieId); pbMoviePoster.Image = (Image)Properties.Resources.ResourceManager.GetObject(movieId); lblMovieName.Text = movie.movieName; lblGenre.Text = movie.genre; lblPrice.Text = "$" + movie.purchasePrice.ToString(); }
public List <MovieDTO> GetMovieByDay(DateTime date) { try { MovieDAO movieDAO = new MovieDAO(); return(movieDAO.GetMovieByDay(date)); } catch (Exception ex) { throw ex; } }
public DataTable GetMoviesAvailable() { try { MovieDAO movieDAO = new MovieDAO(); return(movieDAO.GetMoviesAvailable()); } catch (Exception ex) { throw ex; } }
private void PlayerWindow_Load(object sender, EventArgs e) { this.CenterToScreen(); loading.Location = new Point(this.Width / 2 - 25, this.Height / 2 - 100); MovieDAO movieDAO = new MovieDAO(); Movie movie = movieDAO.GetMovieData(movieId); pbMoviePoster.Image = (Image)Properties.Resources.ResourceManager.GetObject(movieId); lblMovieName.Text = movie.movieName; time.Text = TimeSpan.FromMinutes(movie.movieLength).ToString(@"hh\:mm\:ss"); }
public ActionResult Update(int Id) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } ViewBag.Genre = GenreDAO.FindAll(); //retorna para a view o objeto a ser atualizado return(View("Insert", MovieDAO.FindById(Id))); }
static void Main(string[] args) { MovieDAO dao = new MovieDAO(); DateTime date = DateTime.Now.AddDays(-1); List <MovieDTO> movies = dao.GetMovieByDay(date); foreach (MovieDTO mv in movies) { Console.WriteLine($"{mv.MovieName}"); } Console.ReadLine(); }
public ActionResult Insert() { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } var location = new Location(); location.MovieList = MovieDAO.FindAll(); return(View(GetNewLocation())); }
public ActionResult Insert(Movie movie) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } if (ModelState.IsValid) { //insere novo ou edita filme no DB MovieDAO.Insert(movie); return(View("Index", MovieDAO.FindAll())); } ViewBag.Genre = GenreDAO.FindAll(); return(View("Insert", movie)); }
private void Form1_Load(object sender, EventArgs e) { this.CenterToScreen(); if (accountId == 0) { this.Close(); } Account account = (new UserDAO()).GetAccountInfo(accountId); lbUserName.Text = account.firstName + " " + account.lastName; MovieDAO movieDAO = new MovieDAO(); loadMovies(movieDAO.GetAllMovieList()); loadGenres(movieDAO.GetGenreStringList()); }
public DAOStorage( CompanyDAO companyDAO, FormatDAO formatDAO, GenreDAO genreDAO, PosterDAO posterDAO, QualityDAO qualityDAO, MovieDAO movieDAO, PosterImageDAO posterImageDAO ) { CompanyDAO = companyDAO; FormatDAO = formatDAO; GenreDAO = genreDAO; PosterDAO = posterDAO; QualityDAO = qualityDAO; MovieDAO = movieDAO; PosterImageDAO = posterImageDAO; }
public ActionResult Delete(int[] Id) { if (Session["username"] == null) { return(RedirectToAction("../Login/Index")); } if (Id == null) { ModelState.AddModelError("", "Nenhum item foi selecionado para deletar"); } if (ModelState.IsValid) { MovieDAO.Delete(Id); } return(View("Index", MovieDAO.FindAll())); }
public void GetMoviesByNameTest() { Movie movie = new Movie(); movie.Name = "Cinderella"; movie.Date = new DateTime(1950, 2, 15); movie.Producer = "Clyde Geronimi, Hamilton Luske, Wilfred Jackson"; movie.Actors = "Ilene Woods, Eleanor Audley, Verna Felton"; movie.Genre = "animated, musical, fantasy"; movie.Duration = 75; MovieDAO movieDAO = new MovieDAO(); movieDAO.AddMovie(movie); List <string> expected = new List <string>(); expected.Add(ToStringWithoutId(movie)); movie = new Movie(); movie.Name = "Cinderella"; movie.Date = new DateTime(2015, 2, 13); movie.Producer = "Kenneth Branagh"; movie.Actors = "Cate Blanchett, Lily James, Richard Madden"; movie.Genre = "romantic, fantasy"; movie.Duration = 106; movieDAO.AddMovie(movie); expected.Add(ToStringWithoutId(movie)); List <Movie> list = movieDAO.GetMoviesByName(movie.Name); if (list == null || list.Count < 2) { Assert.Fail(); } List <string> actual = new List <string>(); for (int i = list.Count - 2; i < list.Count; i++) { actual.Add(ToStringWithoutId(list[i])); } CollectionAssert.AreEqual(expected, actual); }
public void GetMoviesByProducerTest() { Movie movie = new Movie(); movie.Name = "Harry Potter and the Philosopher's Stone"; movie.Date = new DateTime(2001, 11, 4); movie.Producer = "Chris Columbus"; movie.Actors = "Daniel Radcliffe, Rupert Grint, Emma Watson"; movie.Genre = "fantasy"; movie.Duration = 152; MovieDAO movieDAO = new MovieDAO(); movieDAO.AddMovie(movie); List <string> expected = new List <string>(); expected.Add(ToStringWithoutId(movie)); movie = new Movie(); movie.Name = "Harry Potter and the Chamber of Secrets"; movie.Date = new DateTime(2002, 11, 3); movie.Producer = "Chris Columbus"; movie.Actors = "Daniel Radcliffe, Rupert Grint, Emma Watson"; movie.Genre = "fantasy"; movie.Duration = 161; movieDAO.AddMovie(movie); expected.Add(ToStringWithoutId(movie)); List <Movie> list = movieDAO.GetMoviesByProducer(movie.Producer); if (list == null || list.Count < 2) { Assert.Fail(); } List <string> actual = new List <string>(); for (int i = list.Count - 2; i < list.Count; i++) { actual.Add(ToStringWithoutId(list[i])); } CollectionAssert.AreEqual(expected, actual); }
public void DeleteMovieTest() { Movie movie = new Movie(); movie.Name = "Harry Potter and the Philosopher's Stone"; movie.Date = new DateTime(2001, 11, 4); movie.Producer = "Chris Columbus"; movie.Actors = "Daniel Radcliffe, Rupert Grint, Emma Watson"; movie.Genre = "fantasy"; movie.Duration = 152; MovieDAO movieDAO = new MovieDAO(); movieDAO.AddMovie(movie); List <Movie> list = movieDAO.GetMoviesByName(movie.Name); movie = list[list.Count - 1]; movieDAO.DeleteMovie(movie.Id); list = movieDAO.GetMoviesByName(movie.Name); Assert.IsFalse(list.Exists(l => l.Id == movie.Id)); }
private void txtMovieID_TextChanged(object sender, EventArgs e) //Use to binding the CheckedListBox Genre of Movie and picture of Movie { picFilm.Image = null; for (int i = 0; i < clbMovieGenre.Items.Count; i++) { clbMovieGenre.SetItemChecked(i, false); //Uncheck all CheckBox first } List <Genre> listGenreOfMovie = MovieByGenreDAO.GetListGenreByMovieID(txtMovieID.Text); for (int i = 0; i < clbMovieGenre.Items.Count; i++) { Genre genre = (Genre)clbMovieGenre.Items[i]; foreach (Genre item in listGenreOfMovie) { if (genre.ID == item.ID) { clbMovieGenre.SetItemChecked(i, true); break; } } } Movie movie = MovieDAO.GetMovieByID(txtMovieID.Text); if (movie == null) { return; } if (movie.Poster != null) { picFilm.Image = MovieDAO.byteArrayToImage(movie.Poster); } }
void LoadMovieList() { movieList.DataSource = MovieDAO.GetMovie(); }