public override BoolExpressionSqlPart GetSqlPart(int index) { BoolExpressionSqlPart result = new BoolExpressionSqlPart(); string sqlPramName = ""; //如果参数名不为空 if (String.IsNullOrEmpty(this.ParamName) == false) { //检查是否已经有了参数 var param = this.Onwer.ReportParams.FirstOrDefault(p => p.Name == this.ParamName); if (param == null) { //如果没有,加入 this.Onwer.ReportParams.Add(new ReportParameter() { Name = this.ParamName, Exp = "@p" + index, FmtValue = this.ValueStr, Value = (this.Value ?? "").ToString() }); result.Parameters.Add(new QueryParameter() { Column = this.Col, SqlParam = new System.Data.SqlClient.SqlParameter("@p" + index.ToString(), this.Value) }); sqlPramName = "@p" + index; } else { //如果有了,不处理 进行取值 this.ValueStr = param.FmtValue; this.Value = param.Value; sqlPramName = param.Exp; } } else { result.Parameters.Add(new QueryParameter() { Column = this.Col, SqlParam = new System.Data.SqlClient.SqlParameter("@p" + index.ToString(), this.Value) }); sqlPramName = "@p" + index.ToString(); } result.Stript = string.Format(this.Op.DBName, String.Format("[{0}].[{1}]", this.Col.SelectedTableName, this.Col.Col.DBName), sqlPramName); return(result); }
public override BoolExpressionSqlPart GetSqlPart(int index) { int i = index; BoolExpressionSqlPart result = new BoolExpressionSqlPart(); var temp = First.Exp.GetSqlPart(i); i += temp.Parameters.Count; result.Parameters.AddRange(temp.Parameters.ToArray()); result.Stript = "(" + temp.Stript + ")"; foreach (var add in this.Sequeces) { temp = add.BoolExpression.Exp.GetSqlPart(i); i += temp.Parameters.Count; result.Parameters.AddRange(temp.Parameters.ToArray()); result.Stript += add.BoolOp.DBName + "(" + temp.Stript + ")"; } return(result); }