protected void btnDelete_Click(object sender, EventArgs e) { try { int VideoID = Globals.GetIntFromQueryString("VideoID"); OtherFunctions obj = new OtherFunctions(); DataSet dsVideo = obj.GetVideoByVideoID("VideoProduct", VideoID); //xóa file image Globals.DeleteFile(Convert.ToString(dsVideo.Tables[0].Rows[0]["VideoImage"]), "ImageFiles/Videos"); //xóa file video Globals.DeleteFile(Convert.ToString(dsVideo.Tables[0].Rows[0]["VideoSrc"]), "VideoFiles/"); obj.DeleteVideo(VideoID); //LoadGridViewVideo(ddlLanguage2.SelectedValue); Response.Redirect("VideoClip.aspx#VideoClipList"); } catch { } }
protected void gridViewVideo_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewVideo.Rows[e.RowIndex]; Int32 VideoID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblVideoID")).Text); OtherFunctions obj = new OtherFunctions(); DataSet dsVideo = obj.GetVideoByVideoID("VideoProduct", VideoID); //xóa file image Globals.DeleteFile(Convert.ToString(dsVideo.Tables[0].Rows[0]["VideoImage"]), "ImageFiles/Videos"); //xóa file video string pathFileVideo = Globals.GetPhysicalUploadsUrl() + "VideoFiles/" + Convert.ToString(dsVideo.Tables[0].Rows[0]["VideoSrc"]); Globals.DeleteFile(pathFileVideo); obj.DeleteVideo(VideoID); LoadGridViewVideo(ddlLanguage2.SelectedValue); } catch { } }