protected void Button2_Click(object sender, EventArgs e) { DataTable dt = MySQL.ExecProc("usp_Car_EmployeePassInfo_GetWithImage", new string[] { }, out sqlexec, out sqlresult).Tables[0]; BFService.BigFileService bs = new BFService.BigFileService(CarEnum.BigServiceSysID); foreach (DataRow dr in dt.Rows) { try { string bfidstring = dr["CarImg"].ToString(); string bfid = bfidstring.Substring(bfidstring.LastIndexOf("/") + 1); if (string.IsNullOrEmpty(bs.Delete(bfid))) { MySQL.ExecProc("usp_Car_EmployeePassInfo_ClearImg", new string[] { dr["id"].ToString() }, out sqlexec, out sqlresult); } } catch { } } }
protected void btnClear_Click(object sender, EventArgs e) { DataSet ds = MySQL.ExecProc("usp_Car_PassInfo_GetByDeviceID_ForClear", new string[] { deviceid }, out sqlexec, out sqlresult); BFService.BigFileService bs = new BFService.BigFileService(CarEnum.BigServiceSysID); foreach (DataTable dt in ds.Tables) { foreach (DataRow dr in dt.Rows) { try { string bfidstring = dr["CarImg"].ToString(); string bfid = bfidstring.Substring(bfidstring.LastIndexOf("/") + 1); if (string.IsNullOrEmpty(bs.Delete(bfid))) { MySQL.ExecProc("usp_Car_PassInfo_ClearImg", new string[] { dr["id"].ToString(), dr["TableName"].ToString() }, out sqlexec, out sqlresult); } } catch { } } } Session[WebHint.Web_Hint] = new WebHint("清除成功." + sqlresult, Request.Url.ToString(), HintFlag.跳转); Response.Redirect(WebHint.HintURL); }