Exemplo n.º 1
0
        protected override void OnParsing(XElement existingQuery)
        {
            var existingClauses = existingQuery.Elements().Select(CamlClause.GetClause).ToList();

            Where   = existingClauses.OfType <CamlWhere>().FirstOrDefault();
            OrderBy = existingClauses.OfType <CamlOrderBy>().FirstOrDefault();
            GroupBy = existingClauses.OfType <CamlGroupBy>().FirstOrDefault();
        }
Exemplo n.º 2
0
        public static CamlGroupBy BeforeBy(this CamlGroupBy groupBy, CamlFieldRef fieldRef, bool?collapse = null, int?limit = null)
        {
            if (groupBy == null)
            {
                return(new CamlGroupBy(fieldRef, collapse, limit));
            }
            if (groupBy.Collapse != null)
            {
                collapse = collapse == null ? groupBy.Collapse.Value : collapse.Value | groupBy.Collapse.Value;
            }
            if (groupBy.Limit != null)
            {
                limit = limit == null ? groupBy.Limit.Value : Math.Max(limit.Value, groupBy.Limit.Value);
            }
            var fields = new List <CamlFieldRef> {
                fieldRef
            };

            fields.AddRange(groupBy);
            return(new CamlGroupBy(fields, collapse, limit));
        }
Exemplo n.º 3
0
 public static CamlGroupBy BeforeBy(this CamlGroupBy groupBy, string fieldName, bool?collapse = null, int?limit = null)
 {
     return(groupBy.BeforeBy(new CamlFieldRef {
         Name = fieldName, Ascending = false
     }, collapse, limit));
 }
Exemplo n.º 4
0
 public static CamlGroupBy BeforeBy(this CamlGroupBy groupBy, Guid fieldId, bool?collapse = null, int?limit = null)
 {
     return(groupBy.BeforeBy(new CamlFieldRef {
         Id = fieldId, Ascending = false
     }, collapse, limit));
 }