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

class M_changepassword extends CI_Model {
    public $table="tbl_user";
	
    function getinfo_userlogin($sess_user){
        $this->db->select('EmployeePassword');
        $this->db->from($this->table);
        $this->db->where('EmployeeCode',$sess_user);
        $query 	= $this->db->get();

        return $query->result();
    }
	
    function compare_password($old_password, $employee_code){
        $this->db->select('EmployeePassword');
        $this->db->from($this->table);
        $this->db->where('EmployeeCode',$employee_code);
        $this->db->where('EmployeePassword',$old_password);
        $query 	= $this->db->get();
		
        if($query->num_rows() > 0){
            return $query->result();
        }
        else{
            return FALSE;
        }
    }
	
    function update($data, $employee_code){
        $this->db->update($this->table, $data, array('EmployeeCode' => $employee_code));
    }
	
    function delete($branch_code){
        $this->db->delete($this->table, array('BranchCode' => $branch_code));
    }
        
    function insert($data_user) {
        $this->db->insert($this->table, $data_user);
		
        if ($this->db->trans_status() === FALSE) {
            return 0;
        }
        else {
            return 1;
        }        
    }
}

/* End of file M_branchinfo.php */
/* Location: ./application/models/M_branchinfo.php */