function EquipmentOperator($sqlserverConnection, $businessPartnerCode, $equipmentCode) { // Cria os objetos de mapeamento objeto relacional $businessPartnerDAO = new BusinessPartnerDAO($sqlserverConnection); $businessPartnerDAO->showErrors = 1; $equipmentDAO = new EquipmentDAO($sqlserverConnection); $equipmentDAO->showErrors = 1; $contactPersonDAO = new ContactPersonDAO($sqlserverConnection); $contactPersonDAO->showErrors = 1; // Recupera os dados do parceiro de negócios $businessPartner = $businessPartnerDAO->RetrieveRecord($businessPartnerCode); if ($businessPartner != null) { $this->businessPartnerCode = $businessPartner->cardCode; $this->businessPartnerName = $businessPartner->cardName; $this->telephoneNumber = $businessPartner->telephoneNumber; } // Recupera os dados do equipamento $equipment = $equipmentDAO->RetrieveRecord($equipmentCode); if ($equipment != null) { $contactPerson = null; if (!empty($equipment->contactPerson)) { $contactPerson = $contactPersonDAO->RetrieveRecord($equipment->contactPerson); } if ($contactPerson != null) { $contactTel = trim($contactPerson->phoneNumber); if (!empty($contactTel)) { $this->operatorName = $contactPerson->name; $this->telephoneNumber = $contactPerson->phoneNumber; } } $this->equipmentCode = $equipment->insID; $this->serialNumber = $equipment->manufacturerSN; $this->equipmentStatus = $equipment->status; } }
static function GetContactPersonName($sqlServerConnection, $contactCode) { $name = ""; $contactPersonDAO = new ContactPersonDAO($sqlServerConnection); $contactPersonDAO->showErrors = 1; $contactPerson = $contactPersonDAO->RetrieveRecord($contactCode); if ($contactPerson != null) { $name = $contactPerson->name; } return $name; }
<body> <?php $contactCode = $_GET['contactCode']; include_once "../defines.php"; include_once "../ClassLibrary/DataConnector.php"; include_once "../DataAccessObjects/ContactPersonDAO.php"; include_once "../DataTransferObjects/ContactPersonDTO.php"; // Abre a conexao com o banco de dados $dataConnector = new DataConnector('sqlServer'); $dataConnector->OpenConnection(); if ($dataConnector->sqlserverConnection == null) { echo 'Não foi possível se connectar ao bando de dados!'; exit; } // Cria o objeto de mapeamento objeto-relacional $contactPersonDAO = new ContactPersonDAO($dataConnector->sqlserverConnection); $contactPersonDAO->showErrors = 1; $name = ""; $phoneNumber = ""; $cellNumber = ""; $email = ""; $dto = $contactPersonDAO->RetrieveRecord($contactCode); if (!empty($dto)) { $name = $dto->name; $phoneNumber = $dto->phoneNumber; $cellNumber = $dto->cellNumber; $email = $dto->email; } // Fecha a conexão com o banco de dados $dataConnector->CloseConnection(); echo "<label style='width:99%;' >Nome<br/>";
<?php include_once "../defines.php"; include_once "../ClassLibrary/DataConnector.php"; include_once "../DataAccessObjects/ContactPersonDAO.php"; include_once "../DataTransferObjects/ContactPersonDTO.php"; $businessPartnerCode = $_GET['businessPartnerCode']; $contactPersonCode = $_GET['contactPersonCode']; // Abre a conexao com o banco de dados $dataConnector = new DataConnector('sqlServer'); $dataConnector->OpenConnection(); if ($dataConnector->sqlserverConnection == null) { echo 'Não foi possível se connectar ao bando de dados!'; exit; } // Busca os contatos cadastrados para o parceiro de negócios $contactPersonDAO = new ContactPersonDAO($dataConnector->sqlserverConnection); $contactPersonDAO->showErrors = 1; $contactPersonArray = $contactPersonDAO->RetrieveRecordArray("CardCode = '" . $businessPartnerCode . "'"); foreach ($contactPersonArray as $contact) { $attributes = ""; if ($contact->cntctCode == $contactPersonCode) { $attributes = "selected='selected'"; } echo "<option " . $attributes . " value=" . $contact->cntctCode . ">" . $contact->name . "</option>"; } // Fecha a conexão com o banco de dados $dataConnector->CloseConnection();
$login = $loginDAO->RetrieveRecord($actionLog->login_id); $action = ''; if ($actionLog->tipoObjeto == 'contrato') { $newValue = $actionLog->valor; $checkBoxCaption = array("0" => "desmarcado", "1" => "marcado"); if ($actionLog->propriedade == 'status') { $newValue = ContractDAO::GetStatusAsText($newValue); } if ($actionLog->propriedade == 'categoria') { $newValue = ContractDAO::GetCategoryAsText($newValue); } if ($actionLog->propriedade == 'vendedor') { $newValue = SalesPersonDAO::GetSalesPersonName($dataConnector->sqlserverConnection, $newValue); } if ($actionLog->propriedade == 'contato') { $newValue = ContactPersonDAO::GetContactPersonName($dataConnector->sqlserverConnection, $newValue); } if ($actionLog->propriedade == 'indiceReajuste') { $newValue = AdjustmentRateDAO::GetAlias($dataConnector->mysqlConnection, $newValue); } if ($actionLog->propriedade == 'global') { $newValue = $checkBoxCaption[$newValue]; } $action = '<u>' . $actionLog->propriedade . '</u>' . ' alterado para ' . '"' . $newValue . '"'; if ($actionLog->transacao == 'INSERT') { $action = "Contrato incluido no sistema"; } } if ($actionLog->tipoObjeto == 'itemContrato') { $serialNumber = EquipmentDAO::GetSerialNumber($dataConnector->sqlserverConnection, $actionLog->idObjeto); if ($actionLog->transacao == 'INSERT') {