Exemplo n.º 1
0
        private void btnload_Click(object sender, EventArgs e)
        {
            // Showing table datas in DataGrid
            MediaLibraryLogic mediaLibraryLogic = new MediaLibraryLogic();

            dataGridView.DataSource = mediaLibraryLogic.MediaList();
        }
Exemplo n.º 2
0
 private void btnpublishyear_Click(object sender, EventArgs e)
 {
     if (txtpublishyear.Text == "")
     {
         MessageBox.Show("Please input value");
     }
     else
     {
         MediaLibraryLogic libraryLogic = new MediaLibraryLogic();
         try // try catch statement
         {
             dataGridView.DataSource = libraryLogic.ListByPublishYear(Int32.Parse(txtpublishyear.Text));
         }
         catch (Exception)
         {
             dataGridView.DataSource = libraryLogic.ListByPublishYear(0);
         }
         txtpublishyear.Clear();
     }
 }
Exemplo n.º 3
0
        private void btngenre_Click(object sender, EventArgs e)
        {
            if (txtgenre.Text == "")
            {
                MessageBox.Show("Please input value");
            }
            else
            {
                MediaLibraryLogic libraryLogic = new MediaLibraryLogic();

                try
                {
                    dataGridView.DataSource = libraryLogic.ListByGenre(txtgenre.Text);
                }

                catch (Exception)
                {
                    // Showing null if the input User inserted is not in database.
                    dataGridView.DataSource = libraryLogic.ListByGenre("");
                }
                txtgenre.Clear();
            }
        }