コード例 #1
0
        private void AddMovieToDbButton1_Click(object sender, EventArgs e)
        {
            wcfHostService wcfs = new wcfHostService();
            Movie mov;
            //List<Movie> movList = new List<Movie>();
            try
            {
                string title;
                string director;
                string category;
                int releaseDate;
                int movLength;
                int movId;

                title = TitleTextBox.Text;
                director = DirectorTextBox.Text;
                category = CategoryTextBox.Text;
                releaseDate = int.Parse(ReleaseDateTextBox.Text);
                movLength = int.Parse(LengthTextBox.Text);
                movId = int.Parse(textBox1.Text);

                mov = new Movie(movId, director, title, category, movLength, releaseDate);
                //movList.Add(mov);

                wcfs.InsertMovie(mov);

            }
            catch (Exception)
            {
                throw;
            }
            //if this shows up you got all the types right
            MessageBox.Show("Movie added");
        }
コード例 #2
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            wcfHostService wcfs = new wcfHostService();
            try
            {
                string title;
                title = MovieIDTextBox.Text;
                wcfs.DeleteMovie(title);

            }
            catch (Exception)
            {
                throw;
            }
            //if this pops up, you entered a valid movie.
            MessageBox.Show("movie deleted");
        }