Next4Me
 All Data Structures Files Functions Variables
application/models/MicroflowActionResults.php
Go to the documentation of this file.
00001 <?php 
00017 class MicroflowActionResults  extends Zend_Db_Table_Abstract {
00018     //put your code here
00019     protected $_name="MicroflowActionResults"; 
00020     protected $_primary="IdMicroflowActionResult"; 
00021     
00022 
00023         //==== Start AddEditMicroflowActionResults =========================================================================
00039         function AddEditMicroflowActionResults($entity) {
00040                         // function implementation
00041             $resultId = 0;
00042             $page="MicroflowActionResults.php";
00043             $method="AddEditMicroflowActionResults";
00044             $result=json_encode($entity);
00045             $message="";
00046             $type="1";
00047             $this->ErrorCode = new ErrorCode;
00048             $this->Log = new Log;
00049 
00050             try{
00051                 if ($entity['IdMicroflowActionResult']=="0"){
00052                     $k=$this->insert($entity);
00053                     $k=$this->getAdapter()->lastInsertId();
00054                     $resultCode=$k;
00055                 }else{
00056                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00057                     ->from("MicroflowActionResults","*")
00058                     ->where("IdMicroflowActionResult=?",$entity['IdMicroflowActionResult'])
00059                     );
00060                 if($rows!=null){
00061                     $IdMicroflowAction=$rows->IdMicroflowAction;
00062                     if($IdMicroflowAction==$entity['IdMicroflowAction']){
00063                     $this->update(array(
00064                         "IdMicroflowAction" => $entity['IdMicroflowAction'],
00065                         "ResultName" => $entity['ResultName'], 
00066                         "Description" => $entity['Description'], 
00067                         "IsSucces" => $entity['IsSucces'], 
00068                         "IdTplMicroflowActionResult" => $entity['IdTplMicroflowActionResult'], 
00069                         "IdMicroflowNextAction" => $entity['IdMicroflowNextAction'], 
00070                     ),$this->getAdapter()->quoteInto('IdMicroflowActionResult=?',$entity['IdMicroflowActionResult']));
00071                     $k=$entity['IdMicroflowActionResult'];
00072                     $resultCode=$k;                        
00073                     }else{
00074                         $resultId = 5006;
00075                         $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00076                         $resultCode=$r['Message'];
00077                         $message=$r['Message'];
00078                         $type=3;
00079                 }
00080                 }else{
00081                     $resultId = 3025;
00082                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00083                     $resultCode=$r['Message'];
00084                     $message=$r['Message'];
00085                     $type=3;
00086                 }
00087 
00088                 }
00089             }
00090             catch(Exception $e){
00091                 $resultCode=$e->getMessage();
00092                 $resultId=101;       
00093                 $type=3;
00094             }
00095                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00096                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00097          return $response;
00098         }
00099         //============ End AddEditMicroflowActionResults ==============================================================
00100 
00101 
00102         //==== Start DeleteMicroflowActionResults =========================================================================
00112         function DeleteMicroflowActionResults($entity) {
00113                         // function implementation
00114             $resultId = 0;
00115             $page="MicroflowActionResults.php";
00116             $method="DeleteMicroflowActionResults";
00117             $result=json_encode($entity);
00118             $message="";
00119             $type="1";
00120             $this->ErrorCode = new ErrorCode;
00121             $this->Log = new Log;
00122 
00123             try{
00124                 if(isset($entity['IdMicroflowActionResult'])&&$entity['IdMicroflowActionResult']!=null)
00125                 {
00126                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00127                                 ->from("MicroflowActionResults","*")
00128                                 ->where("IdMicroflowActionResult=?",$entity['IdMicroflowActionResult'])
00129                         );
00130                     if($rows==null){
00131                         $resultId = 3026;
00132                         $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00133                         $resultCode=$r['Message'];
00134                         $message=$r['Message'];
00135                         $type=3;
00136                     }else{
00137                         $k=$this->delete($this->getAdapter()->quoteInto("IdMicroflowActionResult=?",$entity['IdMicroflowActionResult']));
00138                         $resultCode="Date sterse";
00139                     }
00140                 }
00141                 if(isset($entity['IdMicroflowAction'])&&$entity['IdMicroflowAction']!=null)
00142                 {
00143                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00144                                 ->from("MicroflowActionResults","*")
00145                                 ->where("IdMicroflowAction=?",$entity['IdMicroflowAction'])
00146                         );
00147                     if($rows==null){
00148                         $resultId = 3026;
00149                         $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00150                         $resultCode=$r['Message'];
00151                         $message=$r['Message'];
00152                         $type=3;
00153                     }else{
00154                         $k=$this->delete($this->getAdapter()->quoteInto("IdMicroflowAction=?",$entity['IdMicroflowAction']));
00155                         $resultCode="Date sterse";
00156                     }
00157                 }
00158             }
00159             catch(Exception $e){
00160                 $resultCode=$e->getMessage();
00161                 $resultId=101;       
00162                 $type=3;
00163             }
00164                 $this->Log->save($page,$method,$result,$resultId.'=>'.$resultCode,$type);
00165                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00166             return $response;
00167         }
00168         //============ End DeleteMicroflowActionResults ==============================================================
00169 
00170 
00171         //==== Start GetMicroflowActionResults =========================================================================
00184         function GetMicroflowActionResults($entity) {
00185                         // function implementation
00186             $resultId = 0;
00187             $page="MicroflowActionResults.php";
00188             $method="GetMicroflowActionResults";
00189             $result=json_encode($entity);
00190             $message="";
00191             $type="1";
00192             $this->ErrorCode = new ErrorCode;
00193             $this->Log = new Log;
00194 
00195             try{
00196                 if(isset($entity['IdMicroflowActionResult'])&&$entity['IdMicroflowActionResult']!=null){
00197                     $IdMicroflowActionResult=$entity['IdMicroflowActionResult'];
00198                 }else{
00199                     $IdMicroflowActionResult=0;
00200                 }
00201                 if(isset($entity['IdMicroflowAction'])&&$entity['IdMicroflowAction']!=null){
00202                     $IdMicroflowAction=$entity['IdMicroflowAction'];
00203                 }else{
00204                     $IdMicroflowAction=0;
00205                 }
00206                 $rows = $this->fetchAll($this->select()->setIntegrityCheck(false)
00207                             ->from("MicroflowActionResults","*")
00208                             ->where("IdMicroflowActionResult=$IdMicroflowActionResult OR 0=$IdMicroflowActionResult")
00209                             ->where("IdMicroflowAction=$IdMicroflowAction OR 0=$IdMicroflowAction")
00210                     );
00211                 if(count($rows)!=0){
00212                     foreach($rows as $row){
00213                         $resultCode[]=array("IdMicroflowActionResult"=>$row->IdMicroflowActionResult,
00214                             "IdMicroflowAction"=>$row->IdMicroflowAction, 
00215                             "ResultName"=>$row->ResultName,
00216                             "Description"=>$row->Description,
00217                             "IsSucces"=>$row->IsSucces,
00218                             "IdTplMicroflowActionResult"=>$row->IdTplMicroflowActionResult,
00219                             "IdMicroflowNextAction"=>$row->IdMicroflowNextAction);
00220                     }                
00221                 }else{
00222                     $resultId = 3027;
00223                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00224                     $resultCode=$r['Message'];
00225                     $message=$r['Message'];
00226                     $type=3;
00227                 }
00228             }
00229             catch(Exception $e){
00230                 $resultCode=$e->getMessage();
00231                 $resultId=101;       
00232                 $type=3;
00233             }
00234                 $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
00235                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00236          return $response;
00237         }
00238         //============ End GetMicroflowActionResults ==============================================================
00239 
00240 }
00241 
00242 ?>