private void mnuStripFavorite_Click(object sender, EventArgs e) { try { DataTable dtFavorite = new DataTable(); dtFavorite = Movie_SP.FavoriteGetList(); if (dtFavorite.Rows.Count > 0) { Movie[] favoriteMovies = new Movie[0]; favoriteMovies = Movie.FetchAllMovie(dtFavorite); if (FormManager.IsFormOpen(enForms.frmFavoriteMovieList, null) == false) { frmFavoriteMovieList favoriteTemp = new frmFavoriteMovieList(favoriteMovies); favoriteTemp.Show(); } } else { MessageBox.Show(Messages.FavoriteListEmpty, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void btnMovieList_Click(object sender, EventArgs e) { try { DataTable dtAllMovie = new DataTable(); dtAllMovie = Movie_SP.GetList(false); Movie[] movie = new Movie[0]; movie = Movie.FetchAllMovie(dtAllMovie); if (FormManager.IsFormOpen(enForms.frmMovieList, null) == false) { frmMovieList movieTemp = new frmMovieList(dtAllMovie); movieTemp.Show(); } else { foreach (Form frm in Application.OpenForms) { if (frm is frmMovieList) { (frm as frmMovieList).DataSource = dtAllMovie; break; } } } } catch (Exception ex) { MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Initialize() { try { DataSet dsMovie = new DataSet(); DataTable dtSimilar = new DataTable(); dsMovie = Movie_SP.GetDetailsByID(this.movieID); dtSimilar = Movie_SP.GetSimilarByID(this.movieID); this.movie.FetchSingleMovie(dsMovie.Tables[0]); this.director = Person.FetchAllPerson(dsMovie.Tables[1]); this.actor = dsMovie.Tables[2]; this.language = Language.FetchAllLanguage(dsMovie.Tables[3]); this.genre = Genre.FetchAllGenre(dsMovie.Tables[4]); this.similar = Movie.FetchAllMovie(dtSimilar); // Form Title this.Text = this.movie.FullTitle; // Summary switch (this.movie.Quality) { case enVideoQuality._1080p: picQuality.Image = global::iMovie.Properties.Resources._1080p; break; case enVideoQuality._720p: picQuality.Image = global::iMovie.Properties.Resources._720p; break; case enVideoQuality.DVD: picQuality.Image = global::iMovie.Properties.Resources.dvd; break; case enVideoQuality.Indeterminate: picQuality.Image = global::iMovie.Properties.Resources.na; break; case enVideoQuality.VCD: picQuality.Image = global::iMovie.Properties.Resources.vcd; break; default: picQuality.Image = global::iMovie.Properties.Resources.na; break; } if (this.movie.IsSeen == true) { this.tooltip.SetToolTip(this.picIsSeen, Messages.IsSeen); picIsSeen.Image = global::iMovie.Properties.Resources.seen; } else { this.tooltip.SetToolTip(this.picIsSeen, Messages.NotSeen); picIsSeen.Image = global::iMovie.Properties.Resources.not_seen; } string title = this.movie.FullTitle; lblMovieName.Text = title; lblRateValue.Text = this.movie.IMDBRate.ToString(); if (this.movie.FavoriteRate == 0) { lblFavValue.Text = "-"; } else { lblFavValue.Text = this.movie.FavoriteRate.ToString(); } if (File.Exists(PathUtils.GetApplicationMoviePosterPath() + this.movie.PosterLink) == true) { try { picPoster.Image = Image.FromFile(PathUtils.GetApplicationMoviePosterPath() + this.movie.PosterLink); } catch { // Do nothing for image that is corrupted } } int i = this.director.Length; int j = 0; if (i > 0) { lblDirectorValue.Text = ""; } foreach (Person dir in this.director) { lblDirectorValue.Text += dir.FullName; j++; if (j < i) { lblDirectorValue.Text += ", "; } } j = 0; i = this.genre.Length; if (i > 0) { lblGenreValue.Text = ""; } foreach (Genre gen in this.genre) { lblGenreValue.Text += gen.GenreName; j++; if (j < i) { lblGenreValue.Text += ", "; } } j = 0; i = this.language.Length; if (i > 0) { lblLanguageValue.Text = ""; } foreach (Language lan in this.language) { lblLanguageValue.Text += lan.LanguageName; j++; if (j < i) { lblLanguageValue.Text += ", "; } } lblDurationValue.Text = this.movie.Duration.ToString(); lblAddDateValue.Text = this.movie.AddDate.ToShortDateString(); // StoryLine lblStoryText.Text = movie.StoryLine; // Cast & Crew repDirector.DataSource = this.director; this.ucActorList.DtPersons = this.actor; this.ucActorList.PersonType = "Actor"; // Similar Movies repMovie.EnableRightClickMenu = iMovieBase.IsLogin; repMovie.DataSource = this.similar; } catch (Exception ex) { throw ex; } }
private void btnView_Click(object sender, EventArgs e) { try { enFilterType languageFilter = enFilterType.Any; if (radExactLanguage.Checked == true) { languageFilter = enFilterType.Exact; } enFilterType genreFilter = enFilterType.Any; if (radExactGenre.Checked == true) { genreFilter = enFilterType.Exact; } enFilterType directorFilter = enFilterType.Any; if (radExactDirector.Checked == true) { directorFilter = enFilterType.Exact; } enFilterType actorFilter = enFilterType.Any; if (radExactActor.Checked == true) { actorFilter = enFilterType.Exact; } int count = Convert.ToInt32(txtCount.Value); bool?isSeen = null; if (chkSeen.Checked == true && chkNotSeen.Checked == false) { isSeen = true; } else if (chkSeen.Checked == false && chkNotSeen.Checked == true) { isSeen = false; } bool?isFavorite = null; if (chkFavorite.Checked == true) { isFavorite = true; } double imdbLow = Convert.ToDouble(dropRateLow.SelectedItem); double imdbUp = Convert.ToDouble(dropRateUp.SelectedItem); int productLow = 1900; int productUp = DateTime.Now.Year; if (Movie.IsProductYear(txtProductLow.Text) == true) { productLow = Convert.ToInt32(txtProductLow.Text); } if (Movie.IsProductYear(txtProductUp.Text) == true) { productUp = Convert.ToInt32(txtProductUp.Text); } string durationLow = "00:00:00"; string durationUp = "20:00:00"; if (Movie.IsDuration(txtDurationLow.Text) == true) { durationLow = txtDurationLow.Text; } if (Movie.IsDuration(txtDurationUp.Text) == true) { durationUp = txtDurationUp.Text; } string movieName = txtMovieName.Text; string[] quality = chkQuality.SelectedID; if (quality.Length == 0 || chkQuality.SelectAll == true) { quality = null; } string[] language = chkLanguage.SelectedID; if (language.Length == 0 || chkLanguage.SelectAll == true) { language = null; } string[] genre = dgvGenre.SelectedID; if (genre.Length == 0 || dgvGenre.SelectAll == true) { genre = null; } string[] director = dgvDirector.SelectedID; if (director.Length == 0 || dgvDirector.SelectAll == true) { director = null; } string[] actor = dgvActor.SelectedID; if (actor.Length == 0 || dgvActor.SelectAll == true) { actor = null; } InsertManager insertManager = new InsertManager(false, false); List <Movie> excludedMovies = new List <Movie>(); foreach (PathSource pathSource in pathListBox.DataSource) { excludedMovies.AddRange(insertManager.GetMovieListFromPath(pathSource.PathString)); } List <Movie> duplicateMovies = new List <Movie>(); duplicateMovies = Movie_SP.GetDuplicateMoviesInSource(excludedMovies); DataTable dtMovies = Movie_SP.SuggestRandom(count, movieName, productLow, productUp, imdbLow, imdbUp, durationLow, durationUp, isSeen, isFavorite, director, directorFilter, actor, actorFilter, genre, genreFilter, language, languageFilter, quality, duplicateMovies); Movie[] suggestedMovies = new Movie[0]; suggestedMovies = Movie.FetchAllMovie(dtMovies); if (suggestedMovies.Length == 1) { if (FormManager.IsFormOpen(enForms.frmMovie, suggestedMovies[0].MovieID) == false) { frmMovie movieTemp = new frmMovie(suggestedMovies[0].MovieID); movieTemp.Show(); } } else if (suggestedMovies.Length > 1) { if (FormManager.IsFormOpen(enForms.frmMovieSuggestList, suggestedMovies) == false) { frmMovieSuggestList suggestList = new frmMovieSuggestList(suggestedMovies); suggestList.Show(); } } else { MessageBox.Show(Messages.NoMovieFound, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void Initialize() { try { DataTable dtPerson = new DataTable(); DataTable dtMoviesActed = new DataTable(); DataTable dtMoviesDirected = new DataTable(); DataTable dtPersonType = new DataTable(); dtPerson = Person_SP.GetByID(this.personID); Person_SP.GetTypeByID(this.personID, out this.isActor, out this.isDirector); if (this.isDirector == true) { dtMoviesDirected = Movie_SP.GetByDirectorID(this.personID); } if (this.isActor == true) { dtMoviesActed = Movie_SP.GetByActorID(this.personID); } this.person.FetchSinglePerson(dtPerson); this.moviesDirected = Movie.FetchAllMovie(dtMoviesDirected); this.moviesActed = Movie.FetchAllMovie(dtMoviesActed); // Form Title this.Text = this.person.FullName; // Summary lblActorName.Text = this.person.FullName; if (File.Exists(PathUtils.GetApplicationPersonPath() + this.person.PhotoLink) == true) { try { picPhoto.Image = Image.FromFile(PathUtils.GetApplicationPersonPath() + this.person.PhotoLink); } catch { // Do nothing for image that is corrupted } } if (this.isActor == true && this.isDirector == true) { lblUp.Visible = true; lblUpValue.Visible = true; lblDown.Visible = true; lblDownValue.Visible = true; lblUp.Text = "Number of Movies Directed:"; lblDown.Text = "Number of Movies Acted:"; lblUpValue.Text = this.moviesDirected.Length.ToString(); lblDownValue.Text = this.moviesActed.Length.ToString(); } else if (this.isActor == true && this.isDirector == false) { lblUp.Visible = false; lblUpValue.Visible = false; lblDown.Visible = true; lblDownValue.Visible = true; lblUp.Text = ""; lblDown.Text = "Number of Movies Acted:"; lblUpValue.Text = ""; lblDownValue.Text = this.moviesActed.Length.ToString(); DataOperation.HideTabPage(tab, tabDirected); } else if (this.isActor == false && this.isDirector == true) { lblUp.Visible = false; lblUpValue.Visible = false; lblDown.Visible = true; lblDownValue.Visible = true; lblUp.Text = ""; lblDown.Text = "Number of Movies Directed:"; lblUpValue.Text = ""; lblDownValue.Text = this.moviesDirected.Length.ToString(); DataOperation.HideTabPage(tab, tabActed); } else { lblUp.Visible = false; lblUpValue.Visible = false; lblDown.Visible = false; lblDownValue.Visible = false; lblUp.Text = ""; lblDown.Text = ""; lblUpValue.Text = ""; lblDownValue.Text = ""; DataOperation.HideTabPage(tab, tabDirected); DataOperation.HideTabPage(tab, tabActed); } // Movies Directed repDirected.EnableRightClickMenu = iMovieBase.IsLogin; repDirected.DataSource = moviesDirected; // Movies Acted repActed.EnableRightClickMenu = iMovieBase.IsLogin; repActed.DataSource = moviesActed; } catch (Exception ex) { throw ex; } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (isRunning == false) { prgUpdate.Value = 0; int totals = 0; int updated = 0; int updateError = 0; lblMovie.Text = ""; if (DataOperation.IsConnected() == true) { bool ignore = chkIgnore.Checked; bool image = chkImage.Checked; bool rate = chkRate.Checked; bool link = chkLink.Checked; bool year = chkYear.Checked; bool duration = chkDuration.Checked; bool story = chkStory.Checked; bool genre = chkGenre.Checked; bool director = chkDirector.Checked; bool directorPhoto = chkDirectorPhoto.Checked; bool actor = chkActors.Checked; bool actorPhoto = chkActorPhoto.Checked; bool language = chkLanguage.Checked; DateTime?fromDate = null; DateTime?toDate = null; if (this.datePickFrom.Checked) { fromDate = this.datePickFrom.Value; } if (this.datePickTo.Checked) { toDate = this.datePickTo.Value; } DataTable dtMovies = new DataTable(); if (image == true || rate == true || link == true || year == true || duration == true || story == true || genre == true || director == true || directorPhoto == true || language == true || actor == true || actorPhoto == true) { string logName = "iMovie Update Log [" + Helper.GetShortDateTimeString().Replace(":", "-") + "].txt"; iMovieBase.log.Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), logName); dtMovies = Movie_SP.GetList(true, fromDate, toDate); Movie[] movieList = Movie.FetchAllMovie(dtMovies); prgUpdate.Maximum = movieList.Length; SecondThread = new Thread( new ThreadStart(() => { try { enUpdateResult result = enUpdateResult.UpdateError; int BannedIP = 0; int ConnectionLost = 0; int UpdateError = 0; isRunning = true; this.exitRequest = false; foreach (Movie m in movieList) { if (this.exitRequest == false) { totals++; DelegateName dlName = new DelegateName(GetCurrentName); BeginInvoke(dlName, "Updating: " + m.FullTitle); result = Movie_SP.UpdateOnline(m, image, rate, link, year, duration, story, genre, director, directorPhoto, language, actor, actorPhoto, ignore, true, false, null); if (result == enUpdateResult.Updated) { updated++; } else if (result == enUpdateResult.NotOpen || result == enUpdateResult.UpdateError) { updateError++; } if (result == enUpdateResult.NotOpen) { if (DataOperation.IsConnected() == true) { BannedIP++; ConnectionLost = 0; } else { ConnectionLost++; BannedIP = 0; } } if (result == enUpdateResult.UpdateError) { UpdateError++; } else if (result != enUpdateResult.NoNeedUpdate && result != enUpdateResult.UpdateError) { UpdateError = 0; } if (chkWarn.Checked == true) { if (UpdateError >= 20) { if (MessageBox.Show(Messages.CheckInternet.Replace(@"\n", Environment.NewLine).Replace("@NUM@", UpdateError.ToString()), Messages.MessageBoxTitle, MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { this.exitRequest = true; } UpdateError = 0; } else if (ConnectionLost >= 8) { MessageBox.Show(Messages.NotConnected, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); ConnectionLost = 0; } else if (BannedIP >= 10) { if (MessageBox.Show(Messages.IPBanned.Replace(@"\n", Environment.NewLine).Replace("@NUM@", BannedIP.ToString()), Messages.MessageBoxTitle, MessageBoxButtons.RetryCancel, MessageBoxIcon.Question) == DialogResult.Cancel) { this.exitRequest = true; } BannedIP = 0; } } RegistryManager.WriteValue(Helper.GetShortDateTimeString(m.AddDate), Messages.RootKey, Messages.SubKeyLastToArchiveDateTime); } else { break; } InvokeHandle(); } while (prgUpdate.Value < prgUpdate.Maximum) { InvokeHandle(); } DelegateName dlReset = new DelegateName(GetCurrentName); BeginInvoke(dlReset, ""); isRunning = false; this.exitRequest = false; iMovieBase.log.GenerateSilent("Total movies processed: " + totals.ToString() + Environment.NewLine + "Movies updated: " + updated.ToString() + Environment.NewLine + "Movies failed to update: " + updateError.ToString()); MessageBox.Show(Messages.UpdateComplete + Environment.NewLine + Messages.LogCreated + Environment.NewLine + logName, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } catch (Exception ex) { isRunning = false; exitRequest = false; DelegateName dlResetName = new DelegateName(GetCurrentName); BeginInvoke(dlResetName, ""); DelegateGeneral dlReset = new DelegateGeneral(ResetProgress); BeginInvoke(dlReset); iMovieBase.log.GenerateSilent("Total movies processed: " + totals.ToString() + Environment.NewLine + "Movies updated: " + updated.ToString() + Environment.NewLine + "Movies failed to update: " + updateError.ToString()); MessageBox.Show(Messages.UpdateError + Environment.NewLine + Messages.LogCreated + Environment.NewLine + ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } })); SecondThread.Start(); } else { MessageBox.Show(Messages.SelectValues, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(Messages.NotConnected, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show(Messages.WaitForUpdate, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { prgUpdate.Value = 0; MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnQuick_Click(object sender, EventArgs e) { try { bool seen = chkSeen.Checked; bool notSeen = chkNotSeen.Checked; bool?fav = chkFavorite.Checked; int count = Convert.ToInt32(txtCount.Value); bool?isSeen = null; if (fav != true) { fav = null; } if (seen == true && notSeen == true) { isSeen = null; } else if (seen == true && notSeen == false) { isSeen = true; } else if (seen == false && notSeen == true) { isSeen = false; } else { isSeen = null; } double rateLow = 0; double rateHigh = 10; int productLow = 1900; int productHigh = 2100; string durationLow = "00:00:00"; string durationHigh = "20:00:00"; string[] qualityID = null; switch (dropPreset.SelectedIndex) { case 0: // All Movies break; case 1: // Top Movies qualityID = new string[] { "3", "4" }; rateLow = 8; break; case 2: // High Rated Movies rateLow = 7; break; case 3: // High Quality Movies qualityID = new string[] { "3", "4" }; break; case 4: // Recent Movies productLow = (DateTime.Now.Year - 3); productHigh = DateTime.Now.Year; break; case 5: // Old Movies productLow = 1901; productHigh = (DateTime.Now.Year - 40); break; case 6: // Short Movies durationHigh = "01:40:00"; break; case 7: // Long Movies durationLow = "02:15:00"; break; } DataTable dtMovies = new DataTable(); dtMovies = Movie_SP.SuggestRandom(count, "", productLow, productHigh, rateLow, rateHigh, durationLow, durationHigh, isSeen, fav, null, enFilterType.Any, null, enFilterType.Any, null, enFilterType.Any, null, enFilterType.Any, qualityID); Movie[] suggestedMovies = new Movie[0]; suggestedMovies = Movie.FetchAllMovie(dtMovies); if (suggestedMovies.Length == 1) { if (FormManager.IsFormOpen(enForms.frmMovie, suggestedMovies[0].MovieID) == false) { frmMovie movieTemp = new frmMovie(suggestedMovies[0].MovieID); movieTemp.Show(); } } else if (suggestedMovies.Length > 1) { if (FormManager.IsFormOpen(enForms.frmMovieSuggestList, suggestedMovies) == false) { frmMovieSuggestList suggestList = new frmMovieSuggestList(suggestedMovies); suggestList.Show(); } } else { MessageBox.Show(Messages.NoMovieFound, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MessageBox.Show(ex.Message, Messages.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Warning); } }