Esempio n. 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            String      keyword = txtKeyword.Text.Trim();
            List <Song> songs   = new SongBUS().Search(keyword);

            gvSongs.DataSource = songs;
            gvSongs.DataBind();
        }
Esempio n. 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         List <Song> songs = new SongBUS().GetAll();
         gvSongs.DataSource = songs;
         gvSongs.DataBind();
     }
 }
Esempio n. 3
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            int  code   = int.Parse(txtID.Text.Trim());
            bool result = new SongBUS().Delete(code);

            if (result)
            {
                List <Song> songs = new SongBUS().GetAll();
                gvSongs.DataSource = songs;
                gvSongs.DataBind();
            }
        }
Esempio n. 4
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Song newSong = new Song()
            {
                Title  = txtTitle.Text.Trim(),
                Singer = txtSinger.Text.Trim(),
                Genre  = txtGenre.Text.Trim(),
                Album  = txtAlbum.Text.Trim()
            };
            bool result = new SongBUS().AddNew(newSong);

            if (result)
            {
                List <Song> songs = new SongBUS().GetAll();
                gvSongs.DataSource = songs;
                gvSongs.DataBind();
            }
        }
Esempio n. 5
0
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            Song newSong = new Song()
            {
                Id     = int.Parse(txtID.Text.Trim()),
                Title  = txtTitle.Text.Trim(),
                Singer = txtSinger.Text.Trim(),
                Genre  = txtGenre.Text.Trim(),
                Album  = txtAlbum.Text.Trim()
            };
            bool result = new SongBUS().Update(newSong);

            if (result)
            {
                List <Song> songs = new SongBUS().GetAll();
                gvSongs.DataSource = songs;
                gvSongs.DataBind();
            }
        }