| | |
| | | LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition(); |
| | | Expression<Func<TEntity, bool>> expression = GetWhereExpression(property.Name, results[j].Item3, null, expressionType); |
| | | sugarQueryable = sugarQueryable.Where(expression); |
| | | |
| | | //if (j == 0) |
| | | //{ |
| | | // where += "("; |
| | | //} |
| | | //LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition(); |
| | | //if (expressionType == LinqExpressionType.Equal) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.Equal} '{results[j].Item3}'"; |
| | | //} |
| | | //else if (expressionType == LinqExpressionType.ThanOrEqual) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.ThanOrEqual} '{searchParametersList[i].Value}'"; |
| | | //} |
| | | //else if (expressionType == LinqExpressionType.LessThanOrEqual) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.LessOrEqual} '{searchParametersList[i].Value}'"; |
| | | //} |
| | | //else if (expressionType == LinqExpressionType.GreaterThan) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.GT} '{searchParametersList[i].Value}'"; |
| | | //} |
| | | //else if (expressionType == LinqExpressionType.LessThan) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.LT} '{searchParametersList[i].Value}'"; |
| | | //} |
| | | //else if (expressionType == LinqExpressionType.Contains) |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {HtmlElementType.like} '%{searchParametersList[i].Value}%'"; |
| | | //} |
| | | //else |
| | | //{ |
| | | // where += $"{searchParametersList[i].Name} {searchParametersList[i].DisplayType} '{results[j].Item3}'"; |
| | | //} |
| | | |
| | | //if (j == results.Count() - 1) |
| | | //{ |
| | | // where += ")"; |
| | | //} |
| | | //else |
| | | //{ |
| | | // where += " or "; |
| | | //} |
| | | } |
| | | //if (i < searchParametersList.Count - 1) |
| | | // where += " and "; |
| | | } |
| | | return where; |
| | | } |
| | |
| | | } |
| | | |
| | | TEntity entity = saveModel.MainData.DicToModel<TEntity>(); |
| | | |
| | | //List<string> listCol = new List<string>(); |
| | | //foreach (var item in saveModel.MainData) |
| | | //{ |
| | | // PropertyInfo propertyInfo = typeof(TEntity).GetProperty(item.Key); |
| | | // if (propertyInfo == null) |
| | | // { |
| | | // propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToLower()); |
| | | // if (propertyInfo == null) |
| | | // { |
| | | // propertyInfo = typeof(TEntity).GetProperty(item.Key.FirstLetterToUpper()); |
| | | // } |
| | | // } |
| | | |
| | | // listCol.Add(propertyInfo?.Name); |
| | | //} |
| | | |
| | | if (saveModel.DetailData == null || saveModel.DetailData.Count == 0) |
| | | { |