Exemplo n.º 1
0
 private bool IsDuplicateEvent(
     NotifyCollectionChangedEventArgs e,
     GridGroupByFieldCollection otherCollection)
 {
     if (e.Action == NotifyCollectionChangedAction.ItemChanged)
     {
         GridGroupByField newItem = e.NewItems[0] as GridGroupByField;
         if (otherCollection.Contains(newItem))
         {
             NotifyCollectionChangedEventArgs changedEventArgs = this.duplicateEventsList.Find((Predicate <NotifyCollectionChangedEventArgs>)(args =>
             {
                 if (args.NewItems[0] == e.NewItems[0])
                 {
                     return(args.PropertyName == e.PropertyName);
                 }
                 return(false);
             }));
             if (changedEventArgs == null)
             {
                 this.duplicateEventsList.Add(e);
                 return(true);
             }
             this.duplicateEventsList.Remove(changedEventArgs);
         }
     }
     return(false);
 }
Exemplo n.º 2
0
        private static void UpdateFieldNameAndAliasReferences(
            GridGroupByFieldCollection list,
            GridGroupByField groupByField)
        {
            GridGroupByExpression.UpdateReference(list, groupByField);
            GridGroupByField byName = list.FindByName(groupByField.FieldName);

            if (byName != null && (byName.IsFieldAliasSet && groupByField.IsFieldAliasSet && byName.Aggregate == groupByField.Aggregate ^ string.Compare(byName.FieldAlias, groupByField.FieldAlias) == 0))
            {
                throw new FormatException("Same aggregates on same field should have same alias.");
            }
        }
Exemplo n.º 3
0
        private static void UpdateGroupByReferences(
            GridGroupByFieldCollection list,
            GridGroupByField groupByField)
        {
            GridGroupByField gridGroupByField = list.Find(groupByField.FieldName);

            if (gridGroupByField == null)
            {
                return;
            }
            groupByField.FieldName = gridGroupByField.FieldName;
            if (!gridGroupByField.IsFieldAliasSet)
            {
                return;
            }
            groupByField.FieldAlias = gridGroupByField.FieldAlias;
        }
Exemplo n.º 4
0
        private static void UpdateReference(GridGroupByFieldCollection list, GridGroupByField ggbf)
        {
            GridGroupByField byAlias = list.FindByAlias(ggbf.FieldName);

            if (byAlias == null)
            {
                return;
            }
            if (byAlias.IsAggregate && ggbf.IsAggregate)
            {
                throw new FormatException(string.Format("Cannot create aggregate of aggregate: {0}({1}({2}))", (object)byAlias.Aggregate, (object)ggbf.Aggregate, (object)byAlias.FieldName));
            }
            ggbf.FieldName = byAlias.FieldName;
            if (!byAlias.IsAggregate)
            {
                return;
            }
            ggbf.Aggregate = byAlias.Aggregate;
        }