I am adding my method that i will use for adding search criteria:
public Collection<CaseTest> QuickSearchCaseTest(string pCaseTest, InvokeContext ctx)
{
// To Do : To Search the result based on the complex criteria. It is just for reference now
IObjectScope scope = CaseTestScopeProvider.GetNewObjectScope();
var result = from c in scope.Secure<MtCaseTest>()
where (c.CaseReference.ToUpper().Matches(pCaseTest) || c.ShortTitle.ToUpper().Matches(pCaseTest))
select c;
Collection<CaseTest> serviceResult = new Collection<CaseTest>();
using (CaseTestFacade<MtCaseTest, CaseTest> mapper = new CaseTestFacade<MtCaseTest,CaseTest>())
{
foreach (MtCaseTest org in result)
serviceResult.Add(mapper.GetContractObject(org));
}
return serviceResult;
}
Here pCaseTest parameter can be an xml file that will provide me the different fields for search criteria and what kind of search to do for particular field, My CaseTest class have about 30 attributes, and i need to apply search filter for about 12 fields, and this search can vary based on the type of search for particular attribute, like
for date fields search can be :
[equal, does not equal, between, is not between, greater or equal, less or equal, within week, within month, within year],
For the fields that are multiselect in search criteria the search can be
[equals, does not equal, starts with, does not start with,contains,does not contain, with, ends with, does not end with, is null, is not null, in the list, not in the list ].
For the fields that are free text the criteria can be :
[equals, does not equal, starts with, does not start with, contains, does not contain with, ends with, does not end with, is null , is not null]
Can you please suggest me how to perform such type for filtration while getting the records from database. And if there are some limitations to perform any of the search from above mentioned criteria's then please let me know that too.
Regards,
Dev Chahal