public esCase Else(esQueryItem queryItem)
        {
            esExpression expression = queryItem;

            this.data.Else = expression;

            return(this);
        }
        public esCase Then(esExpression expression)
        {
            esSimpleCaseData.esCaseClause clause = new esSimpleCaseData.esCaseClause();
            clause.When = this.WhenItem;
            clause.Then = expression;

            if (data.Cases == null)
            {
                data.Cases = new List <esSimpleCaseData.esCaseClause>();
            }

            this.data.Cases.Add(clause);

            return(this);
        }
        protected static string GetExpressionColumn(StandardProviderParameters std, esDynamicQuerySerializable query, esExpression expression, bool inExpression, bool useAlias)
        {
            string sql = String.Empty;

            if (expression.CaseWhen != null)
            {
                return GetCaseWhenThenEnd(std, query, expression.CaseWhen);
            }

            if (expression.HasMathmaticalExpression)
            {
                sql += GetMathmaticalExpressionColumn(std, query, expression.MathmaticalExpression);
            }
            else
            {
                sql += GetColumnName(expression.Column);
            }

            if (expression.SubOperators != null)
            {
                if (expression.Column.Distinct)
                {
                    sql = BuildSubOperationsSql(std, "DISTINCT " + sql, expression.SubOperators);
                }
                else
                {
                    sql = BuildSubOperationsSql(std, sql, expression.SubOperators);
                }
            }

            if (!inExpression && useAlias)
            {
                if (expression.SubOperators != null || expression.Column.HasAlias)
                {
                    sql += " AS " + Delimiters.StringOpen + expression.Column.Alias + Delimiters.StringClose;
                }
            }

            return sql;
        }
 public esCase When(esExpression ex)
 {
     return(this);
 }
 public esCase Else(esExpression expression)
 {
     this.data.Else = expression;
     return(this);
 }
        protected static string GetExpressionColumn(esExpression expression, bool inExpression, bool useAlias)
        {
            string sql = String.Empty;

            if (expression.HasMathmaticalExpression)
            {
                sql += GetMathmaticalExpressionColumn(expression.MathmaticalExpression);
            }
            else
            {
                sql += GetColumnName(expression.Column);
            }

            if (expression.SubOperators != null)
            {
                if (expression.Column.Distinct)
                {
                    sql = BuildSubOperationsSql("DISTINCT " + sql, expression.SubOperators);
                }
                else
                {
                    sql = BuildSubOperationsSql(sql, expression.SubOperators);
                }
            }

            if (!inExpression && useAlias)
            {
                if (expression.SubOperators != null || expression.Column.HasAlias)
                {
                    sql += " AS " + Delimiters.StringOpen + expression.Column.Alias + Delimiters.StringClose;
                }
            }

            return sql;
        }
 public esCase When(esExpression ex)
 {
     return this;
 }
 public esCase Else(esExpression expression)
 {
     this.data.Else = expression;
     return this;
 }
        public esCase Then(esExpression expression)
        {
            esSimpleCaseData.esCaseClause clause = new esSimpleCaseData.esCaseClause();
            clause.When = this.WhenItem;
            clause.Then = expression;

            if (data.Cases == null)
            {
                data.Cases = new List<esSimpleCaseData.esCaseClause>();
            }

            this.data.Cases.Add(clause);

            return this;
        }