//字段名 表名都是动态传入的
protected static bool IsDuplicate(HRPaidTimeOffDataContext db, string tableName, string fieldName, string fieldNameId, DateTime value, int id)
{
string sql = "select count("+fieldNameId+") as DuplicateCount from "+tableName
+" where "+fieldName+"={0} and "+fieldNameId+"<>{1}";
var result= db.ExecuteQuery<DuplicateCheck>(sql, new object[] { value, id }).ToList();
List<DuplicateCheck> list = result.ToList();
return list[0].DuplicateCount > 0;
}