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; }
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/>"; echo "<input type='text' style='width:98%;' value='" . $name . "' />"; echo "</label>"; echo "<label style='width:99%;' >Telefone<br/>"; echo "<input type='text' style='width:98%;' value='" . $phoneNumber . "' />"; echo "</label>"; echo "<label style='width:99%;' >Celular<br/>";