private void ImportSeat(SeatDto seatDto) { string cinemaTown = seatDto.CinemaTown; townValidator.CheckTownExisting(cinemaTown); int townId = townService.GetTownId(cinemaTown); string cinemaName = seatDto.CinemaName; cinemaValidator.CheckCinemaExisting(cinemaName, townId); int cinemaId = cinemaService.GetCinemaId(cinemaName, townId); byte auditoriumNumber = seatDto.AuditoriumNumber; auditoriumValidator.CheckAuditoriumExists(auditoriumNumber, cinemaId, cinemaName); int auditoriumId = auditoriumService.GetAuditoriumId(auditoriumNumber, cinemaId); int row = seatDto.Row; int number = seatDto.Number; seatValidator.ValidateSeatDoesntExist(number, auditoriumId, auditoriumNumber); seatService.AddSeat(number, row, auditoriumId); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.SeatAddedSuccess, number, auditoriumNumber, cinemaName, cinemaTown)); }
private static void ImportAuditorium(AuditoriumDTO auditoriumDto) { string cinemaName = auditoriumDto.CinemaName; InputDataValidator.ValidateStringMaxLength(cinemaName, Constants.MaxCinemaNameLength); string townName = auditoriumDto.CinemaTownName; TownValidator.CheckTownExisting(townName); int townId = TownService.GetTownId(townName); int cinemaId = CinemaService.GetCinemaId(cinemaName, townId); CinemaValidator.CheckCinemaExisting(cinemaName, townId); byte number = auditoriumDto.Number; AuditoriumValidator.ValidateAuditoriumDoesNotExist(number, cinemaId, cinemaName); AuditoriumService.AddAuditorium(number, cinemaId); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.AuditoriumAddedSuccess, number, cinemaName, townName)); }
public static void ImportScreening(ScreeeningDto screeningDto) { byte auditoriumNumber = screeningDto.AuditoriumNumber; string cinemaTown = screeningDto.CinemaTown; TownValidator.CheckTownExisting(cinemaTown); int townId = TownService.GetTownId(cinemaTown); string cinemaName = screeningDto.CinemaName; CinemaValidator.CheckCinemaExisting(cinemaName, townId); int cinemaId = CinemaService.GetCinemaId(cinemaName, townId); AuditoriumValidator.CheckAuditoriumExists(auditoriumNumber, cinemaId, cinemaName); string movieName = screeningDto.MovieName; int movieReleaseYear = screeningDto.MovieReleaseYear; MovieValidator.CheckMovieExists(movieName, movieReleaseYear); int auditoriumId = AuditoriumService.GetAuditoriumId(auditoriumNumber, cinemaId); DateTime date = screeningDto.Date; ScreeningValidator.ValidateScreeningDoesntExist(auditoriumId, date); int movieId = MovieService.GetMovieId(movieName, movieReleaseYear); ScreeningService.AddScreening(auditoriumId, movieId, date); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.ScreeningAddedSuccess, auditoriumNumber, cinemaName)); }
private void ImportCinema(CinemaDto cinemaDto) { string townName = cinemaDto.TownName; InputDataValidator.ValidateStringMaxLength(townName, Constants.MaxTownNameLength); string cinemaName = cinemaDto.Name; InputDataValidator.ValidateStringMaxLength(cinemaName, Constants.MaxCinemaNameLength); townService.AddTownIfNotExisting(townName); int townId = townService.GetTownId(townName); cinemaValidator.ValidateCinemaDoesNotExist(cinemaName, townId); cinemaService.AddCinema(cinemaName, townId); Console.WriteLine(string.Format(Constants.ImportSuccessMessages.CinemaAddedSuccess, cinemaName)); }