public function actionWrite()
 {
     parent::actionWrite();
     if (isset($_POST['Plant'])) {
         $messages = $this->ValidateData(array(array($_POST['Plant']['plantcode'], 'emptyplantcode', 'emptystring'), array($_POST['Plant']['description'], 'emptydescription', 'emptystring')));
         if ($messages == '') {
             //$dataku->attributes=$_POST['Plant'];
             if ((int) $_POST['Plant']['plantid'] > 0) {
                 $model = $this->loadModel($_POST['Plant']['plantid']);
                 $model->plantcode = $_POST['Plant']['plantcode'];
                 $model->description = $_POST['Plant']['description'];
                 $model->recordstatus = $_POST['Plant']['recordstatus'];
             } else {
                 $model = new Plant();
                 $model->attributes = $_POST['Plant'];
             }
             try {
                 if ($model->save()) {
                     $this->DeleteLock($this->menuname, $_POST['Plant']['plantid']);
                     $this->GetSMessage('cplinsertsuccess');
                 } else {
                     $this->GetMessage($model->getErrors());
                 }
             } catch (Exception $e) {
                 $this->GetMessage($e->getMessage());
             }
         }
     }
 }