Пример #1
0
        public static PreguntaFormularioModelCollection GetPreguntas(FormularioModel formulario)
        {
            //Query subSupQuery = new Query();
            //subSupQuery.Distinct = true;
            //subSupQuery.Select("pf.idPregunta");
            //subSupQuery.From("PreguntaFormulario", "pf");
            //subSupQuery.Where(new AttributeTest("pf.idFormulario", idFormulario, AttributeTest.EQUAL));

            //AttributeTest filterTest = new AttributeTest();
            //filterTest.Attribute = "idPregunta";
            //filterTest.Value = subSupQuery;
            //filterTest.Operator = AttributeTest.IN;

            //SortCriteria sort = new SortCriteria();
            //sort.Add("idPregunta", (int)SortOrderType.Ascending);

            //Query filterQuery = new Query();
            //filterQuery.Where(filterTest);
            //filterQuery.SortCriteria = sort;

            // Pregunta.FindWithQuery(filterQuery)

            AttributeTest filterTest = new AttributeTest();

            filterTest.Attribute = "idFormulario";
            filterTest.Value     = formulario.IdFormulario;
            filterTest.Operator  = AttributeTest.EQUAL;

            SortCriteria sort = new SortCriteria();

            sort.Add("idPregunta", (int)SortOrderType.Ascending);

            Query filterQuery = new Query();

            filterQuery.Where(filterTest);
            filterQuery.SortCriteria = sort;

            return(new PreguntaFormularioModelCollection(PreguntaFormulario.FindWithQuery(filterQuery)));
        }
        public static PreguntaFormularioModelCollection GetPreguntas(FormularioModel formulario)
        {
            //Query subSupQuery = new Query();
            //subSupQuery.Distinct = true;
            //subSupQuery.Select("pf.idPregunta");
            //subSupQuery.From("PreguntaFormulario", "pf");
            //subSupQuery.Where(new AttributeTest("pf.idFormulario", idFormulario, AttributeTest.EQUAL));

            //AttributeTest filterTest = new AttributeTest();
            //filterTest.Attribute = "idPregunta";
            //filterTest.Value = subSupQuery;
            //filterTest.Operator = AttributeTest.IN;

            //SortCriteria sort = new SortCriteria();
            //sort.Add("idPregunta", (int)SortOrderType.Ascending);

            //Query filterQuery = new Query();
            //filterQuery.Where(filterTest);
            //filterQuery.SortCriteria = sort;

            // Pregunta.FindWithQuery(filterQuery)

            AttributeTest filterTest = new AttributeTest();
            filterTest.Attribute = "idFormulario";
            filterTest.Value = formulario.IdFormulario;
            filterTest.Operator = AttributeTest.EQUAL;

            SortCriteria sort = new SortCriteria();
            sort.Add("idPregunta", (int)SortOrderType.Ascending);

            Query filterQuery = new Query();
            filterQuery.Where(filterTest);
            filterQuery.SortCriteria = sort;

            return new PreguntaFormularioModelCollection(PreguntaFormulario.FindWithQuery(filterQuery));
        }
Пример #3
0
 /// <summary>
 /// Adds a <c>Sort</c> criteria to the options.
 /// </summary>
 /// <param name="sort">The sort criteria to add</param>
 /// <see cref="Sort"/>
 protected void AddSortCriteria(Sort sort) => SortCriteria.Add(sort);