private void grdBackupFiles_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { System.Web.UI.WebControls.HyperLink hyperLink = this.grdBackupFiles.Rows[e.RowIndex].FindControl("hlinkName") as System.Web.UI.WebControls.HyperLink; if (StoreHelper.DeleteBackupFile(hyperLink.Text.Trim())) { string path = System.Web.HttpContext.Current.Request.MapPath(Globals.ApplicationPath + "/Storage/data/Backup/" + hyperLink.Text.Trim()); System.IO.File.Delete(path); this.BindBackupData(); this.ShowMsg("成功删除了选择的备份文件", true); return; } this.ShowMsg("未知错误", false); }
private void grdBackupFiles_RowDeleting(object sender, GridViewDeleteEventArgs e) { HyperLink link = this.grdBackupFiles.Rows[e.RowIndex].FindControl("hlinkName") as HyperLink; if (StoreHelper.DeleteBackupFile(link.Text.Trim())) { File.Delete(HttpContext.Current.Request.MapPath(Globals.ApplicationPath + "/Storage/data/Backup/" + link.Text.Trim())); this.BindBackupData(); this.ShowMsg("成功删除了选择的备份文件", true); } else { this.ShowMsg("未知错误", false); } }
public void Delete(HttpContext context) { string parameter = base.GetParameter(context, "BackupName", true); if (string.IsNullOrWhiteSpace(parameter)) { throw new HidistroAshxException("错误的参数"); } parameter = parameter.Trim(); string path = HttpContext.Current.Request.MapPath("/Storage/data/Backup/" + parameter); if (StoreHelper.DeleteBackupFile(parameter)) { File.Delete(path); base.ReturnSuccessResult(context, "成功删除了选择的备份文件", 0, true); return; } throw new HidistroAshxException("未知错误"); }