public function actionWrite() { if (isset($_POST['Addressbook'])) { $messages = $this->ValidateData(array(array($_POST['Addressbook']['fullname'], 'emptyfullname', 'emptystring'))); if ($messages == '') { //$dataku->attributes=$_POST['Addressbook']; if ((int) $_POST['Addressbook']['addressbookid'] > 0) { $model = $this->loadModel($_POST['Addressbook']['addressbookid']); $model->fullname = $_POST['Addressbook']['fullname']; $model->iscustomer = $_POST['Addressbook']['iscustomer']; $model->isemployee = $_POST['Addressbook']['isemployee']; $model->isapplicant = $_POST['Addressbook']['isapplicant']; $model->isvendor = $_POST['Addressbook']['isvendor']; $model->isinsurance = $_POST['Addressbook']['isinsurance']; $model->isbank = $_POST['Addressbook']['isbank']; $model->ishospital = $_POST['Addressbook']['ishospital']; $model->iscatering = $_POST['Addressbook']['iscatering']; $model->isstudent = $_POST['Addressbook']['isstudent']; $model->recordstatus = $_POST['Addressbook']['recordstatus']; } else { $model = new Addressbook(); $model->attributes = $_POST['Addressbook']; } try { if ($model->save()) { $this->DeleteLock($this->menuname, $_POST['Addressbook']['addressbookid']); $this->GetSMessage('coabinsertsuccess'); } else { $this->GetMessage($model->getErrors()); } } catch (Exception $e) { $this->GetMessage($e->getMessage()); } } } }