<?php
//--Class base_Officer--------------------------
//--PK of base_Officer ::
//    1. officerId

class OfficerT extends clsDB{

var 
$result;


var 
$officerId;
var 
$officerCode;
var 
$officerPassword;
var 
$officerType;
var 
$prefixId;
var 
$officerName;
var 
$officerSurname;
var 
$officerNameEng;
var 
$officerSurnameEng;
var 
$officerEmail;
var 
$officerStatus;
var 
$remark;
var 
$contactAddress;
var 
$contactPhone;

function 
OfficerT(&$c){
    
$this->c=$c->c;
    
$this->DB=$c->db;
}

function 
RSOfficerT(){
    
$this->SetQuery("select * from Officer order by officerId");
}

function 
GetRecord(){
//--เป็นเมธอดที่นำข้อมูลจาก ResultSet มากำหนดให้กับแอตทริบิวต์ของอ๊อบเจ็ก
//--เรียก GetRecord() หนึ่งครั้ง จะเลื่อนตัวชี้เรคอร์ดไปอีกหนึ่งเรคอร์ด
    
if ($this->result $this->GetResult()) {
        
$this->officerId $this->result['officerId'];
        
$this->officerCode $this->result['officerCode'];
        
$this->officerPassword $this->result['officerPassword'];
        
$this->officerType $this->result['officerType'];
        
$this->prefixId $this->result['prefixId'];
        
$this->officerName $this->result['officerName'];
        
$this->officerSurname $this->result['officerSurname'];
        
$this->officerNameEng $this->result['officerNameEng'];
        
$this->officerSurnameEng $this->result['officerSurnameEng'];
        
$this->officerEmail $this->result['officerEmail'];
        
$this->officerStatus $this->result['officerStatus'];
        
$this->remark $this->result['remark'];
        
$this->contactAddress $this->result['contactAddress'];
        
$this->contactPhone $this->result['contactPhone'];
        return 
1;
    }else {
        return 
0;
    }
}

function 
SearchByKey($xKey){
    
$this->SetQuery("select * from Officer where officerId= '$xKey'");
}

//****************** You can add new functions below **********************//
function SearchByOfficerCode($xKey){
    if (
$this->SetQuery("select * from Officer where officerCode='$xKey'")){ 
        return 
1;
    }else {
        return 
0;
    }
}

//--End class base_Officer--

?>