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));
        }
Exemple #2
0
        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 static 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));
        }
Exemple #4
0
 public AuditoriumImportService()
 {
     this.auditoriumService   = new AuditoriumService();
     this.auditoriumValidator = new AuditoriumValidator(auditoriumService);
     this.cinemaService       = new CinemaService();
     this.cinemaValidator     = new CinemaValidator(cinemaService);
     this.townService         = new TownService();
     this.townValidator       = new TownValidator(townService);
 }
 public ScreeningImportService()
 {
     this.auditoriumService   = new AuditoriumService();
     this.cinemaService       = new CinemaService();
     this.auditoriumValidator = new AuditoriumValidator(auditoriumService);
     this.cinemaValidator     = new CinemaValidator(cinemaService);
     this.movieService        = new MovieService();
     this.movieValidator      = new MovieValidator(movieService);
     this.townService         = new TownService();
     this.townValidator       = new TownValidator(townService);
     this.screeningService    = new ScreeningService();
     this.screeningValidator  = new ScreeningValidator(screeningService);
 }