public static DateTimeExpression AddYear(this DateTimeExpression expr, int n) { var newExpr = (DateTimeExpression)expr.Clone(); newExpr._sql = "DATEADD(year, ?, " + newExpr._sql + ")"; newExpr._childExpressions.Insert(0, new Int32ParameterExpression(n)); return(newExpr); }
public static DateTimeExpression AddMonth(this DateTimeExpression expr, int n) { var newExpr = (DateTimeExpression)expr.Clone(); newExpr._sql = "ADD_MONTHS(month, ?, " + newExpr._sql + ")"; newExpr._childExpressions.Insert(0, new Int32ParameterExpression(n)); return(newExpr); }
/// <summary> /// Add seconds to current datetime expression. /// </summary> /// <param name="expr">The expr.</param> /// <param name="n">The number of seconds.</param> /// <returns></returns> public static DateTimeExpression AddSecond(this DateTimeExpression expr, int n) { var newExpr = (DateTimeExpression)expr.Clone(); newExpr.Sql = "DATEADD(second, ?, " + newExpr.Sql + ")"; newExpr.ChildExpressions.Insert(0, new Int32ParameterExpression(n)); return(newExpr); }
public static DateTimeExpression AddMonth(this DateTimeExpression expr, Int32Expression n) { if (n == null) { throw new ArgumentNullException("n"); } var newExpr = (DateTimeExpression)expr.Clone(); newExpr._sql = "DATEADD(month, ?, " + newExpr._sql + ")"; newExpr._childExpressions.Insert(0, n); return(newExpr); }
public static Int32Expression GetSecond(this DateTimeExpression expr) { return(new Int32Expression("DATEPART(second, " + expr._sql + ")", ((DateTimeExpression)expr.Clone())._childExpressions)); }
/// <summary> /// Gets the minute. /// </summary> /// <param name="expr">The expr.</param> /// <returns></returns> public static Int32Expression GetMinute(this DateTimeExpression expr) { return(new Int32Expression("DATEPART(minute, " + expr.Sql + ")", ((DateTimeExpression)expr.Clone()).ChildExpressions)); }