public int Finish(TaskWork entity) { if (string.IsNullOrEmpty(entity.RefID.Trim()) && string.IsNullOrEmpty(entity.SourceCode.Trim())) { throw new ArgumentException("必须设置引用ID,来源编号"); } string sql = string.Format("SELECT * FROM taskWork WHERE RefID = '{0}' and SourceCode = '{1}'", entity.RefID, entity.SourceCode); if (!string.IsNullOrEmpty(entity.ReceiverAccount.Trim())) { sql += string.Format(" AND ReceiverAccount = '{0}'", entity.ReceiverAccount); } var list = TaskWork.SqlQuery <TaskWork>(sql, null); return(TaskWork.Update(list.ToArray())); }