Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public static Int32Expression GetSecond(this DateTimeExpression expr)
 {
     return(new Int32Expression("DATEPART(second, " + expr._sql + ")", ((DateTimeExpression)expr.Clone())._childExpressions));
 }
Exemplo n.º 6
0
 /// <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));
 }