<?php
/*
@author: Ali Tareque Chowdhury
*/
class Ship_user_login_model extends CI_Model {

	//constructor
	public function __construct()
	{
		parent::__construct();
	}

    function loginUserCheck($userName, $currPassword, $merchant_row_id)
    {


        $sql="SELECT shipping_user_id,company_id
               FROM tbl_shipping_module_user
               WHERE merchant_row_id=".$this->db->escape($merchant_row_id)."
               AND username=".$this->db->escape($userName)."
               AND password=".$this->db->escape($currPassword)."
               AND active_status=1";
        $resultSet = $this->db->query ( $sql );
        return $resultSet->row ();
    }

	function getShipUserData($ship_user_id,$merchant_row_id) {
		$sql="SELECT *
              FROM tbl_shipping_module_user
              WHERE shipping_user_id=".$this->db->escape($ship_user_id)."
              AND merchant_row_id=".$this->db->escape($merchant_row_id);
		$resultSet = $this->db->query($sql);
		$result = $resultSet->row ();
		return $result;
	}

	function getMerchantID($merchant_row_id)
    {
        $sql="SELECT merchant_row_id
              FROM tbl_merchant
              WHERE MD5(merchant_row_id)=".$this->db->escape($merchant_row_id);
        $query=$this->db->query($sql);
        $result=$query->row();
        return $result->merchant_row_id;
    }
    function getCompanyID($merchant_row_id=0, $company_id=0)
    {
        $sql="SELECT company_id
              FROM tbl_fulfillment_company
              WHERE merchant_row_id=".$this->db->escape($merchant_row_id)."
              AND MD5(company_id)=".$this->db->escape($company_id);
        $query=$this->db->query($sql);
        $result=$query->row();
        return $result->company_id;
    }
}
?>
