public void AddAiring(AiringMovie airingMovie) { try { using (var connection = new SqlConnection(_dbConnectionString)) { connection.Open(); SqlCommand cmd = new SqlCommand("AddAiring", connection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add(new SqlParameter("@RoomId", airingMovie.Room.Number)); cmd.Parameters.Add(new SqlParameter("@AiringTime", airingMovie.AiringTime)); cmd.Parameters.Add(new SqlParameter("@MovieId", airingMovie.Movie.Id)); cmd.ExecuteNonQuery(); } } catch (Exception ex) { //File.AppendAllText(, message); Console.WriteLine(ex.ToString()); } }
public void GetOccupiedSeats(AiringMovie airingMovie) { try { using (var connection = new SqlConnection(_dbConnectionString)) { connection.Open(); var cmd = new SqlCommand("GetOccupiedSeats", connection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add(new SqlParameter("@AiringMovieId", airingMovie.Id)); var reader = cmd.ExecuteReader(); while (reader.Read()) { airingMovie.Room.Seats.First(s => s.SeatNumber == (int)reader["SeatNumber"]).IsOccupied = true; } } } catch (Exception ex) { //File.AppendAllText(, message); Console.WriteLine(ex.ToString()); } }
private void AddAiringMovie(AiringMovie airingMovie, DateTime date) { const int timeForCleaningInMinutes = 60; airingMovie.AiringTime = airingMovie.AiringTime.AddMinutes(timeForCleaningInMinutes); _repo.AddAiring(airingMovie); }
private AiringMovie FirstAiringOfTheDay(Movie movie, DateTime date, Room room) { var earliestAiringTime = new DateTime(date.Year, date.Month, date.Day, 11, 0, 0); var airing = new AiringMovie { AiringTime = earliestAiringTime, Movie = movie, Room = room }; return(airing); }
private void AddMovieDetailsToAiringMovie(AiringMovie airingMovie) { var movieId = airingMovie.Movie.Id; if (movieId == -1) { return; } var movieLogic = new MovieLogic(new MovieContext(), new RoomContext(), new ApiHelper(), new AiringMovieContext()); airingMovie.Movie = movieLogic.GetMovieById(movieId); }
public AiringMovie GetAiringById(int id) { var airingMovie = new AiringMovie(); try { using (var connection = new SqlConnection(_dbConnectionString)) { connection.Open(); var cmd = new SqlCommand("GetAiringById", connection) { CommandType = CommandType.StoredProcedure }; cmd.Parameters.Add(new SqlParameter("@PlanningId", id)); var reader = cmd.ExecuteReader(); while (reader.Read()) { airingMovie = new AiringMovie { Id = (int)reader["AiringID"], AiringTime = (DateTime)reader["AiringTime"], Room = new Room((int)reader["RoomNumber"], reader["RoomType"].ToString(), (int)reader["AvailablePlaces"], (int)reader["SeatsPerRow"]), Price = (decimal)reader["Price"], Movie = new Movie { Id = (int)reader["MovieId"] } }; } } } catch (Exception ex) { //File.AppendAllText(, message); Console.WriteLine(ex.ToString()); } return(airingMovie); }
public void DeleteAiring(AiringMovie airing) { try { using (var connection = new SqlConnection(_dbConnectionString)) { connection.Open(); var sqlCommand = new SqlCommand($"DeleteAiring", connection) { CommandType = CommandType.StoredProcedure }; sqlCommand.Parameters.AddWithValue("@AiringId", airing.Id); sqlCommand.ExecuteNonQuery(); } } catch (Exception ex) { //File.AppendAllText(, message); Console.WriteLine(ex.ToString()); } }
public IActionResult Index(AiringMovie model) { var airing = _transactionLogic.GetAiringMovieById(model.Id); return(View("Index", airing)); }
public IActionResult GoToReservationPage([FromBody] AiringMovie airing) { return(new JsonResult(new { response = "Redirect", url = Url.Action("Index", "Transaction", airing) })); }
/// <summary> /// DO NUT USE! NOT IMPLEMENTED /// </summary> /// <param name="airing"></param> public void DeleteAiring(AiringMovie airing) { throw new NotImplementedException(); }
/// <summary> /// DOES NOTHING! /// </summary> /// <param name="airingMovie"></param> public void AddAiring(AiringMovie airingMovie) { return; }
public void AddAiring(AiringMovie airingMovie) { _context.AddAiring(airingMovie); }
public void AddOccupiedSeats(AiringMovie airingMovie) { _context.GetOccupiedSeats(airingMovie); }
public void DeleteAiring(AiringMovie airing) { _repo.DeleteAiring(airing); }
public void AddMovieDetailsToAiringMovie2(AiringMovie airingMovie) { AddMovieDetailsToAiringMovie(airingMovie); }
public void DeleteAiring(AiringMovie airing) { _airingMovieLogic.DeleteAiring(airing); }
public IActionResult DeleteAiring([FromBody] AiringMovie airing) { _movieLogic.DeleteAiring(airing); return(new JsonResult(new{ message = $"Deleted airing {airing.AiringTime} for {airing.Movie.Title}" })); }
public void DeleteAiring(AiringMovie airing) { _context.DeleteAiring(airing); }