public function actionWrite() { parent::actionWrite(); if (isset($_POST['Contacttype'])) { $messages = $this->ValidateData(array(array($_POST['Contacttype']['contacttypename'], 'emptycontacttypename', 'emptystring'))); if ($messages == '') { //$dataku->attributes=$_POST['Contacttype']; if ((int) $_POST['Contacttype']['contacttypeid'] > 0) { $model = $this->loadModel($_POST['Contacttype']['contacttypeid']); $model->contacttypename = $_POST['Contacttype']['contacttypename']; $model->recordstatus = $_POST['Contacttype']['recordstatus']; } else { $model = new Contacttype(); $model->attributes = $_POST['Contacttype']; } try { if ($model->save()) { $this->DeleteLock($this->menuname, $_POST['Contacttype']['contacttypeid']); $this->GetSMessage('cctyinsertsuccess'); } else { $this->GetMessage($model->getErrors()); } } catch (Exception $e) { $this->GetMessage($e->getMessage()); } } } }