Esempio n. 1
0
 public function updateStatus(User $user)
 {
     $sp = "sp_user_statusUpdate";
     $params = new SDMDBParameters();
     $params->add($user->getId());
     $params->add($user->getStatus());
     // 				var_dump($params);
     $result = $this->handler->execute_stored_procedure($sp, $params, 'array');
     // 				var_dump($result);
     $ret = false;
     if ($result && $result['response']['system']['errorNo'] == 0) {
         if (isset($result['response']['resultSet'])) {
             if (isset($result['response']['resultSet'][0]['result'])) {
                 $ret = $result['response']['resultSet'][0]['result'];
                 if (strcmp($ret, "-1") == 0) {
                     throw new SSSException(ErrorFactory::ERR_RECORD_NOT_FOUND);
                 }
             } else {
                 $ret = false;
             }
         } else {
             $ret = false;
         }
     } else {
         throw new SSSException(ErrorFactory::ERR_DB_EXECUTE);
     }
     return $ret;
 }
Esempio n. 2
0
 public function updateUserStatus(User $user)
 {
     if (!($user->getStatus() == 'N' || $user->getStatus() == 'I')) {
         throw new SSSException(ErrorFactory::ERR_WRONG_USER_STATUS);
     }
     $userMod = new UserModel();
     try {
         $userFound = $userMod->updateStatus($user);
         if ($userFound === FALSE) {
             throw new SSSException(ErrorFactory::ERR_DB_INVALID_RESULT);
         }
         $ret['result'] = "success";
         return $ret;
     } catch (SSSException $e) {
         return $e->getError();
     }
 }