public HttpResponseBase DeleteInspectionRe() { string json = string.Empty; InspectionReportQuery query = new InspectionReportQuery(); List<InspectionReportQuery> list = new List<InspectionReportQuery>(); try { _inspectionReport = new BLL.gigade.Mgr.InspectionReportMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Form["rowID"])) { string rowIDs = Request.Form["rowID"]; if (rowIDs.IndexOf("∑") != -1) { foreach (string id in rowIDs.Split('∑')) { if (!string.IsNullOrEmpty(id)) { query = new InspectionReportQuery(); string[] data = id.Split(','); query.rowID = Convert.ToInt32(data[0]); query.brand_id = Convert.ToUInt32(data[1]); query.product_id = Convert.ToUInt32(data[2]); string oldFileName = data[3]; list.Add(query); #region 刪除圖片 string localInspectionReportPath = imgLocalPath + InspectionReportPath;//圖片存儲地址 string[] dirPath = new string[2]; dirPath[0] = query.brand_id.ToString() + "/".ToString(); dirPath[1] = query.product_id.ToString() + "/".ToString(); string ServerPath = Server.MapPath(imgLocalServerPath + InspectionReportPath + dirPath[0] + dirPath[1]); CommonFunction.DeletePicFile(ServerPath + oldFileName); FTP ftp = new FTP(localInspectionReportPath + dirPath[0] + dirPath[1], ftpuser, ftppwd); List<string> tem = ftp.GetFileList(); if (tem.Contains(oldFileName)) { FTP ftps = new FTP(localInspectionReportPath + dirPath[0] + dirPath[1] + oldFileName, ftpuser, ftppwd); ftps.DeleteFile(localInspectionReportPath + dirPath[0] + dirPath[1] + oldFileName); } #endregion } } } } json = _inspectionReport.DeleteInspectionRe(list); } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }