public bool ExistsAnyConflict(string itemKey)
{
string sql = string.Format("SELECT count(*) FROM EVENT e " +
" LEFT JOIN RepositoryItem it on e.ItemId = it.RepositoryItemID" +
" LEFT JOIN RepositoryItem ri on it.ResultItemId = ri.RepositoryItemID" +
" WHERE SYNCHRONIZED <> '{0}' AND " +
" (it.RepositoryItemKey LIKE '{1}%' OR it.RepositoryItemKey LIKE '%{1}' OR ri.RepositoryItemKey LIKE '{1}%' OR ri.RepositoryItemKey LIKE '%{1}') AND e.RepositoryId = '{2}'", bool.TrueString, itemKey.Replace("'","''"), repo.Id);
System.Object temp = database.ExecuteScalar(sql);
int count = int.Parse(temp.ToString());
if (count > 0)
{
return true;
}
return false;
}