<?php

class MstUser extends AppModel {
	public $name = "MstUser";
	
	public function insertMstUser($obj){
			$result = $this->query("CALL insert_mst_user(" .
												"'" .
												$obj->id . "','" .
												$obj->encryptedPassword . "','" .
												$obj->operatorName . "','" .
												$obj->getRole() . "','" .
												$obj->getRoleString() . "')");

		return $result;
	}

	public function updateMstUser($obj){
			$result = $this->query("CALL update_mst_user(" .
												"'" .
												$obj->id . "','" .
												$obj->operatorName . "','" .
												$obj->getRole() . "','" .
												$obj->getRoleString() . "'," .
												$obj->lockFlag . "," .
												$obj->disabled . ")");
		return $result;
	}

	public function updateEditPassword($obj){
			$result = $this->query("CALL update_password(" .
												"'" .
												$obj->id . "'," .
												1 . ",'" .
												$obj->encryptedPassword . "')");
		return $result;
	}

	public function updatePassword($obj){
			$result = $this->query("CALL update_password(" .
												"'" .
												$obj->id . "'," .
												0 . ",'" .
												$obj->encryptedPassword . "')");
		return $result;
	}

	public function executeLogin($id, $successful, $failedCount, $lockFlag, $ipAddress, $sessionId){
			$result = $this->query("CALL execute_login(" .
												"'" .
												$id . "'," .
												$successful . "," .
												$failedCount . "," .
												$lockFlag . ",'" .
												$ipAddress . "','" .
												$sessionId . "')");
		return $result;
	}

}

?>