Exemplo n.º 1
0
        private void addGenreButton_Click(object sender, EventArgs e)
        {
            // The user clicked the addGenreButton on the AddSong form.
            // this creates an AddGenre pop-up.
            AddGenreWF   frm = new AddGenreWF();
            DialogResult dr  = frm.ShowDialog(this);

            // If the user clicked the OK button on the AddGenre pop-up
            if (dr == DialogResult.OK)
            {
                // MessageBox.Show("User clicked OK button");
                // Get the newly created genre object
                CDCatalogEF.Genre genre = (Genre)this.addGenreButton.Tag;

                // Show updated list in the combo box
                this.genreTableAdapter.Fill(this.cDCatalogDataSet3.Genre);

                //Show the selected item
                this.genreComboBox.SelectedIndex = this.genreComboBox.FindString(genre.GenreName);

                this.Close();
            }
            // if the Cancel button or the X was clicked on the AddGenre pop-up...
            else if (dr == DialogResult.Cancel)
            {
                MessageBox.Show("User clicked Cancel button");
                this.Close();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// This method handles the  "OK" button click
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void ButtonOkClick(object sender, EventArgs e)
        {
            // Add the genre in the textbox
            CDCatalogEF.Genre genre = CDCatalogDA.Genre.AddGenre(this.genreTxtBox.Text.Trim());

            // Save the new genre that was created as the tag object
            this.Tag = genre;

            // Display a debug message box
            // string msg = "GenreID=" + genreId.ToString();
            // MessageBox.Show(msg);

            // Close the genre pop-up form
            this.Close();
        }
Exemplo n.º 3
0
 public void TestDAGenreAdd()
 {
     CDCatalogEF.Genre genre = CDCatalogDA.Genre.AddGenre("xyzzx");
 }