Viewing file:      da_person.php (5.08 KB)      -rwxr-xr-x Select action/file-type:    (+) |   (+) |   (+) | Code (+) | Session (+) |   (+) | SDB (+) |   (+) |   (+) |   (+) |   (+) |   (+) |
 
<?php
 include_once("ppc_model.php");
 
 class Da_person extends Ppc_model {        
     
     // PK is personId
     
     public $personId;
     public $prefixId;
     public $fName;
     public $lName;
     public $receiveDate;
     public $pId;
     public $adlineId;
     public $adminposId;
     public $hireId;
     public $majortypeId;
     public $levelposId;
     public $stepSal;
     public $salary;
     public $partyId;
     public $deptId;
     public $majorId;
     public $assignId;
     public $promoteDate;
     public $educDate;
     public $posDate;
     public $fullsalDate;
     public $typemoveId;
     public $fyDecor;
     public $lastDecor;
     public $fRetire;
     public $adminId;
     public $done;
     public $accountNo;
     public $useSalary;
     public $personCode;
     public $oldpersonCode;
     public $admidYear;
     public $partyAtId;
     public $partypracticeId;
     public $firstadmidDate;
     public $posDegree;
     public $posEducmajor;
     public $enterType;
     public $fStatus;
     public $salary2;
     public $fullStep;
     public $levelposId2;
     public $stepSal2;
     public $useSalary2;
     public $levelId;
     public $deptkpId;
     public $outDate;
 
     public $last_insert_id;
 
     function Da_person() {
         parent::__construct();
         $this->load->database('ppc',TRUE);
     }
     
     function insert() {
         // if there is no auto_increment field, please remove it
         $sql = "INSERT INTO $this->ppc_dbname.Person (personId, prefixId, fName, lName, receiveDate, pId, adlineId, adminposId, hireId, majortypeId, levelposId, stepSal, salary, partyId, deptId, majorId, assignId, promoteDate, educDate, posDate, fullsalDate, typemoveId, fyDecor, lastDecor, fRetire, adminId, done, accountNo, useSalary, personCode, oldpersonCode, admidYear, partyAtId, partypracticeId, firstadmidDate, posDegree, posEducmajor, enterType, fStatus, salary2, fullStep, levelposId2, stepSal2, useSalary2, levelId, deptkpId, outDate)
                 VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
         $this->db->query($sql, array($this->personId, $this->prefixId, $this->fName, $this->lName, $this->receiveDate, $this->pId, $this->adlineId, $this->adminposId, $this->hireId, $this->majortypeId, $this->levelposId, $this->stepSal, $this->salary, $this->partyId, $this->deptId, $this->majorId, $this->assignId, $this->promoteDate, $this->educDate, $this->posDate, $this->fullsalDate, $this->typemoveId, $this->fyDecor, $this->lastDecor, $this->fRetire, $this->adminId, $this->done, $this->accountNo, $this->useSalary, $this->personCode, $this->oldpersonCode, $this->admidYear, $this->partyAtId, $this->partypracticeId, $this->firstadmidDate, $this->posDegree, $this->posEducmajor, $this->enterType, $this->fStatus, $this->salary2, $this->fullStep, $this->levelposId2, $this->stepSal2, $this->useSalary2, $this->levelId, $this->deptkpId, $this->outDate));
         $this->last_insert_id = $this->db->insert_id();
     }
     
     function update() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "UPDATE $this->ppc_dbname.Person 
                 SET    prefixId=?, fName=?, lName=?, receiveDate=?, pId=?, adlineId=?, adminposId=?, hireId=?, majortypeId=?, levelposId=?, stepSal=?, salary=?, partyId=?, deptId=?, majorId=?, assignId=?, promoteDate=?, educDate=?, posDate=?, fullsalDate=?, typemoveId=?, fyDecor=?, lastDecor=?, fRetire=?, adminId=?, done=?, accountNo=?, useSalary=?, personCode=?, oldpersonCode=?, admidYear=?, partyAtId=?, partypracticeId=?, firstadmidDate=?, posDegree=?, posEducmajor=?, enterType=?, fStatus=?, salary2=?, fullStep=?, levelposId2=?, stepSal2=?, useSalary2=?, levelId=?, deptkpId=?, outDate=? 
                 WHERE personId=?";    
         $this->db->query($sql, array($this->prefixId, $this->fName, $this->lName, $this->receiveDate, $this->pId, $this->adlineId, $this->adminposId, $this->hireId, $this->majortypeId, $this->levelposId, $this->stepSal, $this->salary, $this->partyId, $this->deptId, $this->majorId, $this->assignId, $this->promoteDate, $this->educDate, $this->posDate, $this->fullsalDate, $this->typemoveId, $this->fyDecor, $this->lastDecor, $this->fRetire, $this->adminId, $this->done, $this->accountNo, $this->useSalary, $this->personCode, $this->oldpersonCode, $this->admidYear, $this->partyAtId, $this->partypracticeId, $this->firstadmidDate, $this->posDegree, $this->posEducmajor, $this->enterType, $this->fStatus, $this->salary2, $this->fullStep, $this->levelposId2, $this->stepSal2, $this->useSalary2, $this->levelId, $this->deptkpId, $this->outDate, $this->personId));    
     }
     
     function delete() {
         // if there is no primary key, please remove WHERE clause.
         $sql = "DELETE FROM $this->ppc_dbname.Person
                 WHERE personId=?";
         $this->db->query($sql, array($this->personId));
     }
     
     /*
      * You have to assign primary key value before call this function.
      */
     function get_by_key($withSetAttributeValue=FALSE) {    
         $sql = "SELECT * 
                 FROM $this->ppc_dbname.Person 
                 WHERE personId=?";
         $query = $this->db->query($sql, array($this->personId));
         if ( $withSetAttributeValue ) {
             $this->row2attribute( $query->row() );
         } else {
             return $query ;
         }
     }
 
     function last_insert_id(){
         return $this->db->insert_id();
     }
     
 }     //=== end class Da_person
 ?>
  |