То же плохо понял вопрос, но возможно ответ будет такой.
while select ProjCostTrans
where ProjCostTrans.ProjId == _projId
&& (!_lineProperty || ProjCostTrans.LinePropertyId == _lineProperty)
&& (!_categoryId || ProjCostTrans.CategoryId == _categoryId)
|