Tuesday, July 16, 2013

SSRS Report Sample Contract Class

/// <summary>
/// The <c>CustInvoiceContract</c> class is the data contract class for the <c>CustInvoice</c> SSRS
/// report.
/// </summary>
[
DataContractAttribute
//SysOperationContractProcessingAttribute(classstr(CustInvoiceUIBuilder)),

//SysOperationGroupAttribute('Criteria', "@SYS13128", "1")
]
public class NSGEmployeePayslipContractClass //implements SysOperationInitializable, SysOperationValidatable

{
NsgMonth salMonth;
NsgSalaryYear salYear;
}


[ DataMemberAttribute('Month')
//SysOperationLabelAttribute(literalstr("@SYS328562")),
//SysOperationHelpTextAttribute(literalstr("@SYS328563")),
//SysOperationGroupMemberAttribute('Criteria'),
//SysOperationDisplayOrderAttribute('2')

]
public NsgMonth parmMonth(NsgMonth _NsgMonth = salMonth)
{
salMonth = _NsgMonth;
return salMonth;
}


[DataMemberAttribute('SalYear')

//SysOperationLabelAttribute(literalstr("@SYS328564")),

//sOperationHelpTextAttribute(literalstr("@SYS328565")),

//SysOperationGroupMemberAttribute('Criteria'),

//SysOperationDisplayOrderAttribute('3')
]
public NsgSalaryYear parmYear(NsgSalaryYear _salYear = salYear)
{
salYear = _salYear;
 
return salYear;
}


/// <summary>
/// Validates the data contract values.
/// </summary>
/// <returns>
/// true if all the contract values are valid; otherwise, false.
/// </returns>
public boolean validate()

{
 
boolean isValid = true;
// Force date to be included in the restrictions. Without a date
// range the resulting SQL query will need to do a cartesian product
// against CustInvoiceJour, CustInvoiceTrans and CustTrans before
// restricting down. Even with a relatively small database this
// will result in filling up tempdb and crashing the report as well
// as degrading all other queries against the SQL server. With date
// range included, the date indexes on CustInvoiceJour will be used
// to generate index seeks and allow a reasonable query.

if (!salMonth)
{
 
isValid = checkFailed("month is required");
}
if (!salYear)
{
 
isValid = checkFailed("year is required");
}
 
 
return isValid;
}


public static NSGEmployeePayslipContractClass construct()
{
 
return new NSGEmployeePayslipContractClass();
}

 
 

No comments:

Post a Comment