예제 #1
0
 /// <summary>
 /// Updates the movie.
 /// </summary>
 /// <param name="movie">The movie.</param>
 public void UpdateMovie(MovieTable movie)
 {
     var updatedMovie = DataBase.Connection.MovieTables.FirstOrDefault(p => p.ID == movie.ID);
     updatedMovie.WantSee = movie.WantSee;
     updatedMovie.Wish = movie.Wish;
     DataBase.Connection.SubmitChanges();
 }
 /// <summary>
 /// Handles the OnClick event of the BtnAddCollection control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void BtnAddCollection_OnClick(object sender, EventArgs e)
 {
     methods = new Methods();
     var movie = new MovieTable
                 {
                     Director = BlockDirectors.Text,
                     Title = TxtMovieTitle.Text,
                     Year = Convert.ToInt32(BlockYear.Text),
                     WantSee = false,
                     Wish = false,
                     UrlImage = urlImage
                 };
     methods.InsertMovie(movie);
     MessageBox.Show("The movie has been added to the collection");
     NavigationService.Navigate(new Uri("/Pages/Menu.xaml", UriKind.Relative));
 }
 /// <summary>
 /// Called when a page becomes the active page in a frame.
 /// </summary>
 /// <param name="e">An object that contains the event data.</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     methods = new Methods();
     base.OnNavigatedTo(e);
     string id;
     if (NavigationContext.QueryString.TryGetValue("id", out id))
     {
         currentMovie = methods.GetMovie(Convert.ToInt32(id));
         BlockTitle.Text = currentMovie.Title;
         BlockYear.Text = currentMovie.Year.ToString(CultureInfo.InvariantCulture);
         BlockDirector.Text = currentMovie.Director;
         if (currentMovie.WantSee)
             RadioButtonWant.IsChecked = true;
         if (currentMovie.Wish)
             RadioButtonWish.IsChecked = true;
         var uri = new Uri(currentMovie.UrlImage, UriKind.Absolute);
         ImgCover.Source = new BitmapImage(uri);
     }
 }
 /// <summary>
 /// BTNs the add to want to see click.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void BtnAddToWantToSeeClick(object sender, EventArgs e)
 {
     methods = new Methods();
     var movie = new MovieTable
     {
         Director = BlockDirectors.Text,
         Title = TxtMovieTitle.Text,
         Year = Convert.ToInt32(BlockYear.Text),
         WantSee = true,
         Wish = false,
         UrlImage = urlImage
     };
     methods.InsertMovie(movie);
     MessageBox.Show("Added to your want to see list");
     NavigationService.Navigate(new Uri("/Pages/Menu.xaml", UriKind.Relative));
 }
예제 #5
0
 /// <summary>
 /// Handles the OnTap event of the LsbWish control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="GestureEventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 private void LsbWish_OnTap(object sender, GestureEventArgs e)
 {
     selectedMovie = (MovieTable) LsbWish.SelectedItem;
     LsbWantTo.SelectedItem = null;
     LsbCatalog.SelectedItem = null;
     EnableButtons(true);
 }
예제 #6
0
 /// <summary>
 /// Inserts the movie.
 /// </summary>
 /// <param name="movie">The movie.</param>
 public void InsertMovie(MovieTable movie)
 {
     DataBase.Connection.MovieTables.InsertOnSubmit(movie);
     DataBase.Connection.SubmitChanges();
 }
예제 #7
0
 /// <summary>
 /// Deletes the movie.
 /// </summary>
 /// <param name="movie">The movie.</param>
 public void DeleteMovie(MovieTable movie)
 {
     DataBase.Connection.MovieTables.DeleteOnSubmit(movie);
     DataBase.Connection.SubmitChanges();
 }