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