public override TList <ContractNexus> GetPaged(TransactionManager transactionManager, string whereClause, string orderBy, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractNexus_GetPaged", this._useStoredProcedure);

            database.AddInParameter(command, "@WhereClause", DbType.String, whereClause);
            database.AddInParameter(command, "@OrderBy", DbType.String, orderBy);
            database.AddInParameter(command, "@PageIndex", DbType.Int32, start);
            database.AddInParameter(command, "@PageSize", DbType.Int32, pageLength);
            IDataReader           reader = null;
            TList <ContractNexus> rows   = new TList <ContractNexus>();

            try
            {
                try
                {
                    if (transactionManager != null)
                    {
                        reader = Utility.ExecuteReader(transactionManager, command);
                    }
                    else
                    {
                        reader = Utility.ExecuteReader(database, command);
                    }
                    ContractNexusProviderBaseCore.Fill(reader, rows, 0, 0x7fffffff);
                    count = rows.Count;
                    if (reader.NextResult() && reader.Read())
                    {
                        count = reader.GetInt32(0);
                    }
                    return(rows);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
        public override TList <ContractNexus> Find(TransactionManager transactionManager, SqlFilterParameterCollection parameters, string orderBy, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractNexus_Find_Dynamic", typeof(ContractNexusColumn), parameters, orderBy, start, pageLength);

            if (parameters != null)
            {
                for (int i = 0; i < parameters.Count; i++)
                {
                    SqlFilterParameter parameter = parameters[i];
                    database.AddInParameter(command, parameter.Name, parameter.DbType, parameter.Value);
                }
            }
            TList <ContractNexus> rows   = new TList <ContractNexus>();
            IDataReader           reader = null;

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, command);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, command);
                }
                ContractNexusProviderBaseCore.Fill(reader, rows, 0, 0x7fffffff);
                count = rows.Count;
                if (!reader.NextResult())
                {
                    return(rows);
                }
                if (reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
        public override ContractNexus GetByContractNexusCode(TransactionManager transactionManager, string contractNexusCode, int start, int pageLength, out int count)
        {
            SqlDatabase database = new SqlDatabase(this._connectionString);
            DbCommand   command  = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractNexus_GetByContractNexusCode", this._useStoredProcedure);

            database.AddInParameter(command, "@ContractNexusCode", DbType.AnsiString, contractNexusCode);
            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);
                count = -1;
                if (reader.NextResult() && reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            if (rows.Count == 1)
            {
                return(rows[0]);
            }
            if (rows.Count != 0)
            {
                throw new DataException("Cannot find the unique instance of the class.");
            }
            return(null);
        }
        public override TList <ContractNexus> GetAll(TransactionManager transactionManager, int start, int pageLength, out int count)
        {
            SqlDatabase           database  = new SqlDatabase(this._connectionString);
            DbCommand             dbCommand = StoredProcedureProvider.GetCommandWrapper(database, "dbo.ContractNexus_Get_List", this._useStoredProcedure);
            IDataReader           reader    = null;
            TList <ContractNexus> rows      = new TList <ContractNexus>();

            try
            {
                if (transactionManager != null)
                {
                    reader = Utility.ExecuteReader(transactionManager, dbCommand);
                }
                else
                {
                    reader = Utility.ExecuteReader(database, dbCommand);
                }
                ContractNexusProviderBaseCore.Fill(reader, rows, start, pageLength);
                count = -1;
                if (!reader.NextResult())
                {
                    return(rows);
                }
                if (reader.Read())
                {
                    count = reader.GetInt32(0);
                }
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
            }
            return(rows);
        }
        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);
        }