public function saveCompanyAction()
 {
     $post = $this->getRequest()->getPost();
     $contact = new Default_Model_ContactPerson();
     $company = new Default_Model_Company();
     $company->setCompanyId($post['company_id']);
     $company->setCompanyName($post['company_name']);
     $company->setBusinesType($post['busines_type']);
     $company->setTel($post['tel']);
     $company->setEmail($post['email']);
     $company->setAddress($post['address']);
     $company->setWebsite($post['website']);
     $company->setInformation($post['information']);
     $company->setAssignCons($post['assign_cons']);
     $company->setCreatedDate(date('Y-m-d'));
     $company->setUpdatedDate(date('Y-m-d'));
     $companyMapper = new Default_Model_CompanyMapper();
     $companyId = $companyMapper->save($company);
     if ($companyId) {
         $contactperson = new Default_Model_ContactPerson();
         $contactperson->setContactPersonId($post['contact_person_id']);
         $contactperson->setCompanyId($companyId);
         $contactperson->setTitle($post['title']);
         $contactperson->setFullName($post['full_name']);
         $contactperson->setJobTitle($post['job_title']);
         $contactperson->setMobile($post['ct_mobile']);
         $contactperson->setEmail($post['ct_email']);
         $contactPersonMapper = new Default_Model_ContactPersonMapper();
         $contactPersonMapper->save($contactperson);
     }
     $this->_redirect('/company');
 }
Exemplo n.º 2
0
 public function fetchAll($where = null, $orderby = null)
 {
     $resultSet = $this->getDbTable()->fetchAll($where, $orderby);
     $entries = array();
     $entry = new Default_Model_Company();
     foreach ($resultSet as $row) {
         $entry->setCompanyId($row->company_id);
         $entry->setCompanyName($row->company_name);
         $entry->setBusinesType($row->busines_type);
         $entry->setTel($row->tel);
         $entry->setEmail($row->email);
         $entry->setAddress($row->address);
         $entry->setWebsite($row->website);
         $entry->setInformation($row->information);
         $entry->setAssignCons($row->assign_cons);
         $entry->setCreatedDate($row->created_date);
         $entry->setUpdatedDate($row->updated_date);
         $entries[] = $entry;
     }
     return $entries;
 }