Class ReportCollection

A collection of reports. The collection is automatically loaded when Stonefield Query starts from the report files in the folder specified in the RootFolder property.

System.Object
  Stonefield.Collections.BaseKeyedCollection<IReportBase>
    Stonefield.Query.ReportEngine.ReportCollection
public class ReportCollection : BaseKeyedCollection<IReportBase>, IReportCollection

Class Members

MemberDescription

Constructor

The constructor.

CollectionChanged

ReportCollectionUpdated

Raised when the report collection has been updated.

ReportExtension

The extension for report files; set to "sfx".

Add

Adds an item to the collection.

public virtual void Add(IReport item);

Any

public bool Any(Func<IReportBase,Boolean> predicate);

public sealed bool Any(Func<IReportBase,Boolean> predicate)

Clear

Clears the collection.

public virtual void Clear();

Contains

Returns true if the collection contains the specified item.

public sealed bool Contains(IReport item);

public virtual bool Contains(IReportBase item);

CopyReport

Copies the specified report to the specified name and adds the copy to the collection.

public sealed IReport CopyReport(IReport report,
    string name,
    string fileName);

public sealed IReportBase CopyReport(IReportBase report,
    string name,
    string fileName);

public sealed IReportBase CopyReport(IReportBase report,
    string name)

CopyTo

Copies the set of reports to an array.

public virtual void CopyTo(IReport[] array,
    int arrayIndex);

public virtual void CopyTo(IReportBase[] array,
    int arrayIndex);

DoneEditingReport

Removes the specified report from the list of reports being edited.

public sealed void DoneEditingReport(IReportBase report)

EditReport

Add the specified report to the list of reports being edited.

public sealed bool EditReport(IReportBase report)

Except

Produces the set difference of two sequences by using the default equality comparer to compare values.

public sealed IEnumerable Except(IEnumerable col)

GetEnumerator

Gets a custom enumerator for the collection.

public sealed IEnumerator<IReport> GetEnumerator();

GetItem

Returns the item with the specified name or ID.

public sealed IReport GetItem(string name);

public sealed IReport GetItem(int index);

GetItems

Returns an array with all items in the collection.

public IReport[] GetItems();

GetReportsForTag

Returns a list of reports with the specified tag.

public sealed List<IReport> GetReportsForTag(ITag tag);

Import

Import a report.

public sealed IReport Import(string fileName);

LoadReport

Loads the specified report and adds it the collection.

public sealed IReport LoadReport(string fileName);

LoadReports

Loads the collection from the serialized report XML files in the root folder and all subdirectories.

public sealed void LoadReports();

New

Creates an item and adds it to the collection.

public virtual IReport New(string name);

public virtual IReport New();

public sealed IReport New(ReportTypes reportType);

ReloadReports

Reloads the reports.

public sealed void ReloadReports();

Remove

Deletes the report file when it's removed from the collection.

public virtual bool Remove(IReport item);

public virtual bool Remove(IReportBase item);

Where

public IEnumerable<IReportBase> Where(Func<IReportBase,Boolean> predicate);

public sealed IEnumerable<IReportBase> Where(Func<IReportBase,Boolean> predicate)

Count

The number of items in the collection.

IsReadOnly

Indicates whether the collection is read-only.

Item

ReportsBeingEdited

A list of reports currently being edited in the UI.

RootFolder

The root folder for all report folders.

Example

// This example, taken from the Sample WinForm Application sample,
// loads a TreeView control with tags and the reports that belong
// to them. The parentTag parameter is the parent tag to get child
// tags and reports for. The parent parameter is the TreeView node
// for the parent of new nodes.

private void GetTags(ITag parentTag, TreeNode parent)
{
   List<ITag> tags;
   List<IReport> reports;

   // If a parent tag wasn't specified, get all top-level tags.
   // Otherwise, get the child tags for the specified parent tag.
   if (parentTag == null)
   {
      tags = app.ReportEngine.Tags
         .Where(t => t.ParentTag == null)
         .OrderBy(t => t.Name).ToList();
   }
   else
   {
      tags = app.ReportEngine.Tags
         .Where(t => t.ParentTag == parentTag)
         .OrderBy(t => t.Name).ToList();
   }

   // Process each tag.
   foreach (ITag tag in tags)
   {
      TreeNode tagNode;

      // Localize the name.
      string name = app.Localizer.LanguageResources[tag.Name];

      // Add it to the TreeView, either under the specified node
      // or in the TreeView root.
      if (parent == null)
      {
         tagNode = reportsTreeView.Nodes.Add("", name, "Folder");
      }
      else
      {
         tagNode = parent.Nodes.Add("", name, "Folder");
      }

      // Call ourselves recursively to get any child tags for this one.
      GetTags(tag, tagNode);

      // Get the reports for the tag and add them to the TreeView.
      // Note that the in the ImageList we're using have keys the
      // same as the report type.
      reports = app.ReportEngine.Reports.GetReportsForTag(tag);
      foreach (IReport report in reports)
      {
         tagNode.Nodes.Add(report.ID.ToString(), report.Name,
            report.GetType().Name, report.GetType().Name);
      }
   }
}

Requirements

Namespace: Stonefield.Query.ReportEngine
Assembly: reports.dll