public void Delete(string WorkerID, List <int> RowNoList) { //db.Open(); string query = "select RowNo from WorkerAttachment " + " where WorkerID = @WorkerID and RowNo not in @RowNoList;delete from WorkerAttachment " + " where WorkerID = @WorkerID and RowNo not in @RowNoList"; var result = db.Query(query, new { WorkerID = WorkerID, RowNoList = RowNoList }, this.transaction); foreach (var obj in result) { GlobalSetting.DeleteFile(string.Format("{0}_{1}", WorkerID, obj.RowNo)); } //db.Close(); }