示例#1
0
 public List <InputQueryResult> Query(Soway.Model.Model model, string text, ModelBindingList source, string Fileter = null, int Size = 10)
 {
     this.Size = Size;
     if (source == null)
     {
         return(QueryFromSql(model, text, Fileter));
     }
     else
     {
         return(QueryFromSource(source, text, Fileter));
     }
 }
示例#2
0
        private List <InputQueryResult> QueryFromSource(ModelBindingList source, string text, string Filter)
        {
            var arry = source.Where(p => (p[p.Model.ShowProperty] ?? "").ToString().Trim().ToUpper().IndexOf((text ?? "").Trim().ToUpper()) >= 0).Select(p =>
                                                                                                                                                         new InputQueryResult()
            {
                Text = (p[p.Model.ShowProperty] ?? "").ToString(),
                id   = p.ID
            });
            List <InputQueryResult> result = new List <InputQueryResult>();

            result.AddRange(arry.ToArray());
            return(result);
        }