Next4Me
 All Data Structures Files Functions Variables
application/models/tplMicroflowActionResults.php
Go to the documentation of this file.
00001 <?php
00013 class TplMicroflowActionResults   extends Zend_Db_Table_Abstract {
00014         protected $_name="tplMicroflowActionResults"; 
00015         protected $_primary="IdTplMicroflowActionResult"; 
00016         //==== Start AddEditTplMicroflowActionResults =========================================================================
00031         function AddEditTplMicroflowActionResults($entity) {
00032                         // function implementation
00033             $resultId = 0;
00034             $page="tplMicroflowActionResults.php";
00035             $method="AddEditTplMicroflowActionResults";
00036             $result=json_encode($entity);
00037             $message="";
00038             $type="1";
00039             $this->ErrorCode = new ErrorCode;
00040             $this->Log = new Log;
00041 
00042             try{
00043                 if ($entity['IdTplMicroflowActionResult']=="0"){
00044                     $k=$this->insert($entity);
00045                     $k=$this->getAdapter()->lastInsertId();
00046                     $resultCode=$k;
00047                 }else{
00048                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00049                             ->from("tplMicroflowActionResults","*")
00050                             ->where("IdTplMicroflowActionResult=?",$entity['IdTplMicroflowActionResult'])
00051                     );
00052                 if($rows!=null){
00053                     $IdTplMicroflowAction=$rows->IdTplMicroflowAction;
00054                     if($IdTplMicroflowAction==$entity['IdTplMicroflowAction']){
00055                     $this->update(array(
00056                         "IdTplMicroflowAction" => $entity['IdTplMicroflowAction'], 
00057                         "Name" => $entity['Name'], 
00058                         "Description" => $entity['Description'], 
00059                         "IsSuccess" => $entity['IsSuccess'], 
00060                         "IdTplMicroflowNextAction" => $entity['IdTplMicroflowNextAction'], 
00061                         "IdTplActionTypeResult" => $entity['IdTplActionTypeResult'],
00062                     ),$this->getAdapter()->quoteInto('IdTplMicroflowActionResult=?',$entity['IdTplMicroflowActionResult']));
00063                     $k=$entity['IdTplMicroflowActionResult'];
00064                     $resultCode=$k;
00065                 }else{
00066                     $resultId = 5018;
00067                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00068                     $resultCode=$r['Message'];
00069                     $message=$r['Message'];
00070                     $type=3;    
00071                 }
00072                 }else{
00073                     $resultId = 3073;
00074                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00075                     $resultCode=$r['Message'];
00076                     $message=$r['Message'];
00077                     $type=3;    
00078                 }
00079                 
00080                 }
00081                 
00082             }
00083             catch(Exception $e){
00084                 $resultCode=$e->getMessage();
00085                 $resultId=101;       
00086                 $type=3;
00087             }
00088                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00089                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00090          return $response;
00091         }
00092         //============ End AddEditTplMicroflowActionResults ==============================================================
00093 
00094 
00095         //==== Start DeleteTplMicroflowActionResults =========================================================================
00103         function DeleteTplMicroflowActionResults($entity) {
00104                         // function implementation
00105             $resultId = 0;
00106             $page="tplMicroflowActionResults.php";
00107             $method="DeleteTplMicroflowActionResults";
00108             $result=json_encode($entity);
00109             $message="";
00110             $type="1";
00111             $this->ErrorCode = new ErrorCode;
00112             $this->Log = new Log;
00113 
00114             try{
00115                 $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00116                             ->from("tplMicroflowActionResults","*")
00117                             ->where("IdTplMicroflowActionResult=?",$entity['IdTplMicroflowActionResult'])
00118                     );
00119             if($rows==null){
00120                 $resultId = 3074;
00121                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00122                 $resultCode=$r['Message'];
00123                 $message=$r['Message'];
00124                 $type=3;    
00125             }else{
00126                 $k=$this->delete($this->getAdapter()->quoteInto("IdTplMicroflowActionResult=?",$entity['IdTplMicroflowActionResult']));
00127                 $resultCode="Date sterse";
00128                 }
00129             }
00130             catch(Exception $e){
00131                 $resultCode=$e->getMessage();
00132                 $resultId=101;       
00133                 $type=3;
00134             }
00135                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00136                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00137             return $response;
00138         }
00139         //============ End DeleteTplMicroflowActionResults ==============================================================
00140 
00141 
00142         //==== Start GetTplMicroflowActionResults =========================================================================
00150         function GetTplMicroflowActionResults($entity) {
00151                         // function implementation
00152             $resultId = 0;
00153             $page="tplMicroflowActionResults.php";
00154             $method="GetTplMicroflowActionResults";
00155             $result=json_encode($entity);
00156             $message="";
00157             $type="1";
00158             $this->ErrorCode = new ErrorCode;
00159             $this->Log = new Log;
00160 
00161             try{
00162                  $rows = $this->fetchAll($this->select()->setIntegrityCheck(false)
00163                             ->from("tplMicroflowActionResults","*")
00164                             ->where("IdTplMicroflowActionResult=?",$entity['IdTplMicroflowActionResult'])
00165                             ->orWhere("0=?", $entity['IdTplMicroflowActionResult'])
00166                     );
00167             if(count($rows)!=0){   
00168                 foreach($rows as $row){
00169                     $resultCode[]=array("IdTplMicroflowActionResult" => $row->IdTplMicroflowActionResult,
00170                         "IdTplMicroflowAction" => $row->IdTplMicroflowAction, 
00171                         "Name" => $row->Name, 
00172                         "Description" => $row->Description, 
00173                         "IsSuccess" => $row->IsSuccess, 
00174                         "IdTplMicroflowNextAction" => $row->IdTplMicroflowNextAction,
00175                         "IdTplActionTypeResult" => $row->IdTplActionTypeResult,
00176                         );
00177                 }
00178             }else{
00179                 $resultId = 3075;
00180                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00181                 $resultCode=$r['Message'];
00182                 $message=$r['Message'];
00183                 $type=3;    
00184             }
00185             }
00186             catch(Exception $e){
00187                 $resultCode=$e->getMessage();
00188                 $resultId=101;       
00189                 $type=3;
00190             }
00191                 $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
00192                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00193          return $response;
00194         }
00195         //============ End GetTplMicroflowActionResults ==============================================================
00196 
00197 }
00198 
00199 ?>