<?php

Doo::loadModel('itemmnum');

class ItemMeasureNumpofper
{

    private $__itemMeasureNum;

    function __construct()
    {
        $this->__itemMeasureNum = new ItemMeasureNumofper();
    }

    public function insert($postArray)
    {
        $this->__itemMeasureNum->iaid = $postArray['iaid'];
        $this->__itemMeasureNum->ownerid = $postArray['ownerid'];
        $this->__itemMeasureNum->softwareitemid = $postArray['itemid'];
        $this->__itemMeasureNum->pid = $postArray['pid'];
        $this->__itemMeasureNum->pmid = $postArray['pmid'];
        $this->__itemMeasureNum->isdel = 0;
        $this->__itemMeasureNum->deltime = 0;
        $this->__itemMeasureNum->categoryid = $postArray['categoryid'];
        $this->__itemMeasureNum->tips = $postArray['tips'];
        $this->__itemMeasureNum->numpname = $postArray['numpname'];
        $this->__itemMeasureNum->intime = time();
        return $this->__itemMeasureNum->insert();
    }

    public function getItemMeasureNum($tenderid)
    {
        return $this->__itemMeasureNum->find(array('where' => 'pmid=?', 'param' => array($tenderid), 'asArray' => TRUE));
    }

    public function getRowData($imnid)
    {
        return $this->__itemMeasureNum->getOne(array('where' => 'imnid=?', 'param' => array($imnid), 'asArray' => TRUE));
    }

    public function updateItemFields($id, $tips)
    {
        $this->__itemMeasureNum->tips = iconv('GBK', 'UTF-8', $tips);
        return $this->__itemMeasureNum->update(array('where' => 'imnid=?', 'param' => array($id)));
    }

    public function delItemFields($imnid)
    {
        return $this->__itemMeasureNum->delete(array('where' => 'imnid=?', 'param' => array($imnid)));
    }
}