<?php
class AppJurusanToAdmisi extends Database {

   protected $mSqlFile= 'module/jurusan/business/appjurusantoadmisi.sql.php';
   
   function __construct($connectionNumber=0) {
      parent::__construct($connectionNumber);
      
   }
   
   
   //------------------ Get Data-------------------
   
   function GetDataJurusan($kodeJur,$kodeFak, $namaResmiJur, $namaSingkatJur, $offset, $limit ){
      $result=$this->Open($this->mSqlQueries['get_data_jurusan'],array('%'.$kodeJur.'%',
                                                                       '%'.$kodeFak.'%',
                                                                       '%'.$namaResmiJur.'%',
                                                                       '%'.$namaSingkatJur.'%',
                                                                       $offset,
                                                                       $limit));
 
      return $result;
      }   
   

   function GetCountDataJurusan($kodeJur,$kodeFak, $namaResmiJur, $namaSingkatJur){
      $result=$this->Open($this->mSqlQueries['get_count_data_jurusan'],array('%'.$kodeJur.'%',
                                                                             '%'.$kodeFak.'%',
                                                                             '%'.$namaResmiJur.'%',
                                                                             '%'.$namaSingkatJur.'%'));
                     
      if (!$result) {
         return 0;
      } else {
         return $result[0]['total'];
      }
   }
   
   function GetDataJurusanById($kodeJur){
      $result=$this->Open($this->mSqlQueries['get_data_jurusan_by_id'],array($kodeJur));
      return $result;
   }
   
   function GetDataFakultas(){
      $result=$this->Open($this->mSqlQueries['get_data_fakultas'],array());
      //print($this->GetLastError());
      return $result;
   }
   
   function GetMaxIdJurusan(){
      $result=$this->Open($this->mSqlQueries['get_max_id_jurusan'],array());
      return $result;
   }
   
//------------------------do---------------------------------------------------------------   
   function DoAddJurusan($kodeJur,$kodeFak, $namaResmiJur, $namaSingkatJur){
   
      $result=$this->Execute($this->mSqlQueries['do_add_jurusan'],array($kodeJur,
                                                                        $kodeFak,
                                                                        $namaResmiJur,
                                                                        $namaSingkatJur ));

      return $result;
   }
   
   function DoUpdateJurusan($kodeFak, $namaResmiJur, $namaSingkatJur,$dataId){
      $result=$this->Execute($this->mSqlQueries['do_update_jurusan'],array( $kodeFak,
                                                                            $namaResmiJur,
                                                                            $namaSingkatJur,
                                                                            $dataId));

      return $result;
   }
   
   function DoDeleteJurusanById($kodeJur){
      $result=$this->Execute($this->mSqlQueries['do_delete_jurusan_by_id'],array($kodeJur));
      return $result;
   }
   
   function DoDeleteJurusanByArrayId($arrKodeJur){
      $kodeJur = implode("', '", $arrKodeJur);
      $result=$this->Execute($this->mSqlQueries['do_delete_jurusan_by_array_id'],array($kodeJur));
      return $result;
   }
   
   
}
?>