コード例 #1
0
 public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Employeestatus'])) {
         $messages = $this->ValidateData(array(array($_POST['Employeestatus']['employeestatusname'], 'emptyemployeestatusname', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Employeestatus'];
             if ((int) $_POST['Employeestatus']['employeestatusid'] > 0) {
                 $model = $this->loadModel($_POST['Employeestatus']['employeestatusid']);
                 $model->employeestatusname = $_POST['Employeestatus']['employeestatusname'];
                 $model->taxvalue = $_POST['Employeestatus']['taxvalue'];
                 $model->recordstatus = $_POST['Employeestatus']['recordstatus'];
             } else {
                 $model = new Employeestatus();
                 $model->attributes = $_POST['Employeestatus'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Employeestatus']['employeestatusid']);
                     $this->GetSMessage('hrmesinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }