/// <summary> /// Creates an <see cref="System.Data.IDbCommand"/> object for the specified search criteria. /// </summary> /// <param name="whereSql">The SQL search condition. For example: "FirstName='Smith' AND Zip=75038".</param> /// <param name="orderBySql">The column name(s) followed by "ASC" (ascending) or "DESC" (descending). /// Columns are sorted in ascending order by default. For example: "LastName ASC, FirstName ASC".</param> /// <returns>A reference to the <see cref="System.Data.IDbCommand"/> object.</returns> protected virtual IDbCommand CreateGetCommand(string whereSql, string orderBySql) { string sql = "SELECT * FROM [dbo].[Schedule]"; if (null != whereSql && 0 < whereSql.Length) { sql += " WHERE " + whereSql; } if (null != orderBySql && 0 < orderBySql.Length) { sql += " ORDER BY " + orderBySql; } return(_db.CreateCommand(sql)); }
/// <summary> /// Creates an <see cref="System.Data.IDbCommand"/> object for the specified search criteria. /// </summary> /// <param name="whereSql">The SQL search condition. For example: "FirstName='Smith' AND Zip=75038".</param> /// <param name="orderBySql">The column name(s) followed by "ASC" (ascending) or "DESC" (descending). /// Columns are sorted in ascending order by default. For example: "LastName ASC, FirstName ASC".</param> /// <returns>A reference to the <see cref="System.Data.IDbCommand"/> object.</returns> protected virtual IDbCommand CreateGetCommand(string whereSql, string orderBySql) { var sql = "SELECT * FROM [dbo].[Route]"; if (!string.IsNullOrEmpty(whereSql)) { sql += " WHERE " + whereSql; } if (!string.IsNullOrEmpty(orderBySql)) { sql += " ORDER BY " + orderBySql; } return(_db.CreateCommand(sql)); }