Пример #1
0
 public function addProgramAction()
 {
     if ($this->getRequest()->isPost()) {
         try {
             $_data = $this->getRequest()->getPost();
             $_model = new Accounting_Model_DbTable_DbProgram();
             $id = $_model->addprogram($_data);
             $_model = new Application_Model_GlobalClass();
             $service_option = $_model->getAllServiceItemOption();
             $rs = array('id' => $id, "msg" => "INSERT_SUCCESS", 'service_option' => $service_option);
             print_r(Zend_Json::encode($rs));
             exit;
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("INSERT_FAIL");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
 }
Пример #2
0
 public function editProgramAction()
 {
     $id = $this->getRequest()->getParam("id");
     $db = new Accounting_Model_DbTable_DbProgram();
     $row = $db->getProgramById($id);
     if ($this->getRequest()->isPost()) {
         try {
             $data = $this->getRequest()->getPost();
             $data["id"] = $id;
             $db = new Accounting_Model_DbTable_DbProgram();
             $row = $db->updateprogram($data);
             Application_Form_FrmMessage::Sucessfull("EDIT_SUCCESS", "/accounting/program/index");
         } catch (Exception $e) {
             Application_Form_FrmMessage::message("EDIT_FAIL");
             Application_Model_DbTable_DbUserLog::writeMessageError($e->getMessage());
         }
     }
     $obj = new Accounting_Form_FrmProgram();
     $frm = $obj->addProgramName($row);
     $this->view->frm = $frm;
     Application_Model_Decorator::removeAllDecorator($frm);
 }