Example #1
0
 public Annotations ReadAnnotations(CultureInfo cultureInfo, ElementRef elementRef, Annotations annotations, IList <string> row)
 {
     for (int i = 0; i < row.Count; i++)
     {
         AnnotationDef.AnnotationTargetSet targets = null;
         if (i == NoteColumn)
         {
             annotations = annotations.ChangeNote(row[i]);
             targets     = NOTE_TARGETS;
         }
         else if (AnnotationColumns[i] != null)
         {
             annotations = SetAnnotationValue(cultureInfo, annotations, AnnotationColumns[i], row[i]);
             targets     = AnnotationColumns[i].AnnotationTargets;
         }
         if (!string.IsNullOrEmpty(row[i]))
         {
             if (targets != null && targets.Intersect(elementRef.AnnotationTargets).IsEmpty)
             {
                 throw AnnotationDoesNotApplyException(GetColumnHeaders()[i], elementRef);
             }
         }
     }
     return(annotations);
 }
Example #2
0
 private Annotations AddAnnotations(Annotations annotations, AnnotationDef.AnnotationTarget annotationTarget)
 {
     annotations = annotations.ChangeAnnotation("Text", annotationTarget + ":" + _counter++);
     if (DocumentAnnotations.NOTE_TARGETS.Contains(annotationTarget))
     {
         annotations = annotations.ChangeNote("Note" + _counter++);
     }
     annotations =
         annotations.ChangeAnnotation("Number", (_counter++ *.1).ToString(CultureInfo.InvariantCulture));
     if (0 != (_elementCount & 2))
     {
         _counter++;
         annotations = annotations.ChangeAnnotation("TrueFalse", "TrueFalse");
     }
     annotations = annotations.ChangeAnnotation(GetAnnotationTargetName(annotationTarget),
                                                annotationTarget + ":" + _counter++);
     return(annotations);
 }