示例#1
0
 private void BtnDelete_Click(object sender, RoutedEventArgs e)
 {
     BL.Movie movie = new BL.Movie();
     try
     {
         movie.removeMovie(txtId.Text);
         MessageBox.Show("succesfully deleted that movie ");
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
        void initFunc(string id)
        {
            BL.Movie movieLogic = new BL.Movie();

            movie = movieLogic.findMovie(id);

            txtTitle.Text             = movie.title;
            txtDescription.Text       = movie.description;
            txtDuration.Text          = movie.duration;
            txtGenre.Text             = movie.genre;
            txtDirector.Text          = movie.director;
            txtRating.Text            = movie.rating;
            dtRelaseDate.SelectedDate = DateTime.Parse(movie.releaseDate);
        }
 private void BtnUpdate_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         BL.Movie    movieLogic = new BL.Movie();
         Model.Movie movie      = movieLogic.findMovie(txtId.Text);
         UpdateMovie um         = new UpdateMovie(txtId.Text);
         um.Show();
         this.Close();
     }
     catch (Exception err)
     {
         MessageBox.Show(err.Message);
     }
 }
示例#4
0
        private void btnAddMovie_Click(object sender, RoutedEventArgs e)
        {
            String title       = txtTitle.Text;
            String releaseDate = dtRelaseDate.SelectedDate.ToString();
            String description = txtDescription.Text;
            String director    = txtDirector.Text;
            String rating      = txtRating.Text;
            String duration    = txtDuration.Text;
            String genre       = txtGenre.Text;

            BL.Movie movie = new BL.Movie();

            try
            {
                movie.addMovie(title, releaseDate, description, duration, genre, director, rating);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
        private void btnUpdateMovie_Click(object sender, RoutedEventArgs e)
        {
            movie.title       = txtTitle.Text;
            movie.description = txtDescription.Text;
            movie.duration    = txtDuration.Text;
            movie.genre       = txtGenre.Text;
            movie.director    = txtDirector.Text;
            movie.rating      = txtRating.Text;
            movie.releaseDate = dtRelaseDate.SelectedDate.ToString();

            BL.Movie movieLogic = new BL.Movie();


            try
            {
                movieLogic.updateMovie(movie.id, movie.title, movie.releaseDate, movie.description, movie.duration, movie.genre, movie.director, movie.rating);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }