<?php
//--Class sysconfig--------------------------
//--PK of sysconfig ::
include_once "./link/keyThai.php";
class 
sysConfig extends clsDB{

var 
$result;

var 
$sysYear;
var 
$sysDocNo;
var 
$editRunningPsId;
var 
$OutputThai;
var 
$InputThai;
var 
$filesizebyte;
var 
$pbriHost;
var 
$collegeName;
var 
$collegeNameArr;
var 
$sendAllDeptDown;
var 
$sendAllDeptUp;
var 
$sendAllNode;

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

function 
Save(){
    if (
$this->status==1){
        
$sql "insert into SysConfig values(
            '"
.th2a($this->sysYear)."',
             '"
.th2a($this->sysDocNo)."',
            '"
.th2a($this->editRunningPsId)."',
            '"
.th2a($this->OutputThai)."',
            '"
.th2a($this->InputThai)."',
            '"
.$this->filesizebyte."',
            '"
.$this->pbriHost."',
            '"
.$this->collegeName."',
            '"
.$this->collegeNameArr."',
            '"
.$this->sendAllDeptDown."',
            '"
.$this->sendAllDeptUp."',
            '"
.$this->sendAllNode."'
            )"
;
    }else {
        
$sql "update SysConfig set 
            sysYear='"
.th2a($this->sysYear)."', 
            sysDocNo='"
.th2a($this->sysDocNo)."',
            editRunningPsId='"
.th2a($this->editRunningPsId)."',
            OutputThai='"
.th2a($this->OutputThai)."',
            InputThai='"
.th2a($this->InputThai)."',
            filesizebyte='"
.$this->filesizebyte."',
            pbriHost='"
.$this->pbriHost."',
            collegeName='"
.$this->collegeName."',
            collegeNameArr='"
.$this->collegeNameArr."',
            sendAllDeptDown='"
.$this->sendAllDeptDown."',
            sendAllDeptUp='"
.$this->sendAllDeptUp."',
            sendAllNode='"
.$this->sendAllNode."'";    
    }
    return 
$this->Dml($sql);
}

function 
Delete(){
    return 
$this->Dml("delete from SysConfig");
}

function 
RSsysConfig(){
    
$this->SetQuery("select * from SysConfig");
}

function 
GetRecord(){
    
$numFields $this->NumField();
    
$row $this->GetResult();
    if (
$row){
        for (
$i=0$i<$numFields$i++){
            eval(
"\$this->".mysql_field_name($this->rs$i)."=\$row['".mysql_field_name($this->rs$i)."'];");
            
$this->sysDocNo=a2th($this->sysDocNo);
        }
        return 
true;
    }else{    
// clear value of Member;
        
for ($i=0$i<$numFields$i++){
            eval(
"\$this->".mysql_field_name($this->rs$i)."='';");
        }
        return 
false;
    }
}
function 
SearchByKey($xKey){
    if (
$this->SetQuery("select * from SysConfig")){ 
        return 
1;
    }else {
        return 
0;
    }
}
//****************** You can add new functions below **********************//
function SearchBysysYear(){
    
$this->SetQuery("select sysYear as num from SysConfig");
    if (
$result=$this->GetResult()) {
        return 
$result['num'];
    }
}
function 
SearchByeditRunningPsId(){
    
$this->SetQuery("select editRunningPsId  as num from SysConfig");
    if (
$result=$this->GetResult()) {
        return 
$result['num'];
    }
}
function 
SearchByInputThai(){
    
$this->SetQuery("select InputThai as num from SysConfig");
    if (
$result=$this->GetResult()) {
        return 
$result['num'];
    }
}
function 
SearchByKeyName($name){
    
$this->SetQuery("select $name as num from SysConfig");
    if (
$result=$this->GetResult()) {
        return 
$result['num'];
    }
}
//--End class person--

?>