C# Class FundraisingMenu.SearchServices.FundraisingMenuSearchServices

Datei anzeigen Open project: tnc-css/fundraising-menu Class Usage Examples

Public Methods

Method Description
EvaluateOrderBy ( int colId, List columns ) : object>.Func

Get a function to pass into a LINQ OrderBy clause. The column sorting parameter is an index that gives the index of the column to sort by in display order. The list of columns is also in display order. So, we have to get the name of the column to sort by looking it up in the list of columns at the specified sort column index. Then, we can look up the attribute by name in the dataMap and return a lambda expression.

GetAllFundraisingMenuProjects ( ) : DataTableResult

Retrieves all Hub projects with the Fundraising Flag set to true.

SearchSortAndFilter ( DataTableParameters query ) : DataTableResult
StringOrEmpty ( string s ) : string

Private Methods

Method Description
AddVirtualProjects ( List list ) : void

Add "virtual" projects for any packages that don't have any associated projects. The search capability is data driven by *projects* and all package information is derived from projects. Therefore to show a package with no associated projects, we need to add at least one project record that corresponds to each package. This function accomplishes that. This is an ugly solution to the problem, but I considered many alternatives and they were all uglier or required a huge rework of how the page works. Since we're not sure exactly how this is all going to shake out anyway, this seemed like the most cost-effective solution for now.

ExpandByPackage ( List list ) : List

Duplicate records by package entry. This ensures we will see one project entry per package relationship and that every package is displayed on the front end.

GetProjectPackageDto ( int hubId, Package r, bool hasProjects ) : ProjectPackageDto
GetResult ( CihProject cihProject ) : FundraisingMenuResult

Retrieve the Project and its related Package data needed for a result row for the specified Project.

OrderProjectRecords ( List allProjects, DataTableParameters parameters ) : List

Order menu records. This function always orders first by package.

PageResults ( DataTableParameters query, List data ) : List

We need to use a more advanced paging strategy because there are virtual records that will not be displayed in the table. So instead of using the start and length arguments from the query as a hard Skip/Take boundary, we need to count how many virtual records preceeded the current page and we need to take records up to the query length, but excluding virtual records from the count.

RecordMatch ( FundraisingMenuResult r, DataTableParameters query ) : bool

Method Details

EvaluateOrderBy() public method

Get a function to pass into a LINQ OrderBy clause. The column sorting parameter is an index that gives the index of the column to sort by in display order. The list of columns is also in display order. So, we have to get the name of the column to sort by looking it up in the list of columns at the specified sort column index. Then, we can look up the attribute by name in the dataMap and return a lambda expression.
public EvaluateOrderBy ( int colId, List columns ) : object>.Func
colId int The display-ordered index of the sorted column
columns List The display-ordered list of columns
return object>.Func

GetAllFundraisingMenuProjects() public method

Retrieves all Hub projects with the Fundraising Flag set to true.
public GetAllFundraisingMenuProjects ( ) : DataTableResult
return DataTableResult

SearchSortAndFilter() public method

public SearchSortAndFilter ( DataTableParameters query ) : DataTableResult
query FundraisingMenu.Integration.DataTableParameters
return DataTableResult

StringOrEmpty() public static method

public static StringOrEmpty ( string s ) : string
s string
return string