/**
  *
  * @access public
  * @static
  * @param Rate $obj
  * @return Rate|false
  */
 public static function Add($obj)
 {
     $cmd = sprintf("INSERT INTO zi_rates (user_id,idea_id) VALUES(%d,%d)", $obj->user_id, $obj->idea_id);
     try {
         if (!Database::Query($cmd, false)) {
             throw new RateException("can't add rate");
         }
         $obj->rate_id = Database::GetLastInsertId();
     } catch (Exception $e) {
         Debug::Log($e, ERROR);
         return false;
     }
     return $obj;
 }
 /**
  *
  * @access public
  * @static
  * @return Idea|false
  */
 public static function Add($obj)
 {
     $cmd = sprintf("INSERT INTO zi_ideas (idea_title,idea_date,user_id,idea_rate,idea_desc) VALUES('%s',%d,%d,%d,'%s')", $obj->idea_title, $obj->idea_date, $obj->user_id, $obj->idea_rate, $obj->GetDesc());
     try {
         if (!Database::Query($cmd, false)) {
             throw new IdeaException("can't add idea");
         }
         $obj->idea_id = Database::GetLastInsertId();
     } catch (Exception $e) {
         Debug::Log($e, ERROR);
         return false;
     }
     return $obj;
 }
 /**
  *
  * @access public
  * @static
  * @return Comment|false
  */
 public static function Add($obj)
 {
     $cmd = sprintf("INSERT INTO zi_comments (comment_date,user_id,comment_text,idea_id) VALUES(%d,%d,'%s',%d)", $obj->comment_date, $obj->user_id, $obj->GetText(), $obj->idea_id);
     try {
         if (!Database::Query($cmd, false)) {
             throw new CommentException("can't add comment");
         }
         $obj->comment_id = Database::GetLastInsertId();
     } catch (Exception $e) {
         Debug::Log($e, ERROR);
         return false;
     }
     return $obj;
 }
 /**
  * 
  * @static
  * @return User|false     
  */
 public static function Add($obj)
 {
     $cmd = sprintf("INSERT INTO zi_users (user_name,user_email,user_password,user_regdate) VALUES('%s','%s','%s',%d)", $obj->user_name, $obj->user_email, $obj->user_password, $obj->user_regdate);
     try {
         if (!Database::Query($cmd, false)) {
             throw new UserException("can't add user");
         }
         $obj->user_id = Database::GetLastInsertId();
     } catch (Exception $e) {
         Debug::Log($e, ERROR);
         return false;
     }
     return $obj;
 }