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(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { List <Song> songs = new SongBUS().GetAll(); gvSongs.DataSource = songs; gvSongs.DataBind(); } }
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(); } }
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(); } }
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(); } }