예제 #1
0
        public static List<TipoPrimarioHistologia> CodigoTipoHistologico(string searchText, int maxResults, int code)
        {
            Repositorio repo = new Repositorio();
            List<TipoPrimarioHistologia> names = new List<TipoPrimarioHistologia>();
            DataSet sitiosDset = repo.GetTiposHistologicos();

            foreach (DataRow row in sitiosDset.Tables[0].Rows)
                names.Add(new TipoPrimarioHistologia { id = row.ItemArray[2].ToString(), code = row.ItemArray[0].ToString(), desc = row.ItemArray[1].ToString() });

            if (code == 1)
            {
                var result = from n in names
                             where n.code.ToUpper().Contains(searchText.ToUpper())
                             orderby n.code
                             select n;

                return result.Take(maxResults).ToList();
            }
            else
            {
                var result = from n in names
                             where RemoveDiacritics(n.desc).ToUpper().Contains(searchText.ToUpper())
                             orderby n.desc
                             select n;

                return result.Take(maxResults).ToList();
            }
        }