<?php
/**
 * Clase DP para CrPreAsignarDetalleDP
 *
 * @package    
 * @subpackage CrPreAsignarDetalleDP
 * @author     Willy
 * @version    SVN:: CrPreAsignarDetalleDP.class.php,v 1.1 2018-07-03 15:59:31 william.taype Exp $
 */
class CrPrAsignarDetalleDP extends BaseCrPrAsignarDetalleDP
{
	 public function delete()
  {
    try
    {
      if($this->getIdmercado() && $this->getIdcolaborador() && $this->getFecha())
      {
        $a_Fields = array();

        $con = Conexion::getConexion();
        $sql = "DELETE FROM cr_pr_asignar_detalle WHERE 1 AND idmercado='".$this->getIdmercado()."' AND idcolaborador='".$this->getIdcolaborador()."' AND fecha='".$this->getFecha()."';"; 
        $oLink = method_exists($con, 'getResource')?$con->getResource():$con;
        $result = mysql_query($sql, $oLink);
        if($result)
        {
          $this->nRowsAffected = (int) mysql_affected_rows($oLink);
        }
        else
        {
          throw new Exception( mysql_error($oLink) );
        }
      }
      else
      {
        throw new Exception( 'El id no esta registrado.');
      }
    }
    catch ( Exception $o_Error )
    {
      throw new Exception($o_Error->getMessage().' en '.$o_Error->getFile().' linea '.$o_Error->getLine());
    }
    return true;
  }
}