public WhereClass IsBetweenDate(Column c, DateTime date1, DateTime date2) { string date1String = date1.ToString("yyyy-MM-dd"); string date2String = date2.AddDays(1).ToString("yyyy-MM-dd"); WhereClass d1WC = this.IsMoreThanEqual(c, date1String); WhereClass d2WC = this.IsLessThan(c, date2String); return(new WhereClass(d1WC + " AND " + d2WC)); }
/// <summary> /// A <see cref="WhereClass"/> for an SQL more than or equal to check. To be used in conjunction with a Where method. /// Takes a <see cref="Column"/> and an <see cref="object"/>. /// </summary> /// <param name="column1">The <see cref="Column"/> to be checked.</param> /// <param name="o">The <see cref="object"/> to be checked.</param> /// <returns>A <see cref="WhereClass"/> that represents the more than or equal to statement in SQL.</returns> public WhereClass IsMoreThanEqual(Column column1, object o) { WhereClass result; if (o is Column) { result = new WhereClass(column1 + " >= " + o.ToString()); } else { result = new WhereClass(column1 + " >= '" + o.ToString() + "'"); } return(result); }
/// <summary> /// A <see cref="WhereClass"/> for an SQL less than check. To be used in conjunction with a Where method. /// Takes a <see cref="Column"/> and an <see cref="object"/>. /// </summary> /// <param name="column1">The <see cref="Column"/> to be checked.</param> /// <param name="o">The <see cref="object"/> to be checked.</param> /// <returns>A <see cref="WhereClass"/> that represents the less than statement in SQL.</returns> public WhereClass IsLessThan(Column column1, object o) { WhereClass result; if (o is Column) { result = new WhereClass(column1 + " < " + o.ToString()); } else { result = new WhereClass(column1 + " < '" + o.ToString() + "'"); } return(result); }
/// <summary> /// A <see cref="WhereClass"/> for an SQL equals check. To be used in conjunction with a Where method. /// Takes a <see cref="Column"/> and an <see cref="object"/>. /// </summary> /// <param name="column1">The <see cref="Column"/> to be checked.</param> /// <param name="o">The <see cref="object"/> to be checked.</param> /// <returns>A <see cref="WhereClass"/> that represents the equality check in SQL.</returns> public WhereClass IsEqual(Column column1, object o) { WhereClass result; if (o is Column || o is int) { result = new WhereClass(column1 + " = " + o.ToString()); } else { result = new WhereClass(column1 + " = '" + o.ToString() + "'"); } return(result); }