Next4Me
 All Data Structures Files Functions Variables
application/models/MicroflowActionProperties.php
Go to the documentation of this file.
00001 <?php 
00017 class MicroflowActionProperties   extends Zend_Db_Table_Abstract {
00018         //put your code here
00019         protected $_name="MicroflowActionProperties"; 
00020         protected $_primary="IdMicroflowActionProperty"; 
00021 
00022 
00023         //==== Start AddEditMicroflowActionProperties =========================================================================
00037         function AddEditMicroflowActionProperties($entity) {
00038                         // function implementation
00039             $resultId = 0;
00040             $page="MicroflowActionProperties.php";
00041             $method="AddEditMicroflowActionProperties";
00042             $result=json_encode($entity);
00043             $message="";
00044             $type="1";
00045             $this->ErrorCode = new ErrorCode;
00046             $this->Log = new Log;
00047 
00048             try{
00049                 if ($entity['IdMicroflowActionProperty']=="0"){
00050                     $k=$this->insert($entity);
00051                     $k=$this->getAdapter()->lastInsertId();
00052                     $resultCode=$k;
00053                 }else{
00054                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00055                     ->from("MicroflowActionProperties","*")
00056                     ->where("IdMicroflowActionProperty=?",$entity['IdMicroflowActionProperty'])
00057                     );
00058                 if($rows!=null){
00059                     $IdMicroflowAction=$rows->IdMicroflowAction;
00060                     if($IdMicroflowAction==$entity['IdMicroflowAction']){
00061                     $this->update(array(
00062                         "IdMicroflowAction"=>$entity['IdMicroflowAction'],
00063                         "IdTplActionTypeProperty" => $entity['IdTplActionTypeProperty'],
00064                         "PropertyString" => $entity['PropertyString'],
00065                         "PropertyValue" => $entity['PropertyValue'], 
00066                         "PropertyDate" => $entity['PropertyDate'],
00067                         "PropertyType" => $entity['PropertyType'],
00068                         "PropertyName" => $entity['PropertyName'], 
00069                     ),$this->getAdapter()->quoteInto('IdMicroflowActionProperty=?',$entity['IdMicroflowActionProperty']));
00070                     $k=$entity['IdMicroflowActionProperty'];
00071                     $resultCode=$k;
00072                     }else{
00073                         $resultId = 5005;
00074                         $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00075                         $resultCode=$r['Message'];
00076                         $message=$r['Message'];
00077                         $type=3;
00078                 }
00079                 }else{
00080                     $resultId = 3022;
00081                     $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00082                     $resultCode=$r['Message'];
00083                     $message=$r['Message'];
00084                     $type=3;
00085                 }
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 AddEditMicroflowActionProperties ==============================================================
00100 
00101 
00102         //==== Start DeleteMicroflowActionProperties =========================================================================
00112         function DeleteMicroflowActionProperties($entity) {
00113                         // function implementation
00114             $resultId = 0;
00115             $page="MicroflowActionProperties.php";
00116             $method="DeleteMicroflowActionProperties";
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['IdMicroflowActionProperty'])&&$entity['IdMicroflowActionProperty']!=null)
00125                 {
00126                     $rows = $this->fetchRow($this->select()->setIntegrityCheck(false)
00127                                 ->from("MicroflowActionProperties","*")
00128                                 ->where("IdMicroflowActionProperty=?",$entity['IdMicroflowActionProperty'])
00129                         );
00130                     if($rows==null){
00131                         $resultId = 3023;
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("IdMicroflowActionProperty=?",$entity['IdMicroflowActionProperty']));
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("MicroflowActionProperties","*")
00145                                 ->where("IdMicroflowAction=?",$entity['IdMicroflowAction'])
00146                         );
00147                     if($rows==null){
00148                         $resultId = 3023;
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 DeleteMicroflowActionProperties ==============================================================
00169 
00170 
00171         //==== Start GetMicroflowActionProperties =========================================================================
00184         function GetMicroflowActionProperties($entity) {
00185                         // function implementation
00186             $resultId = 0;
00187             $page="MicroflowActionProperties.php";
00188             $method="GetMicroflowActionProperties";
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['IdMicroflowAction'])&&$entity['IdMicroflowAction']!=null){
00197                     $IdMicroflowAction=$entity['IdMicroflowAction'];
00198                 }else{
00199                     $IdMicroflowAction=0;
00200                 }
00201                 if(isset($entity['IdMicroflowActionProperty'])&&$entity['IdMicroflowActionProperty']!=null){
00202                     $IdMicroflowActionProperty=$entity['IdMicroflowActionProperty'];
00203                 }else{
00204                     $IdMicroflowActionProperty=0;
00205                 }
00206                 $rows = $this->fetchAll($this->select()->setIntegrityCheck(false)
00207                             ->from("MicroflowActionProperties","*")
00208                             ->where("IdMicroflowActionProperty=$IdMicroflowActionProperty OR 0=$IdMicroflowActionProperty")
00209                             ->where("IdMicroflowAction=$IdMicroflowAction OR 0=$IdMicroflowAction")
00210                     );
00211             if(count($rows)!=0){
00212                 foreach($rows as $row){
00213                     $resultCode[]=array("IdMicroflowActionProperty"=>$row->IdMicroflowActionProperty,
00214                         "IdMicroflowAction"=>$row->IdMicroflowAction, 
00215                         "IdTplActionTypeProperty"=>$row->IdTplActionTypeProperty,
00216                         "PropertyString" => $row->PropertyString,
00217                         "PropertyValue" => $row->PropertyValue, 
00218                         "PropertyDate" => $row->PropertyDate,
00219                         "PropertyType" => $row->PropertyType,
00220                         "PropertyName"=>$row->PropertyName);
00221                 }                
00222             }else{
00223                 $resultId = 3024;
00224                 $r=$this->ErrorCode->GetErrorCode($resultId,Zend_Registry::get('language'));
00225                 $resultCode=$r['Message'];
00226                 $message=$r['Message'];
00227                 $type=3;
00228             }
00229             }
00230             catch(Exception $e){
00231                 $resultCode=$e->getMessage();
00232                 $resultId=101;       
00233                 $type=3;
00234             }
00235                 $this->Log->save($page,$method,$result,$resultId.'=>'.json_encode($resultCode),$type);
00236                 $response=array("resultId"=>$resultId,"resultCode"=>$resultCode);
00237          return $response;
00238         }
00239         //============ End GetMicroflowActionProperties ==============================================================
00240 
00241 }
00242 
00243 
00244 ?>