Next4Me
 All Data Structures Files Functions Variables
application/models/tplAssetPropertiesMicroflow.php
Go to the documentation of this file.
00001 <?php 
00014 class TplAssetPropertiesMicroflow   extends Zend_Db_Table_Abstract {
00015         protected $_name="tplAssetPropertiesMicroflow"; 
00016         protected $_primary="IdTplAssetPropertiesMicroflow"; 
00017         //==== Start AddEditTplAssetPropertiesMicroflow =========================================================================
00028         function AddEditTplAssetPropertiesMicroflow($entity) {
00029                         // function implementation
00030             $resultId = 0;
00031             $page="tplAssetPropertiesMicroflow.php";
00032             $method="AddEditTplAssetPropertiesMicroflow";
00033             $result=json_encode($entity);
00034             $message="";
00035             $type="1";
00036             $this->ErrorCode = new ErrorCode;
00037             $this->Log = new Log;
00038 
00039             try{
00040                 if ($entity['IdTplAssetPropertiesMicroflow']=="0"){
00041                     $k=$this->insert($entity);
00042                     $k=$this->getAdapter()->lastInsertId();
00043                     $resultCode=$k;    
00044                 }else{
00045                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00046                             ->from("tplAssetPropertiesMicroflow","*")
00047                             ->where("IdTplAssetPropertiesMicroflow=?",$entity['IdTplAssetPropertiesMicroflow'])
00048                     );
00049                 if($rows!=null){
00050                     $IdTplAssetTypeProperty=$rows->IdTplAssetTypeProperty;
00051                     if($IdTplAssetTypeProperty==$entity['IdTplAssetTypeProperty']){
00052                     $this->update(array(
00053                         "IdTplAssetTypeProperty" => $entity['IdTplAssetTypeProperty'], 
00054                         "IdTplMf" => $entity['IdTplMf'],
00055                     ),$this->getAdapter()->quoteInto('IdTplAssetPropertiesMicroflow=?',$entity['IdTplAssetPropertiesMicroflow']));
00056                     $k=$entity['IdTplAssetPropertiesMicroflow'];
00057                     $resultCode=$k;
00058                     }else{
00059                     $resultId = 5010;
00060                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00061                 $resultCode=$r['Message'];
00062                 $message=$r['Message'];
00063                 $type=3;    
00064                 }
00065                 }else{
00066                     $resultId = 3040;
00067                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00068                 $resultCode=$r['Message'];
00069                 $message=$r['Message'];
00070                 $type=3;    
00071                 }
00072                 
00073                 }
00074                     
00075                
00076             }
00077             catch(Exception $e){
00078                 $resultCode=$e->getMessage();
00079                 $resultId=101;       
00080                 $type=3;
00081             }
00082                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00083                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00084          return $response;
00085         }
00086         //============ End AddEditTplAssetPropertiesMicroflow ==============================================================
00087 
00088 
00089         //==== Start DeleteTplAssetPropertiesMicroflow =========================================================================
00097         function DeleteTplAssetPropertiesMicroflow($entity) {
00098                         // function implementation
00099             $resultId = 0;
00100             $page="tplAssetPropertiesMicroflow.php";
00101             $method="DeleteTplAssetPropertiesMicroflow";
00102             $result=json_encode($entity);
00103             $message="";
00104             $type="1";
00105             $this->ErrorCode = new ErrorCode;
00106             $this->Log = new Log;
00107 
00108             try{
00109                 $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00110                             ->from("tplAssetPropertiesMicroflow","*")
00111                             ->where("IdTplAssetPropertiesMicroflow=?",$entity['IdTplAssetPropertiesMicroflow'])
00112                     );
00113             if($rows==null){
00114                     $resultId = 3041;
00115                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00116                 $resultCode=$r['Message'];
00117                 $message=$r['Message'];
00118                 $type=3;    
00119             }else{
00120                 $k=$this->delete($this->getAdapter()->quoteInto("IdTplAssetPropertiesMicroflow=?",$entity['IdTplAssetPropertiesMicroflow']));
00121                 $resultCode="Date sterse";
00122                 }
00123             }
00124             catch(Exception $e){
00125                 $resultCode=$e->getMessage();
00126                 $resultId=101;       
00127                 $type=3;
00128             }
00129                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00130                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00131             return $response;
00132         }
00133         //============ End DeleteTplAssetPropertiesMicroflow ==============================================================
00134 
00135 
00136         //==== Start GetTplAssetPropertiesMicroflow =========================================================================
00144         function GetTplAssetPropertiesMicroflow($entity) {
00145                         // function implementation
00146             $resultId = 0;
00147             $page="tplAssetPropertiesMicroflow.php";
00148             $method="GetTplAssetPropertiesMicroflow";
00149             $result=json_encode($entity);
00150             $message="";
00151             $type="1";
00152             $this->ErrorCode = new ErrorCode;
00153             $this->Log = new Log;
00154 
00155             try{
00156                  $rows = $this->fetchAll($this->select()->setIntegrityCheck(false)
00157                             ->from("tplAssetPropertiesMicroflow","*")
00158                             ->where("IdTplAssetPropertiesMicroflow=?",$entity['IdTplAssetPropertiesMicroflow'])
00159                             ->orWhere("0=?", $entity['IdTplAssetPropertiesMicroflow'])
00160                     );
00161             if(count($rows)!=0){
00162                 foreach($rows as $row){
00163                     $resultCode[]=array("IdTplAssetPropertiesMicroflow" => $row->IdTplAssetPropertiesMicroflow,
00164                         "IdTplAssetTypeProperty" => $row->IdTplAssetTypeProperty, 
00165                         "IdTplMf" => $row->IdTplMf, 
00166                          );
00167                 }                
00168             }else{
00169                 $resultId = 3042;
00170                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00171                 $resultCode=$r['Message'];
00172                 $message=$r['Message'];
00173                 $type=3;    
00174             }
00175             }
00176             catch(Exception $e){
00177                 $resultCode=$e->getMessage();
00178                 $resultId=101;       
00179                 $type=3;
00180             }
00181                 $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
00182                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00183          return $response;
00184         }
00185         //============ End GetTplAssetPropertiesMicroflow ==============================================================
00186 
00187 }
00188 
00189 ?>