protected void lbtnDelete_Click(object sender, EventArgs e) { if (Utils.CStrDef(Session["Grouptype"]) == "1" || Utils.CStrDef(Session["Grouptype"]) == "2") { List <object> fieldValues = ASPxGridView1_project.GetSelectedFieldValues(new string[] { "ID" }); foreach (var item in fieldValues) { _delData.DeleteMemberByProf(Utils.CIntDef(item)); _delData.DeleteAttachByProf(Utils.CIntDef(item)); _delData.DeleteWorkByProf(Utils.CIntDef(item)); _ProjectData.Remove(Utils.CIntDef(item)); string pathfileOld = Server.MapPath("/File/Profile/" + Utils.CStrDef(item)); DeleteAllFilesInFolder(pathfileOld); } Response.Redirect("danh-sach-ho-so.aspx"); } else { string strScript = "<script>"; strScript += "alert(' Bạn không có quyền này!');"; strScript += "window.location='danh-sach-ho-so.aspx';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } }
private void Delete() { try { int id = _id; string img = _ProjectData.GetById(_id).PROF_FILE; _delData.DeleteMemberByProf(_id); _delData.DeleteAttachByProf(_id); _delData.DeleteWorkByProf(_id); _ProjectData.Remove(_id); string pathfileOld = Server.MapPath("/File/Profile/" + Utils.CStrDef(id)); DeleteAllFilesInFolder(pathfileOld); } catch (Exception) { throw; } }