public override TList <ContractNexus> Find(TransactionManager transactionManager, string whereClause, int start, int pageLength, out int count) { count = -1; if (whereClause.IndexOf(";") > -1) { return(new TList <ContractNexus>()); } SqlDatabase database = new SqlDatabase(this._connectionString); DbCommand command = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractNexus_Find", this._useStoredProcedure); bool flag = false; if (whereClause.IndexOf(" OR ") > 0) { flag = true; } database.AddInParameter(command, "@SearchUsingOR", DbType.Boolean, flag); database.AddInParameter(command, "@ContractNexusCode", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@ContractCode", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@ContractChangeCode", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Code", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Type", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Name", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@ID", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Person", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Date", DbType.DateTime, DBNull.Value); database.AddInParameter(command, "@Path", DbType.AnsiString, DBNull.Value); database.AddInParameter(command, "@Money", DbType.Decimal, DBNull.Value); whereClause = whereClause.Replace(" AND ", "|").Replace(" OR ", "|"); string[] textArray = whereClause.ToLower().Split(new char[] { '|' }); char[] trimChars = new char[] { '=' }; char[] chArray2 = new char[] { '\'' }; foreach (string text in textArray) { if (text.Trim().StartsWith("contractnexuscode ") || text.Trim().StartsWith("contractnexuscode=")) { database.SetParameterValue(command, "@ContractNexusCode", text.Replace("contractnexuscode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("contractcode ") || text.Trim().StartsWith("contractcode=")) { database.SetParameterValue(command, "@ContractCode", text.Replace("contractcode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("contractchangecode ") || text.Trim().StartsWith("contractchangecode=")) { database.SetParameterValue(command, "@ContractChangeCode", text.Replace("contractchangecode", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("code ") || text.Trim().StartsWith("code=")) { database.SetParameterValue(command, "@Code", text.Replace("code", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("type ") || text.Trim().StartsWith("type=")) { database.SetParameterValue(command, "@Type", text.Replace("type", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("name ") || text.Trim().StartsWith("name=")) { database.SetParameterValue(command, "@Name", text.Replace("name", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("id ") || text.Trim().StartsWith("id=")) { database.SetParameterValue(command, "@ID", text.Replace("id", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("person ") || text.Trim().StartsWith("person=")) { database.SetParameterValue(command, "@Person", text.Replace("person", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("date ") || text.Trim().StartsWith("date=")) { database.SetParameterValue(command, "@Date", text.Replace("date", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else if (text.Trim().StartsWith("path ") || text.Trim().StartsWith("path=")) { database.SetParameterValue(command, "@Path", text.Replace("path", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } else { if (!text.Trim().StartsWith("money ") && !text.Trim().StartsWith("money=")) { throw new ArgumentException("Unable to use this part of the where clause in this version of Find: " + text); } database.SetParameterValue(command, "@Money", text.Replace("money", "").Trim().TrimStart(trimChars).Trim().Trim(chArray2)); } } IDataReader reader = null; TList <ContractNexus> rows = new TList <ContractNexus>(); try { if (transactionManager != null) { reader = Utility.ExecuteReader(transactionManager, command); } else { reader = Utility.ExecuteReader(database, command); } ContractNexusProviderBaseCore.Fill(reader, rows, start, pageLength); if (reader.NextResult() && reader.Read()) { count = reader.GetInt32(0); } } finally { if (reader != null) { reader.Close(); } } return(rows); }