Exemple #1
0
        public IList <FormularioValidacaoUC> FiltroPorColuna(string coluna, string searchPhrase)
        {
            var where = "";
            if (!string.IsNullOrWhiteSpace(searchPhrase))
            {
                int id = 0;
                if (int.TryParse(searchPhrase, out id))
                {
                    where += RequerimentoDao.WhereFiltroPorColuna(coluna, searchPhrase);
                }
                else
                {
                    where += string.Format(coluna + ".Contains(\"{0}\")", searchPhrase);
                }
            }
            else
            {
                where = "1=1";
            }

            using (var contexto = new ScirContext())
            {
                var ordenacao = coluna + " ASC";
                return(contexto.FormularioValidacaoUC.AsNoTracking().Where(where).OrderBy(ordenacao).ToList());
            }
        }
Exemple #2
0
        public IList <FormularioValidacaoUC> FiltroPorColuna(string coluna, string searchPhrase)
        {
            var where = "";
            if (!string.IsNullOrWhiteSpace(searchPhrase))
            {
                int id = 0;
                if (int.TryParse(searchPhrase, out id))
                {
                    var filtroFormulario = RequerimentoDao.WhereFiltroPorColuna(coluna, searchPhrase);

                    if (string.IsNullOrWhiteSpace(filtroFormulario))
                    {
                        switch (coluna.ToUpper())
                        {
                        case "UNIDADECURRICULAR":
                            where += string.Format("UNIDADECURRICULARID = {0}", id);
                            break;

                        case "TIPOVALIDACAOCURRICULAR":
                            where += string.Format("TIPOVALIDACAOCURRICULARID = {0}", id);
                            break;
                        }
                    }
                }
                else
                {
                    where += string.Format(coluna + ".Contains(\"{0}\")", searchPhrase);
                }
            }
            else
            {
                where = "1=1";
            }

            using (var contexto = new ScirContext())
            {
                var ordenacao = coluna + " ASC";
                return(contexto.FormularioValidacaoUC.AsNoTracking().Where(where).OrderBy(ordenacao).ToList());
            }
        }