public function Save() { $this->objSearchQuery->DeleteAllQueryConditions(); foreach ($this->objQueryConditionArray as $intIndex => $objQueryCondition) { $lstNode = $this->objForm->GetControl('lstNode' . $intIndex); $lstOperation = $this->objForm->GetControl('lstOperation' . $intIndex); $pnlValue = $this->objForm->GetControl('pnlValue' . $intIndex); $ctlValue = $this->objForm->GetControl('ctlValue' . $intIndex); if ($lstNode->SelectedValue) { $objQueryCondition = new QueryCondition(); $objQueryCondition->SearchQuery = $this->objSearchQuery; $objQueryCondition->QueryOperationId = $lstOperation->SelectedValue; $objQueryCondition->QueryNodeId = $lstNode->SelectedValue; if ($ctlValue->Visible) { switch ($this->objNodeArray[$lstNode->SelectedValue]->QueryDataTypeId) { case QueryDataType::DateValue: $objQueryCondition->Value = $ctlValue->DateTime->ToString('YYYY-MM-DD'); break; case QueryDataType::IntegerValue: case QueryDataType::StringValue: $objQueryCondition->Value = trim($ctlValue->Text); break; case QueryDataType::BooleanValue: $objQueryCondition->Value = trim($ctlValue->SelectedValue); break; case QueryDataType::TypeValue: case QueryDataType::ObjectValue: case QueryDataType::CustomValue: case QueryDataType::CustomValueOnly: $objQueryCondition->Value = trim($ctlValue->SelectedValue); break; default: throw new Exception('Unhandled QueryDataTypeId'); } } $objQueryCondition->Save(); } } }