Exemple #1
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     id = results.First(x => x.Title == lbResults.SelectedItem.ToString().CutToLast(' ', CutDirection.Right, true)).Id;
     if (id != null)
         DialogResult = System.Windows.Forms.DialogResult.OK;
     this.Close();
 }
Exemple #2
0
 public void CreateScreeeningnodate()
 {
     CreateScreeening.Click();
     MovieId.SendKeys("2");
     DateTime1.SendKeys(RandomDate().ToString("dd/MM/yyyy,"));
     CreateButton.Click();
 }
        public MovieWriter(string filepath, MovieId id, bool UseExistingFile)
        {
            file = new FileInfo(filepath);

            if (file.Exists && UseExistingFile)
            {
                using (FileStream input = new FileStream(filepath, FileMode.Open, FileAccess.Read))
                    fs = new FrameScanner(input);

                if (fs.HeaderOkay)
                    output = new FileStream(filepath, FileMode.Open, FileAccess.ReadWrite);
            }
            else
            {
                output = new FileStream(filepath, FileMode.Create, FileAccess.Write);
                output.Write(Encoding.ASCII.GetBytes("MMDb"), 0, 4);
                output.WriteByte((byte)FileVersions.First.Major);
                output.WriteByte((byte)FileVersions.First.Minor);
                output.Write(BitConverter.GetBytes(id.Id), 0, 4);
                output.Close();

                using (FileStream input = new FileStream(filepath, FileMode.Open, FileAccess.Read))
                    fs = new FrameScanner(input);

                output = new FileStream(filepath, FileMode.Open, FileAccess.Write);
            }
        }
 public TVSeriesEpisodesPage(string html, URL request, URL response, MovieId id)
     : base(html, request, response, id)
 {
     this.SeasonNumber = new ParsedInfo<int>(html, parseSeason);
     this.Episodes = new ParsedCollection<EpisodeInfo>(parseEpisodes(html));
     this.episodePages = new Dictionary<int, TVEpisodeMainPage>();
 }
Exemple #5
0
 public override int GetHashCode()
 {
     unchecked
     {
         return((MovieId.GetHashCode() * 397) ^ Rating);
     }
 }
Exemple #6
0
 public string GetPrettyTitleLink()
 {
     if (Title == null)
     {
         return(MovieId.ToString());
     }
     return(HttpUtility.UrlEncode(Title.ToLower().Replace(' ', '-')));
 }
Exemple #7
0
        public static Schedule Create(EntityId id, CinemaId cinemaId, MovieId movieId)
        {
            var schedule = new Schedule(id, cinemaId, movieId);

            schedule.AddDomainEvent(new ScheduleAdded(schedule));
            schedule.Version = 1;
            return(schedule);
        }
Exemple #8
0
 public Schedule(EntityId id, CinemaId cinemaId, MovieId movieId, IEnumerable <Show> shows = null, int?version = null)
     : base(id)
 {
     CinemaId = cinemaId ?? throw new EmptyScheduleCinemaException(id);
     MovieId  = movieId ?? throw new EmptyScheduleMovieException(id);
     _shows   = shows is null ? new HashSet <Show>() : shows.ToHashSet();
     Version  = version ?? 1;
 }
Exemple #9
0
 private void Apply(DailyProgrammingCreated @event)
 {
     Id       = @event.AggregateId;
     movieId  = @event.MovieId;
     screenId = @event.ScreenId;
     date     = @event.Date;
     seats    = @event.Seats.ToEntity(SeatState.Free);
 }
 public SearchResult(MovieId id, string title, int year, MediaType type, MatchType match)
 {
     this.id = id;
     this.title = title;
     this.year = year;
     this.type = type;
     this.match = match;
 }
Exemple #11
0
        public bool Equals(BulkMoveMovie other)
        {
            if (other == null)
            {
                return(false);
            }

            return(MovieId.Equals(other.MovieId));
        }
Exemple #12
0
 public CreateDailyProgramming(DailyProgrammingId aggregateId, MovieId movieId, ScreenId screenId, DateTime date, IEnumerable <Dtos.Seat> seats, string movieTitle, string screenName) : base(aggregateId)
 {
     MovieId    = movieId;
     ScreenId   = screenId;
     Date       = date;
     Seats      = seats;
     MovieTitle = movieTitle;
     ScreenName = screenName;
 }
 public DailyProgrammingCreated(DailyProgrammingId aggregateId, MovieId movieId, ScreenId screenId, DateTime date, IEnumerable <Dtos.Seat> seats, string movieTitle, string screenName, string who = "anonymous")
     : base(aggregateId, who)
 {
     MovieId    = movieId;
     ScreenId   = screenId;
     Date       = date;
     Seats      = seats;
     MovieTitle = movieTitle;
     ScreenName = screenName;
 }
        public async Task DeleteMovie(MovieId movieId, CancellationToken cancellationToken)
        {
            var filter       = BuildMovieFilter(movieId);
            var deleteResult = await collection.DeleteOneAsync(filter, cancellationToken);

            if (deleteResult.DeletedCount != 1)
            {
                throw new NotFoundException($"The movie with id {movieId} was not found among movies to see (DeletedCount = {deleteResult.DeletedCount})");
            }
        }
        public TVEpisodeMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
            : base(html, request, response, id, genreCollection)
        {
            AirDate = new ParsedInfo<DateTime>(html, parseDate);
            Episode = new ParsedInfo<int>(html, parseEpisode);
            Season = new ParsedInfo<int>(html, parseSeason);
            this.EpisodeTitle = new ParsedInfo<string>(html, parseEpisodeTitle);
            this.SeriesTitle = new ParsedInfo<string>(html, parseSeriesTitle);

            seriesID = parseSeries(html);
        }
Exemple #16
0
 public void CreateScreeeningEditButton()
 {
     CreateScreeening.Click();
     MovieId.SendKeys("2");
     DateTime1.SendKeys(RandomDate().ToString("dd/MM/yyyy, 15:15"));
     CreateButton.Click();
     EditCreateScreeningButton.Click();
     dateTime1.Clear();
     dateTime1.SendKeys(RandomDate().ToString("dd/MM/yyyy HH:00"));
     SaveButton.Click();
 }
Exemple #17
0
        public async Task <IActionResult> GetMovie(string Id, CancellationToken cancellationToken)
        {
            if (string.IsNullOrEmpty(Id))
            {
                return(BadRequest(nameof(NullReferenceException)));
            }

            var result = await _movieQueryService.GetMovieByIdAsync(MovieId.With(Guid.Parse(Id)), cancellationToken);

            return(new JsonResult(result));
        }
Exemple #18
0
        public MovieReader(string filepath)
        {
            file = new FileInfo(filepath);

            if (file.Exists)
            {
                input = new FileStream(filepath, FileMode.Open, FileAccess.Read);
                fs = new FrameScanner(input);
                this.id = new MovieId(fs.Id);
            }
            else
                this.id = new MovieId();
        }
        private int generateHashCode()
        {
            //THis is expensive and should be done only once since it will not be changing
            //TODO - use / include the "correct" id..
            String key = this.GetType().Name + MovieCollectionId.ToString() + MovieId.ToString();

            //Google: "disable fips mode" if the line below fails
            System.Security.Cryptography.MD5 md5Hasher = System.Security.Cryptography.MD5.Create();
            var hashed = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(key));
            int ivalue = BitConverter.ToInt32(hashed, 0);

            return(ivalue);
        }
Exemple #20
0
 private void btnPreview_Click(object sender, EventArgs e)
 {
     Cursor.Current = Cursors.WaitCursor;
     WebClient web = new WebClient();
     id = results.First(x => x.Title == lbResults.SelectedItem.ToString().CutToLast(' ', CutDirection.Right, true)).Id;
     IMDBBuffer buffer = new IMDBBuffer();
     MainPage page = buffer.ReadMain(id);
     if (page.PosterURL.Succes == false)
         Properties.Resources.no_photo.Save("temp");
     else web.DownloadFile(page.PosterURL.Data.Address, "temp");
     ImagePreview preview = new ImagePreview("temp");
     Cursor.Current = Cursors.Default;
     preview.ShowDialog();
 }
Exemple #21
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj.GetType() != GetType())
            {
                return(false);
            }

            return(MovieId.Equals(((BulkMoveMovie)obj).MovieId));
        }
Exemple #22
0
        public MainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
            : base(html, request, response, id)
        {
            this.Title = new ParsedInfo<string>(html, parseTitle);
            this.Year = new ParsedInfo<int>(html, parseYear);
            this.PosterURL = new ParsedInfo<URL>(html, parsePosterURL);

            this.IMDbRating = new ParsedInfo<Rating>(html, parseIMDBRating);
            this.MetacriticRating = new ParsedInfo<Rating>(html, parseMetacriticRating);

            this.Tagline = new ParsedInfo<string>(html, parseTagline);
            this.Plot = new ParsedInfo<string>(html, parsePlot);
            this.Runtime = new ParsedInfo<TimeSpan>(html, parseRuntime);

            this.Genres = new ParsedInfo<GenreSet>(html, (input) => parseGenres(input, genreCollection));
        }
        public async Task MoveToMoviesToSee(MovieId movieId, CancellationToken cancellationToken)
        {
            logger.LogInformation("Moving movie {MovieId} to movies to see ...", movieId);

            var movieToGet = await moviesToGetRepository.GetMovie(movieId, cancellationToken);

            var movieToSee = new MovieToSeeModel
            {
                TimestampOfAddingToSeeList = clock.Now,
                MovieInfo = movieToGet.MovieInfo,
            };

            await moviesToSeeRepository.AddMovie(movieToSee, cancellationToken);

            await moviesToGetRepository.DeleteMovie(movieId, cancellationToken);
        }
Exemple #24
0
        public List <MovieId> AddMovie(NewMovie toAdd)
        {
            List <MovieId> addedMovies = new List <MovieId>();

            for (int i = 0; i < toAdd.Qty; i++)
            {
                var addMovieStringQuery = $"INSERT INTO {DatabaseUtils.Databasename}.movieinfo(MOV_INFO_TITLE, MOV_INFO_RELEASE_YEAR, MOV_INFO_GENRE, MOV_INFO_UPC, MOV_STATUS) " +
                                          $"VALUES('{toAdd.Title}', '{toAdd.ReleaseYear}', '{toAdd.Genre}', '{toAdd.Upc}', 0)";

                var     addMovie   = DatabaseUtils.Instance();
                MovieId addedMovie = new MovieId();
                addedMovie.Id = addMovie.MakeDbQuery(addMovieStringQuery, true);
                addedMovies.Add(addedMovie);
            }

            return(addedMovies);
        }
Exemple #25
0
        public bool Equals(MovieStat other)
        {
            //Check whether the compared object is null.
            if (MovieStat.ReferenceEquals(other, null))
            {
                return(false);
            }

            //Check whether the compared object references the same data.
            if (MovieStat.ReferenceEquals(this, other))
            {
                return(true);
            }

            //Check whether the MovieStat' properties are equal.
            return(MovieId.Equals(other.MovieId));
        }
Exemple #26
0
        public async Task DeleteMovie_MovieDoesNotExist_ThrowsNotFoundException()
        {
            // Arrange

            var serviceProvider = await BootstrapTests(seedData : true);

            var target = serviceProvider.GetRequiredService <IMoviesToSeeService>();

            var movieId = new MovieId("5ea68c4477f3ed42b8a798da");

            // Act

            Func <Task> call = () => target.DeleteMovie(movieId, CancellationToken.None);

            // Assert

            await call.Should().ThrowAsync <NotFoundException>();
        }
        public async Task <MovieToSeeModel> GetMovie(MovieId movieId, CancellationToken cancellationToken)
        {
            var filter = BuildMovieFilter(movieId);

            var options = new FindOptions <MovieToSeeDocument>
            {
                Limit = 1,
            };

            var cursor = await collection.FindAsync(filter, options, cancellationToken);

            var document = await cursor.FirstOrDefaultAsync(cancellationToken);

            if (document == null)
            {
                throw new NotFoundException($"The movie with id {movieId} was not found among movies to see");
            }

            return(document.ToModel());
        }
Exemple #28
0
        public async Task <Reservation> CreateAsync(EntityId id, CinemaId cinemaId, MovieId movieId, HallId hallId, CustomerId customerId,
                                                    DateTime dateTime, bool isPaymentUponArrival, IEnumerable <Seat> seats, Reservee reservee)
        {
            var areSeatsValid = await _validator.ValidateAsync(cinemaId, movieId, hallId, seats);

            if (!areSeatsValid)
            {
                throw new SeatsAlreadyReservedException(id);
            }

            if (!customerId.IsEmpty())
            {
                reservee = await _provider.GetAsync(customerId);
            }

            var status      = isPaymentUponArrival ? ReservationStatus.PaymentUponArrival : ReservationStatus.Pending;
            var reservation = Reservation.Create(id, cinemaId, movieId, hallId, dateTime, status, reservee, seats);

            return(reservation);
        }
Exemple #29
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MovieId.Length != 0)
            {
                hash ^= MovieId.GetHashCode();
            }
            if (MovieName.Length != 0)
            {
                hash ^= MovieName.GetHashCode();
            }
            if (MoviePrice.Length != 0)
            {
                hash ^= MoviePrice.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #30
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (MovieId != 0)
            {
                hash ^= MovieId.GetHashCode();
            }
            if (Title.Length != 0)
            {
                hash ^= Title.GetHashCode();
            }
            if (Price != 0D)
            {
                hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Price);
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
Exemple #31
0
 public MovieNotFoundException(MovieId movieId) : base($"Movie with id {movieId} was not found")
 {
 }
 public SearchResult(MovieId id, string title, int year, string type, MatchType match)
     : this(id, title, year, ParseResultType(type.ToLower()), match)
 {
 }
Exemple #33
0
 public MovieInfo(MovieId id)
 {
     this.id = id;
 }
 public ExtraInfoPage(string html, URL request, URL response, MovieId id)
     : base(html, request, response, id)
 {
     this.Title = new ParsedInfo<string>(html, parseStandardTitle);
 }
Exemple #35
0
 private bool parseID(string html, out MovieId id)
 {
     html = html.CutToFirst("<div class=\"image\">", CutDirection.Left, true);
     html = html.CutToSection("href=\"", "\"", true);
     return MovieId.TryParse(html, out id);
 }
Exemple #36
0
        public async Task <MovieEntity> GetMovieByIdAsync(MovieId id, CancellationToken ctx)
        {
            var result = await _queryProcessor.ProcessAsync(new ReadModelByIdQuery <MovieReadModel>(id), ctx);

            return(result?.ToMovie());
        }
 public MovieMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
     : base(html, request, response, id, genreCollection)
 {
     
 }
        //Issue movie to selected customer
        private void btnIssueMovie_Click(object sender, EventArgs e)
        {
            try
            {
                string CustId, MovieId, IssueDate, ReturnDate;
                int    totalDays = 0;
                int    temp      = 0;
                int    TotalRent = 0;
                CustId     = DropDownSelectCustomer.SelectedValue.ToString();
                MovieId    = DropDownMovie.SelectedValue.ToString();
                IssueDate  = dtIsuue.Value.ToShortDateString();
                ReturnDate = dtReturn.Value.ToShortDateString();

                if (CustId == "" || CustId == "0" || CustId == null)
                {
                    MessageBox.Show("Please select customer");
                }
                else if (MovieId.Equals("") || MovieId == "0" || MovieId == null)
                {
                    MessageBox.Show("Please select movie");
                }

                else if (DateTime.Parse(IssueDate) > DateTime.Parse(ReturnDate))
                {
                    MessageBox.Show("Issue date can not be greater than retun date", "Alert");
                }
                else if (IssueDate == ReturnDate)
                {
                    totalDays = 1;
                    temp      = new Movies().CalculateMovieCost(int.Parse(MovieId)); // Getting rent amount for that movie

                    TotalRent = totalDays * temp;                                    // Calculate the Total Rent of issue movie
                }
                else
                {
                    totalDays = new CalculateDays().GetTotalDays(IssueDate, ReturnDate);

                    temp = new Movies().CalculateMovieCost(int.Parse(MovieId)); // Getting rent amount for that movie

                    TotalRent = totalDays * temp;                               // Calculate the Total Rent of issue movie
                }

                RentedMoviesDataTbl rmdata = new RentedMoviesDataTbl();
                rmdata.MovieId         = int.Parse(MovieId);
                rmdata.CustId          = int.Parse(CustId);
                rmdata.RentDate        = IssueDate;
                rmdata.ReturnDate      = ReturnDate;
                rmdata.TotalRentAmount = TotalRent;

                if (new RentedMOvies().InsertRentedMovie(rmdata))
                {
                    TabControlSystem.SelectedTab = TabControlSystem.TabPages["RentedMovies"];
                    RentedMovieGridData();
                    MessageBox.Show("Movie rented successfully!");
                }
                else
                {
                    MessageBox.Show("Failed to rent this movie!");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 protected bool Equals(DirectorAddedToMovie other)
 {
     return(MovieId.Equals(other.MovieId) && string.Equals(Director, other.Director));
 }
Exemple #40
0
 public TagPage(string html, URL request, URL response, MovieId id)
     : base(html, request, response, id)
 {
     Taglines = new ParsedCollection<string>(parseTaglines(html));
 }
Exemple #41
0
 public InfoPage(string html, URL request, URL response, MovieId id)
     : base(html, request, response)
 {
     this.id = id;
 }
        //----------------------------------------------------------------//

        public override int GetHashCode()
        {
            return(MovieId.GetHashCode() ^ GenreId.GetHashCode());
        }
 public TVSeriesMainPage(string html, URL request, URL response, MovieId id, GenreCollection genreCollection)
     : base(html, request, response, id, genreCollection)
 {
     LastYear = new ParsedInfo<int>(html, parseYear);
 }
 protected bool Equals(MovieRatedByAudience other)
 {
     return(MovieId.Equals(other.MovieId) && Rating == other.Rating);
 }
Exemple #45
0
 public override int GetHashCode()
 {
     return((Id.GetHashCode() + UserId.GetHashCode() + MovieId.GetHashCode()) / 3);
 }
Exemple #46
0
 public async Task UpdateMovieAsync(MovieId movieId, string name, string director, int budget, CancellationToken ctx)
 {
     await _commandBus.PublishAsync(new UpdateMovieCommand(movieId, name, director, budget), ctx);
 }