Viewing file: clsbase_StudentBio.php (14.12 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
//--Class base_StudentBio--------------------------
//--PK of base_StudentBio ::
// 1. studentId
include_once "Db.php";
class base_StudentBio extends Db{
var $result;
var $status;
var $studentId;
var $nationId;
var $religionId;
var $bloodGroup;
var $birthDate;
var $birthProvinceId;
var $homeAddress;
var $homeDistrictId;
var $homeAmphurId;
var $homeProvinceId;
var $homeZipcode;
var $homePhoneNo;
var $officeName;
var $officeAddress;
var $officeDistrictId;
var $officeAmphurId;
var $officeProvinceId;
var $officeZipcode;
var $officePhoneNo;
var $workingStatus;
var $workingPosition;
var $workingSalary;
var $fatherName;
var $fatherAddress;
var $fatherDistrictId;
var $fatherAmphurId;
var $fatherProvinceId;
var $fatherZipcode;
var $fatherPhoneNo;
var $fatherOccupation;
var $fatherStatus;
var $motherName;
var $motherAddress;
var $motherDistrictId;
var $motherAmphurId;
var $motherProvinceId;
var $motherZipcode;
var $motherPhoneNo;
var $motherOccupation;
var $motherStatus;
var $studentSex;
var $parentName;
var $parentRelation;
var $parentAddress;
var $parentDistrictId;
var $parentAmphurId;
var $parentProvinceId;
var $parentZipcode;
var $parentPhoneNo;
var $parentMobile;
var $parentOcc;
var $parentIncome;
var $parentEmail;
var $contactPerson;
var $contactAddress;
var $contactDistrictId;
var $contactAmphurId;
var $contactProvinceId;
var $contactZipcode;
var $contactPhoneNo;
var $cardExpiryDate;
var $currentAddress;
var $currentDistrictId;
var $currentAmphurId;
var $currentProvinceId;
var $currentZipcode;
var $currentPhoneNo;
var $graduateAddress;
var $graduateDistrictId;
var $graduateAmphurId;
var $graduateProvinceId;
var $graduateZipcode;
var $graduatePhoneNo;
var $maritalStatusId;
var $weight;
var $height;
var $picturePath;
var $recruitmentTypeId;
var $occExamResult;
var $canRefund;
var $oldStudentName;
var $entryDegree;
var $healthPrivId;
function AddNew(){
//--ใช้เมธอดนี้เมื่อต้องการเพิ่มข้อมูลใหม่
//--โดยจะกำหนดสถานะของข้อมูลของอ๊อบเจ๊กให้เป็น 1
$this->status = 1;
}
function Edit(){
//--ใช้เมธอดนี้เมื่อต้องการปรับปรุงข้อมูล
//--โดยจะกำหนดสถานะของข้อมูลของอ๊อบเจ๊กให้เป็น 2
$this->status = 2;
}
function Save(){
//--ใช้เมธอดนี้เมื่อต้องการบันทึกข้อมูลในอ๊อบเจ๊กเข้าสู่ฐานข้อมูล
//--โดยจะตรวจสอบสถานะของข้อมูลว่าข้อมูลในอ๊อบเจ๊กเป็นข้อมูลใหม่หรือข้อมูลเดิม
//--1 เป็นข้อมูลใหม่ 2 เป็นข้อมูลเดิม
if($this->entryDegree=="")
$this->entryDegree="NULL";
if ($this->status==1){
//$this->studentId=$this->GetNextCode();
$sql = "insert into StudentBio values('$this->studentId', '$this->nationId', '$this->religionId', '$this->bloodGroup', '$this->birthDate', '$this->birthProvinceId', '$this->homeAddress', '$this->homeDistrictId', '$this->homeAmphurId', '$this->homeProvinceId', '$this->homeZipcode', '$this->homePhoneNo', '$this->officeName', '$this->officeAddress', '$this->officeDistrictId', '$this->officeAmphurId', '$this->officeProvinceId', '$this->officeZipcode', '$this->officePhoneNo', '$this->workingStatus', '$this->workingPosition', '$this->workingSalary', '$this->fatherName', '$this->fatherAddress', '$this->fatherDistrictId', '$this->fatherAmphurId', '$this->fatherProvinceId', '$this->fatherZipcode', '$this->fatherPhoneNo', '$this->fatherOccupation', '$this->fatherStatus', '$this->motherName', '$this->motherAddress', '$this->motherDistrictId', '$this->motherAmphurId', '$this->motherProvinceId', '$this->motherZipcode', '$this->motherPhoneNo', '$this->motherOccupation', '$this->motherStatus', '$this->studentSex', '$this->parentName', '$this->parentRelation', '$this->parentAddress', '$this->parentDistrictId', '$this->parentAmphurId', '$this->parentProvinceId', '$this->parentZipcode', '$this->parentPhoneNo', '$this->parentMobile', '$this->parentOcc', '$this->parentIncome', '$this->parentEmail', '$this->contactPerson', '$this->contactAddress', '$this->contactDistrictId', '$this->contactAmphurId', '$this->contactProvinceId', '$this->contactZipcode', '$this->contactPhoneNo', '$this->cardExpiryDate', '$this->currentAddress', '$this->currentDistrictId', '$this->currentAmphurId', '$this->currentProvinceId', '$this->currentZipcode', '$this->currentPhoneNo', '$this->graduateAddress', '$this->graduateDistrictId', '$this->graduateAmphurId', '$this->graduateProvinceId', '$this->graduateZipcode', '$this->graduatePhoneNo', '$this->maritalStatusId', '$this->weight', '$this->height', '$this->picturePath', '$this->recruitmentTypeId', '$this->occExamResult', '$this->canRefund', '$this->oldStudentName', '$this->entryDegree', '$this->healthPrivId')";
}else {
$sql = "update StudentBio set nationId=$this->nationId, religionId=$this->religionId, bloodGroup='$this->bloodGroup', birthDate='$this->birthDate', birthProvinceId=$this->birthProvinceId, homeAddress='$this->homeAddress', homeDistrictId=$this->homeDistrictId, homeAmphurId=$this->homeAmphurId, homeProvinceId=$this->homeProvinceId, homeZipcode='$this->homeZipcode', homePhoneNo='$this->homePhoneNo', officeName='$this->officeName', officeAddress='$this->officeAddress', officeDistrictId=$this->officeDistrictId, officeAmphurId=$this->officeAmphurId, officeProvinceId=$this->officeProvinceId, officeZipcode='$this->officeZipcode', officePhoneNo='$this->officePhoneNo', workingStatus='$this->workingStatus', workingPosition='$this->workingPosition', workingSalary='$this->workingSalary', fatherName='$this->fatherName', fatherAddress='$this->fatherAddress', fatherDistrictId=$this->fatherDistrictId, fatherAmphurId=$this->fatherAmphurId, fatherProvinceId=$this->fatherProvinceId, fatherZipcode='$this->fatherZipcode', fatherPhoneNo='$this->fatherPhoneNo', fatherOccupation='$this->fatherOccupation', fatherStatus='$this->fatherStatus', motherName='$this->motherName', motherAddress='$this->motherAddress', motherDistrictId=$this->motherDistrictId, motherAmphurId=$this->motherAmphurId, motherProvinceId=$this->motherProvinceId, motherZipcode='$this->motherZipcode', motherPhoneNo='$this->motherPhoneNo', motherOccupation='$this->motherOccupation', motherStatus='$this->motherStatus', studentSex='$this->studentSex', parentName='$this->parentName', parentRelation='$this->parentRelation', parentAddress='$this->parentAddress', parentDistrictId=$this->parentDistrictId, parentAmphurId=$this->parentAmphurId, parentProvinceId=$this->parentProvinceId, parentZipcode='$this->parentZipcode', parentPhoneNo='$this->parentPhoneNo', parentMobile=$this->parentMobile, parentOcc='$this->parentOcc', parentIncome='$this->parentIncome', parentEmail='$this->parentEmail', contactPerson='$this->contactPerson', contactAddress='$this->contactAddress', contactDistrictId=$this->contactDistrictId, contactAmphurId=$this->contactAmphurId, contactProvinceId=$this->contactProvinceId, contactZipcode='$this->contactZipcode', contactPhoneNo='$this->contactPhoneNo', cardExpiryDate='$this->cardExpiryDate', currentAddress='$this->currentAddress', currentDistrictId=$this->currentDistrictId, currentAmphurId=$this->currentAmphurId, currentProvinceId=$this->currentProvinceId, currentZipcode='$this->currentZipcode', currentPhoneNo='$this->currentPhoneNo', graduateAddress='$this->graduateAddress', graduateDistrictId=$this->graduateDistrictId, graduateAmphurId=$this->graduateAmphurId, graduateProvinceId=$this->graduateProvinceId, graduateZipcode='$this->graduateZipcode', graduatePhoneNo='$this->graduatePhoneNo', maritalStatusId=$this->maritalStatusId, weight='$this->weight', height='$this->height', picturePath='$this->picturePath', recruitmentTypeId=$this->recruitmentTypeId, occExamResult='$this->occExamResult', canRefund='$this->canRefund', oldStudentName='$this->oldStudentName', entryDegree=$this->entryDegree, healthPrivId=$this->healthPrivId where studentId='$this->studentId'";
}
$this->SetQuery($sql);
}
function Delete(){
//--ใช้เมธอดนี้เพื่อลบข้อมูลเดิมในอ๊อบเจ๊ก
//--เป็นการลบข้อมูลทีละ 1 เรคอร์ด
//--ต้องเรียกเมธอดตามลำดับดังนี้ SearchByKey()-->GetRecord()-->Delete()
$this->SetQuery("delete from StudentBio where studentId='$this->studentId'");
}
function GetNextCode(){
//--ใช้เมธอดนี้เพื่อหาค่าสูงสุดของฟิลด์ที่ใช้เป็นคีย์ของตาราง ในลักษณะ auto increment
//--ต้องเป็นฟิลด์ที่ไม่ได้กำหนดรหัสเองทางจอภาพ
$this->SetQuery("select max(studentId) as num from StudentBio");
if ($result=$this->GetResult()) {
return $result['num']+1;
}
}
function RSStudentBio(){
//--เมธอดที่ขึ้นต้นด้วย RS (Result Set) มีความหมายว่าจะได้รับข้อมูลกลับมาจากการ select มากกว่า 1 เรคอร์ด
//--ปกติเมื่อเรียกใช้เมธอด RSxxxx จะต้องเรียกเมธอด GetRecord() ด้วยเสมอ
//--โดยสามารถเพิ่มเมธอดได้ตามต้องการ แต่ต้องขึ้นต้นด้วย RS
$this->SetQuery("select * from StudentBio order by studentId");
}
function GetRecord(){
//--เป็นเมธอดที่นำข้อมูลจาก ResultSet มากำหนดให้กับแอตทริบิวต์ของอ๊อบเจ็ก
//--เรียก GetRecord() หนึ่งครั้ง จะเลื่อนตัวชี้เรคอร์ดไปอีกหนึ่งเรคอร์ด
if ($this->result = $this->GetResult()) {
$this->studentId = $this->result['studentId'];
$this->nationId = $this->result['nationId'];
$this->religionId = $this->result['religionId'];
$this->bloodGroup = $this->result['bloodGroup'];
$this->birthDate = $this->result['birthDate'];
$this->birthProvinceId = $this->result['birthProvinceId'];
$this->homeAddress = $this->result['homeAddress'];
$this->homeDistrictId = $this->result['homeDistrictId'];
$this->homeAmphurId = $this->result['homeAmphurId'];
$this->homeProvinceId = $this->result['homeProvinceId'];
$this->homeZipcode = $this->result['homeZipcode'];
$this->homePhoneNo = $this->result['homePhoneNo'];
$this->officeName = $this->result['officeName'];
$this->officeAddress = $this->result['officeAddress'];
$this->officeDistrictId = $this->result['officeDistrictId'];
$this->officeAmphurId = $this->result['officeAmphurId'];
$this->officeProvinceId = $this->result['officeProvinceId'];
$this->officeZipcode = $this->result['officeZipcode'];
$this->officePhoneNo = $this->result['officePhoneNo'];
$this->workingStatus = $this->result['workingStatus'];
$this->workingPosition = $this->result['workingPosition'];
$this->workingSalary = $this->result['workingSalary'];
$this->fatherName = $this->result['fatherName'];
$this->fatherAddress = $this->result['fatherAddress'];
$this->fatherDistrictId = $this->result['fatherDistrictId'];
$this->fatherAmphurId = $this->result['fatherAmphurId'];
$this->fatherProvinceId = $this->result['fatherProvinceId'];
$this->fatherZipcode = $this->result['fatherZipcode'];
$this->fatherPhoneNo = $this->result['fatherPhoneNo'];
$this->fatherOccupation = $this->result['fatherOccupation'];
$this->fatherStatus = $this->result['fatherStatus'];
$this->motherName = $this->result['motherName'];
$this->motherAddress = $this->result['motherAddress'];
$this->motherDistrictId = $this->result['motherDistrictId'];
$this->motherAmphurId = $this->result['motherAmphurId'];
$this->motherProvinceId = $this->result['motherProvinceId'];
$this->motherZipcode = $this->result['motherZipcode'];
$this->motherPhoneNo = $this->result['motherPhoneNo'];
$this->motherOccupation = $this->result['motherOccupation'];
$this->motherStatus = $this->result['motherStatus'];
$this->studentSex = $this->result['studentSex'];
$this->parentName = $this->result['parentName'];
$this->parentRelation = $this->result['parentRelation'];
$this->parentAddress = $this->result['parentAddress'];
$this->parentDistrictId = $this->result['parentDistrictId'];
$this->parentAmphurId = $this->result['parentAmphurId'];
$this->parentProvinceId = $this->result['parentProvinceId'];
$this->parentZipcode = $this->result['parentZipcode'];
$this->parentPhoneNo = $this->result['parentPhoneNo'];
$this->parentMobile = $this->result['parentMobile'];
$this->parentOcc = $this->result['parentOcc'];
$this->parentIncome = $this->result['parentIncome'];
$this->parentEmail = $this->result['parentEmail'];
$this->contactPerson = $this->result['contactPerson'];
$this->contactAddress = $this->result['contactAddress'];
$this->contactDistrictId = $this->result['contactDistrictId'];
$this->contactAmphurId = $this->result['contactAmphurId'];
$this->contactProvinceId = $this->result['contactProvinceId'];
$this->contactZipcode = $this->result['contactZipcode'];
$this->contactPhoneNo = $this->result['contactPhoneNo'];
$this->cardExpiryDate = $this->result['cardExpiryDate'];
$this->currentAddress = $this->result['currentAddress'];
$this->currentDistrictId = $this->result['currentDistrictId'];
$this->currentAmphurId = $this->result['currentAmphurId'];
$this->currentProvinceId = $this->result['currentProvinceId'];
$this->currentZipcode = $this->result['currentZipcode'];
$this->currentPhoneNo = $this->result['currentPhoneNo'];
$this->graduateAddress = $this->result['graduateAddress'];
$this->graduateDistrictId = $this->result['graduateDistrictId'];
$this->graduateAmphurId = $this->result['graduateAmphurId'];
$this->graduateProvinceId = $this->result['graduateProvinceId'];
$this->graduateZipcode = $this->result['graduateZipcode'];
$this->graduatePhoneNo = $this->result['graduatePhoneNo'];
$this->maritalStatusId = $this->result['maritalStatusId'];
$this->weight = $this->result['weight'];
$this->height = $this->result['height'];
$this->picturePath = $this->result['picturePath'];
$this->recruitmentTypeId = $this->result['recruitmentTypeId'];
$this->occExamResult = $this->result['occExamResult'];
$this->canRefund = $this->result['canRefund'];
$this->oldStudentName = $this->result['oldStudentName'];
$this->entryDegree = $this->result['entryDegree'];
$this->healthPrivId = $this->result['healthPrivId'];
return 1;
}else {
return 0;
}
}
function SearchByKey($xKey){
//--ใช้เมธอดนี้เพื่อค้นหาข้อมูลตาม PK ต้องระบุพารามิเตอร์ด้วย
//--และต้องตามด้วยเมธอด GetRecord() เสมอ
if ($this->SetQuery("select * from StudentBio where studentId= '$xKey'")){
return 1;
}else {
return 0;
}
}
function NumRow(){
//--เป็นเมธอดที่คืนค่าจำนวนข้อมูลจากการ select โดยเมธอด RSxxxx
return $this->GetRowSelected();
}
function Destroy(){
//--เป็นเมธอดสำหรับปิดการติดต่อจากฐานข้อมูล
return $this->DestroyDb();
}
//****************** You can add new functions below **********************//
} //--End class base_StudentBio--
?>
|