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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        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));
        }
Ejemplo n.º 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);
 }
        private static 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));
        }
Ejemplo n.º 7
0
 public CinemaImportService()
 {
     this.cinemaService   = new CinemaService();
     this.cinemaValidator = new CinemaValidator(cinemaService);
     this.townService     = new TownService();
 }