<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class M_supporting extends CI_Model {	
    function get_detail($table, $id){
        $query = $this->db->get_where($this->table, array('BankID' => $id));
    
        if($query->num_rows()>0){
            return $query->row();
        }
        else{
            return false;
        }  
    }

    function insert($table, $data) {
        $this->db->insert($table, $data);

//        if ($this->db->trans_status() === FALSE) {//sudah ga dipakai karena pakai array
//            return 0;
//        }
//        else {
//            return 1;
//        }
    }
	
    function update($data, $table, $field_name, $id) {
        $this->db->update($table, $data, array($field_name => $id));
		
//        if ($this->db->trans_status() === FALSE) {//sudah tidak dipakai karena sudah pakai array
//            return 0;
//        }
//        else {
//            return 1;
//        }
    }
	
    function delete($table, $field_name, $id) {
        $this->db->delete($table, array($field_name => $id));
//		
//        if ($this->db->trans_status() === FALSE) {//sudah ga dipakai karena sudah memakai sistem array
//            return 0;
//        }
//        else {
//            return 1;
//        }
    }
    
    function check_code_exist($table, $field_name, $id) {
        $query = $this->db->get_where($table, array($field_name => $id), 1, 0);

        if ($query->num_rows() > 0) {
            return TRUE;
        }
        else {
            return FALSE;
        }	
    }
    
    
    //============= DHIDHIK, 28 Maret 2016 ===================================//    
    function datasend_supporting_jobtitle_insert($dataSend){         
        $this->db->trans_start();  
        $this->insert('am_jobtitle',$dataSend['data_jobtitle']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }   
    function datasend_supporting_jobtitle_update($dataSend){         
        $this->db->trans_start();  
        $this->update($dataSend['data_jobtitle'], 'am_jobtitle', 'JobTitleCode', $dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    function datasend_supporting_jobtitle_delete($dataSend){         
        $this->db->trans_start();  
        $this->delete('am_jobtitle', 'JobTitleCode', $dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
     
    function datasend_supporting_city_insert($dataSend){         
        $this->db->trans_start();  
        $this->insert('am_city', $dataSend['data_city']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }   
    function datasend_supporting_city_update($dataSend){         
        $this->db->trans_start(); 
        $this->update($dataSend['data_city'], 'am_city', 'CityCode',$dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    function datasend_supporting_city_delete($dataSend){         
        $this->db->trans_start(); 
        $this->delete('am_city', 'CityCode', $dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    
    function datasend_supporting_state_insert($dataSend){         
        $this->db->trans_start();  
        $this->insert('am_state',$dataSend['data_state']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }   
    function datasend_supporting_state_update($dataSend){         
        $this->db->trans_start(); 
        $this->update($dataSend['data_state'], 'am_state', 'StateCode',$dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    function datasend_supporting_state_delete($dataSend){         
        $this->db->trans_start();
        $this->delete('am_state','StateCode',$dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    
    function datasend_supporting_country_insert($dataSend){         
        $this->db->trans_start();  
        $this->insert('am_country', $dataSend['data_country']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }   
    function datasend_supporting_country_update($dataSend){         
        $this->db->trans_start(); 
        $this->update($dataSend['data_country'], 'am_country', 'CountryCode', $dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    function datasend_supporting_country_delete($dataSend){         
        $this->db->trans_start();
        $this->delete('am_country', 'CountryCode', $dataSend['idcode']);
        $this->db->trans_complete();
        if($this->db->trans_status() == FALSE){
            $result  = false;
        }else{
            $result = true;
        }
        return $result;
    }
    //============= End DHIDHIK, 28 Maret 2016 ===============================//
}

/* End of file m_bank.php */
/* Location: ./application/modules_core/list/models/m_bank.php */