Xafari Reports. Visual Studio Template

There is a Visual Studio project item template that declares Xafari Report, it available via the Add | New Item... context menu command in the Solution Explorer. Xafari Report template is placed in the Xafari category. Template includes the declaration and initial implementation of the required classes and interfaces.  

  • c#
  • VB

// For more typical usage scenarios, be sure to check out http://galaktikasoft.com/documentation/xafari/reports.html .
public class Report1 : XafariReport<Report1Data, Report1Parameters, Report1DataMinerOperation>
{
}
public class Report1Data : XafariReportDataBase
{//// Define data source properties here.
  //// To have an opportunity use parameter’s fields in the report header and CollectDataSpecificationAttribute.
  //public Report1Parameters Parameters { get; set; }
  //// Criteria and Sorting can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase class GetCriteria and GetSorting methods overrides.
  //[CollectDataSpecification("Date >= ? ", "Parameters.DateFrom", "Date:Ascending")]
  //public IList<DataType> Lines { get; set; }
}
//[XafDisplayName("Report parameters")]
[DomainComponent, DeferredDeletion(false)]
public interface Report1Parameters : XafariReportParametersBase
{//[XafDisplayName("Date from")]
  //[Custom("DisplayFormat", "{0:dd.MM.yyyy HH:mm}"), Custom("EditMask", "dd.MM.yyyy HH:mm")]
  //DateTime DateFrom { get; set; }
}
// Register Report1Parameters domain component by overriding the Setup method in a ModuleBase class descendant (http://documentation.devexpress.com/#Xaf/CustomDocument3261):
//public override void Setup(XafApplication application) {
// XafTypesInfo.Instance.RegisterEntity(Report1Parameters", typeof(Report1Parameters));
// base.Setup(application);
//}
public class Report1DataMinerOperation : DataMinerOperationBase<Report1Data, Report1Parameters>
{
  // Criteria for some properties can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase.GetCriteria method override.
  protected override CriteriaOperator GetCriteria(string propertyName)
  {
    //if (propertyName == MemberHelper.MemberName<Report1Data>(m => m.Lines))
    // return new BinaryOperator(MemberHelper.MemberName<DataType>(m => m.Date), ReportData.Parameters.DateFrom, BinaryOperatorType.GreaterOrEqual);
    return base.GetCriteria(propertyName);
  }
  // Sorting for some properties can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase.GetSorting method override.
  protected override IList<SortProperty> GetSorting(string propertyName)
  {
    //if (propertyName == MemberHelper.MemberName<Report1Data>(m => m.Lines))
    // return new[] { new SortProperty(MemberHelper.MemberName<DataType>(m => m.Date), SortingDirection.Ascending) };
    return base.GetSorting(propertyName);
  }
  public override void CollectData()
  {
    // Initialize ReportData here.
    //ReportData.Parameters = Parameters;
    base.CollectData();
  }
}
//public class Report1FileGenerator : XafariFileReportGenerator<Report1Data, Report1Parameters>
//{
// protected override void GenerateCore()
// {
// throw new NotImplementedException();
// }
//}

' For more typical usage scenarios, be sure to check out http://galaktikasoft.com/documentation/xafari/reports.html .
Public Class Report1
  Inherits XafariReport(Of Report1Data, Report1Parameters, Report1DataMinerOperation)
End Class
Public Class Report1Data
  Inherits XafariReportDataBase
  '// Define data source properties here.
  '// To have an opportunity use parameter’s fields in the report header and CollectDataSpecificationAttribute.
  'public Report1Parameters Parameters { get; set; }
  '// Criteria and Sorting can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase class GetCriteria and GetSorting methods overrides.
  '[CollectDataSpecification("Date >= ? ", "Parameters.DateFrom", "Date:Ascending")]
  'public IList<DataType> Lines { get; set; }
End Class
'[XafDisplayName("Report parameters")]
<DomainComponent, DeferredDeletion(False)> _
Public Interface Report1Parameters
  Inherits XafariReportParametersBase
  '[XafDisplayName("Date from")]
  '[Custom("DisplayFormat", "{0:dd.MM.yyyy HH:mm}"), Custom("EditMask", "dd.MM.yyyy HH:mm")]
  'DateTime DateFrom { get; set; }
End Interface
' Register Report1Parameters domain component by overriding the Setup method in a ModuleBase class descendant (http://documentation.devexpress.com/#Xaf/CustomDocument3261):
'public override void Setup(XafApplication application) {
' XafTypesInfo.Instance.RegisterEntity(Report1Parameters", typeof(Report1Parameters));
' base.Setup(application);
'}
Public Class Report1DataMinerOperation
  Inherits DataMinerOperationBase(Of Report1Data, Report1Parameters)
  ' Criteria for some properties can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase.GetCriteria method override.
  Protected Overrides Function GetCriteria(ByVal propertyName As String) As CriteriaOperator
    'if (propertyName == MemberHelper.MemberName<Report1Data>(m => m.Lines))
    ' return new BinaryOperator(MemberHelper.MemberName<DataType>(m => m.Date), ReportData.Parameters.DateFrom, BinaryOperatorType.GreaterOrEqual);
    Return MyBase.GetCriteria(propertyName)
  End Function
  ' Sorting for some properties can be specified in the CollectDataSpecificationAttribute or in DataMinerOperationBase.GetSorting method override.
  Protected Overrides Function GetSorting(ByVal propertyName As String) As IList(Of SortProperty)
    'if (propertyName == MemberHelper.MemberName<Report1Data>(m => m.Lines))
    ' return new[] { new SortProperty(MemberHelper.MemberName<DataType>(m => m.Date), SortingDirection.Ascending) };
    Return MyBase.GetSorting(propertyName)
  End Function
  Public Overrides Sub CollectData()
    ' Initialize ReportData here.
    'ReportData.Parameters = Parameters;
    MyBase.CollectData()
  End Sub
End Class
'public class Report1FileGenerator : XafariFileReportGenerator<Report1Data, Report1Parameters>
'{
' protected override void GenerateCore()
' {
' throw new NotImplementedException();
' }
'}