/// <summary>Expresión lógica que permite uso de OR y agrega comillas en caso de ser requeridas</summary> public static Expression WhereVal(dbCom comp, Expression val, params string[] values) { Expression[] quotedValues = values.Select(v => (Expression)AddSingleQuotesIfMissing(v)).ToArray(); Comparison whr = Log(dbLog.Where, comp, val, quotedValues); return(new Expression(dbLog.Where, whr)); }
/// <summary>Or para expresión lógica agregando comillas en caso de ser requeridas</summary> public Expression OrVal(dbCom comp, Expression val, params string[] values) { Expression[] quotedValues = values.Select(v => (Expression)AddSingleQuotesIfMissing(v)).ToArray(); Comparison whr = Log(dbLog.And, comp, val, quotedValues); return(this.Operate(dbLog.Or, whr)); }
private static Comparison Log(dbLog log, dbCom comp, Expression val, params Expression[] values) { Comparison whr = new Comparison(); whr.comparator = val.ToString(); whr.type = comp; whr.values = values.Select(v => v.ToString()).ToList(); return(whr); }
/// <summary>Agrega una condicion al listado de condiciones de agrupacion</summary> public Query Having(dbCom oper, Expression comp1, params Expression[] comp2) { Comparison whr = new Comparison(); whr.comparator = comp1.ToString(); whr.type = oper; whr.values = comp2.Select(c => c.ToString()).ToList(); curUnion.lstHaving.Add(whr); return(this); }
/// <summary>Agrega una o varias condiciones al listado de condiciones</summary> public Query Where(dbCom comp, Expression val, params Expression[] values) { Comparison whr = new Comparison(); whr.comparator = val.ToString(); whr.type = comp; whr.values = values.Select(v => v.ToString()).ToList(); curUnion.lstWhere.Add(whr); return(this); }
/// <summary>Agrega una condicion de union para las tablas</summary> public Query JoinOn(dbCom comp, Expression value1, params Expression[] values) { Comparison whr = new Comparison(); whr.comparator = value1.ToString(); whr.type = comp; whr.values = values.Select(v => v.ToString()).ToList(); whr.owner = curUnion.lstFrom.Last().tableAlias; curUnion.lstJoinOn.Add(whr); return(this); }
/// <summary>Devuelve los caracteres específicos para la comparación de base de datos</summary> private string dbComToString(dbCom Com) { switch (Com) { case dbCom.Equals: return("="); case dbCom.MoreThan: return(">"); case dbCom.LessThan: return("<"); case dbCom.MoreThanOrEquals: return(">="); case dbCom.LessThanOrEquals: return("<="); case dbCom.DifferentFrom: return("<>"); case dbCom.Iss: return("IS"); case dbCom.IssNot: return("IS NOT"); case dbCom.IssIn: return("IN"); case dbCom.IssNotIn: return("NOT IN"); case dbCom.Like: return("LIKE"); case dbCom.NotLike: return("NOT LIKE"); } return(""); }
/// <summary>Or para expresión lógica</summary> public Expression Or(dbCom comp, Expression val, params Expression[] values) { Comparison whr = Log(dbLog.And, comp, val, values); return(this.Operate(dbLog.Or, whr)); }
/// <summary>Expresión lógica que permite uso de OR</summary> public static Expression Where(dbCom comp, Expression val, params Expression[] values) { Comparison whr = Log(dbLog.Where, comp, val, values); return(new Expression(dbLog.Where, whr)); }
/// <summary>Agrega una condicion a valor al listado de condiciones</summary> public Query WhereVal(dbCom comp, Expression val, params string[] values) { Expression[] expr = values.Select(s => (Expression)(AddSingleQuotesIfMissing(s))).ToArray(); return(Where(comp, val, expr)); }
/// <summary>Agrega una o varias condiciones al listado de condiciones</summary> public Query Where(dbCom comp, Expression val, params int[] values) { return(Where(comp, val, values.Select(v => (Expression)v).ToArray())); }
/// <summary>Agrega una o varias condiciones envasadas al listado de condiciones</summary> public Query Where(dbCom comp, Expression val, params object[] values) { return(Where(comp, val, values.Select(v => ObjectToExpression(v)).ToArray())); }
/// <summary>Agrega una condicion de union a valor para las tablas</summary> public Query JoinOnVal(dbCom comp, string value1, params string[] values) { Expression[] expr = values.Select(s => (Expression)(AddSingleQuotesIfMissing(s))).ToArray(); return(JoinOn(dbCom.Equals, value1, expr)); }