Inheritance: extends BaseService
Beispiel #1
0
 public function processSalesForm($data)
 {
     $this->db->trans_begin();
     $salesTransactionId = null;
     try {
         Debug::log($data);
         $customerService = new CustomerService();
         $customerId = $customerService->saveOrUpdate($data);
         $data['customerId'] = $customerId;
         $salesTransactionService = new SalesTransactionService();
         $salesTransactionId = $salesTransactionService->insert($data);
         $data['salesTransactionId'] = $salesTransactionId;
         $salesObjs = $this->marshallSales($data);
         $salesObjs = $this->mergeSimilarItems($salesObjs);
         $totals = $this->saveAndComputeTotal($salesObjs);
         $data['totalPrice'] = $totals['totalPrice'];
         $data['totalVatable'] = $totals['totalVatable'];
         $data['totalVat'] = $totals['totalVat'];
         Debug::log('removing items from the stocks');
         $this->removeItemsFromStocks($salesObjs);
         Debug::log('updating sales transaction data');
         $salesTransactionService->update($data);
         $this->_createCreditPayment($data);
     } catch (Exception $e) {
         $this->db->trans_rollback();
         throw new Exception($e->getMessage());
     }
     $this->db->trans_commit();
     return $salesTransactionId;
 }
Beispiel #2
0
 public function detailsforcustomer()
 {
     $customerId = $this->input->post('customerId');
     $customerService = new CustomerService();
     $details = $customerService->fetchCustomersWithCredit();
     $this->renderAjaxView('detailsforcustomer', array('details' => $details));
 }
/**
 * Get Customer info
 * @param  [Array] $options
 */
function getCustomerInfos($options)
{
    $CustomerService = new CustomerService();
    $CustomerService->auth($options['credentials']);
    $data = $CustomerService->getInfos();
    $data = json_encode($data);
    fwrite(STDOUT, $data);
}
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
require './EmailContent.php';
require './SendingEmail.php';
$iniConfiguration = parse_ini_file("../../model-db-connection/configuration.ini");
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
$emailOrUsernam = (string) filter_input(INPUT_POST, 'result');
if ($customerService->getCustomerByEmail($emailOrUsernam) != 404) {
    $jsonObj = $customerService->getCustomerByEmail($emailOrUsernam);
    $obj = json_decode($jsonObj);
    echo "200:" . $obj->{'CUS_FIRST_NAME'} . "||" . $obj->{'CUS_LAST_NAME'} . "||" . $obj->{'CUS_PHONE_NUMBER'} . "||" . $obj->{'CUS_EMAIL'} . "||" . $obj->{'CUS_CONTACT_ADDRESS'} . "||" . $obj->{'CUS_RECEIPT_ADDRESS'} . "||" . $obj->{'CUS_ID'};
} else {
    if ($customerService->getCustomerByUsername($emailOrUsernam) != 404) {
        $jsonObj = $customerService->getCustomerByUsername($emailOrUsernam);
        $obj = json_decode($jsonObj);
        echo "200:" . $obj->{'CUS_FIRST_NAME'} . "||" . $obj->{'CUS_LAST_NAME'} . "||" . $obj->{'CUS_PHONE_NUMBER'} . "||" . $obj->{'CUS_EMAIL'} . "||" . $obj->{'CUS_CONTACT_ADDRESS'} . "||" . $obj->{'CUS_RECEIPT_ADDRESS'} . "||" . $obj->{'CUS_ID'};
    } else {
        echo 'ชื่อผู้ใช้(Username) หรือ อีเมล(Email) ไม่ถูกต้อง';
    }
}
 /**
  * Update Project
  * @param sfWebRequest $request
  * @return unknown_type
  */
 public function executeUpdateProject(sfWebRequest $request)
 {
     $projectService = new ProjectService();
     $project = $projectService->getProjectById($request->getParameter('id'));
     $this->project = $project;
     if ($request->isMethod('post')) {
         $project->setCustomerId($request->getParameter('cmbCustomerId'));
         $project->setName($request->getParameter('txtName'));
         $project->setDescription($request->getParameter('txtDescription'));
         $projectService->saveProject($project);
         $this->setMessage('SUCCESS', array(TopLevelMessages::UPDATE_SUCCESS));
         $this->redirect('admin/listProject');
     }
     $companyService = new CompanyService();
     $customerService = new CustomerService();
     $this->listCustomer = $customerService->getCustomerList();
     $this->projectAdmins = $projectService->getProjectAdminByProjectId($project);
     $this->empJson = $companyService->getEmployeeListAsJson();
 }
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
if ($customerService->duplicationEmail($_GET['email'])) {
    echo "อีเมลนี้ได้ถูกใช้ในการลงทะเบียนเรียบร้อยแล้ว";
} else {
    echo 200;
}
Beispiel #7
0
            <div class="bd" style="display: block;">
                <div class="bk time"><h3>在线时间</h3><span>09:00-23:00</span></div>
                <div class="kf bk">
                    <?php 
$category = Category::model()->findByPk('104');
$service_category = $category->children()->findAll();
foreach ($service_category as $sc) {
    ?>
                        <h3><?php 
    echo $sc->name;
    ?>
</h3>
                        <ul>
                            <?php 
    $cri = new CDbCriteria(array('condition' => 'category_id =' . $sc->id));
    $CustomerService = CustomerService::model()->findAll($cri);
    foreach ($CustomerService as $cs) {
        ?>
                            <li><span><?php 
        echo $cs->nick_name;
        ?>
</span>
                                <?php 
        if ($cs->type == 1) {
            ?>
                                <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=<?php 
            echo $cs->account;
            ?>
&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:<?php 
            echo $cs->account;
            ?>
        return flag;
    }
</script>
</head>
<body>
<?php 
global $msg;
$msg = '';
if (isset($_POST["btnRegister"])) {
    $userName = $_POST['customerName'];
    $password = $_POST['customerPassword'];
    $home = $_POST['home'];
    $work = $_POST['work'];
    $mobile = $_POST['mobile'];
    $email = $_POST['email'];
    $service = new CustomerService();
    $sqln = "select * from customer where customer_name='{$userName}'";
    $num = $service->GetCount($sqln);
    if ($num > 0) {
        echo 'aa';
        $flag = false;
        $msg = "This user name has been exsited.";
    } else {
        $sql = " insert into customer ";
        $dataArray = array("customer_name" => "'" . $userName . "'", "customer_password" => "'" . $password . "'", "customer_home_phone" => "'" . $home . "'", "customer_work_phone" => "'" . $work . "'", "customer_mobile_phone" => "'" . $mobile . "'", "customer_email" => "'" . $email . "'", "customer_status" => "'available'");
        $sql .= $service->GetInsertSQL($dataArray);
        $id = $service->saveCustomer($sql, $email, $userName, $password);
        if ($id != 0) {
            //ok
            Redirect("Login.php?register=ok");
        } else {
Beispiel #9
0
 public function run()
 {
     $cri = new CDbCriteria(array('condition' => 'is_show = 1', 'order' => 'sort_order asc, id desc'));
     $CustomerService = CustomerService::model()->findAll($cri);
     $this->render('customerService', array('CustomerService' => $CustomerService));
 }
					<td width="5" valign="bottom" class="navigation">&nbsp;
						
					</td>
					<td valign="bottom" class="navigation">
						Customer Management--Display Customer
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>

<form  id="pageForm" name="pageForm" method="post" action="DisplayCustomer.php">
<?php 
include_once 'DataGrid.php';
?>
</form>
</body>
</html>

<?php 
if (isset($_GET["customer_id"])) {
    $custId = $_GET['customer_id'];
    $service = new CustomerService();
    $id = $service->UpdateStatus($custId);
    if ($id != 0) {
        alertRedirect(true, 'DisplayCustomer.php');
    } else {
        alertRedirect(false, 'DisplayCustomer.php');
    }
}
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
require './EmailContent.php';
require './SendingEmail.php';
$iniConfiguration = parse_ini_file("../../model-db-connection/configuration.ini");
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
$username = (string) filter_input(INPUT_GET, 'username');
$password = (string) filter_input(INPUT_GET, 'password');
$email = (string) filter_input(INPUT_GET, 'email');
$fName = (string) filter_input(INPUT_GET, 'fName');
$lName = (string) filter_input(INPUT_GET, 'lName');
$gender = (string) filter_input(INPUT_GET, 'gender');
$address = (string) filter_input(INPUT_GET, 'address');
$phone = (string) filter_input(INPUT_GET, 'phone');
$facebookAdr = (string) filter_input(INPUT_GET, 'facebookAdr');
$customerVO = new CustomerVO();
$customerVO->setCusID(md5(date("h:i:sa")));
$customerVO->setCusUsername($username);
$customerVO->setCusPassword(md5($password));
$customerVO->setCusEmail($email);
$customerVO->setCusFirstName($fName);
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
session_start();
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
require './EmailContent.php';
require './SendingEmail.php';
$iniConfiguration = parse_ini_file("../../model-db-connection/configuration.ini");
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
$emailOrUsernam = (string) filter_input(INPUT_POST, 'usernameOrEmail');
if ($customerService->getCustomerByEmail($emailOrUsernam) != 404) {
    $jsonObj = $customerService->getCustomerByEmail($emailOrUsernam);
    $obj = json_decode($jsonObj);
    $cusUsername = $obj->{'CUS_USERNAME'};
    $cusEmail = $obj->{'CUS_EMAIL'};
    $cusName = $obj->{'CUS_FIRST_NAME'} . " " . $obj->{'CUS_LAST_NAME'};
    //Start update password
    $updateResult = $customerService->resetPassword(md5($iniConfiguration['guest.password.default']), $obj->{'CUS_ID'});
    if ($updateResult == 200) {
        //Sending email to customer
        $emailContent = new EmailContent();
        $emailBody = $emailContent->getForgetPasswordTemplate($cusUsername, $cusEmail, $iniConfiguration['guest.password.default'], $iniConfiguration['web.application.prefix'], $cusName);
        $sendingEmail = new SendingEmail($iniConfiguration['email.host'], $iniConfiguration['email.username'], $iniConfiguration['email.password'], $cusEmail, $iniConfiguration['email.subject.customer.forget.password'], $emailBody, $iniConfiguration['email.username'], $iniConfiguration['email.name']);
        echo $sendingEmail->sendingEmail();
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
$cusID = (string) filter_input(INPUT_GET, 'cusID');
$username = (string) filter_input(INPUT_GET, 'username');
$password = (string) filter_input(INPUT_GET, 'password');
$email = (string) filter_input(INPUT_GET, 'email');
$fName = (string) filter_input(INPUT_GET, 'fName');
$lName = (string) filter_input(INPUT_GET, 'lName');
$gender = (string) filter_input(INPUT_GET, 'gender');
$address = (string) filter_input(INPUT_GET, 'address');
$phone = (string) filter_input(INPUT_GET, 'phone');
$facebookAdr = (string) filter_input(INPUT_GET, 'facebookAdr');
$customerVO = new CustomerVO();
$customerVO->setCusID($cusID);
$customerVO->setCusUsername($username);
$customerVO->setCusPassword(md5($password));
$customerVO->setCusEmail($email);
$customerVO->setCusFirstName($fName);
$customerVO->setCusLastName($lName);
$customerVO->setCusGender($gender);
             echo $saveEnrollRestul;
         }
     } else {
         echo mysql_error();
     }
 } else {
     //User not existing
     $tmpName = explode(" ", $rowGetMore['TMP_NAME']);
     $fName = $tmpName[0];
     $lName = $tmpName[1];
     $cusID = md5(date("h:i:sa") . "-" . $rowGetMore['TMP_EMAIL']);
     $email = $rowGetMore['TMP_EMAIL'];
     $phone = $rowGetMore['TMP_PHONE_NUMBER'];
     //promote unknown user to member
     $cusDaoImpl = new CustomerDaoImpl();
     $customerService = new CustomerService($cusDaoImpl);
     $customerVO = new CustomerVO();
     $customerVO->setCusID($cusID);
     $customerVO->setCusUsername($email);
     $customerVO->setCusPassword(md5($iniConfiguration['guest.password.default']));
     $customerVO->setCusEmail($email);
     $customerVO->setCusFirstName($fName);
     $customerVO->setCusLastName($lName);
     $customerVO->setCusGender("");
     $customerVO->setCusContactAddr($rowGetMore['CONTACT_ADDR']);
     $customerVO->setCusReceiptAddr($rowGetMore['RECEIPT_ADDR']);
     $customerVO->setPhoneNumber($phone);
     $customerVO->setCusFacebookAddr("");
     $customerVO->setForceChange("true");
     $saveUserResult = $customerService->saveCustomer($customerVO);
     if ($saveUserResult == 200) {
Beispiel #15
0
 public function edit()
 {
     $customerId = $this->input->post('customerId');
     if (empty($customerId)) {
         return;
     }
     $customerService = new CustomerService();
     $customerData = $customerService->fetchById($customerId);
     if (empty($customerData)) {
         return;
     }
     $this->renderAjaxView('edit', array('customer' => $customerData));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = CustomerService::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Beispiel #17
0
<?php

session_start();
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require '../../model-db-connection/config.php';
require '../../model/com.gogetrich.dao/CustomerDaoImpl.php';
require '../../model/com.gogetrich.service/CustomerService.php';
require '../../model/com.gogetrich.model/CustomerVO.php';
$configuration = (require '../../model-db-connection/GoGetRighconf.properties.php');
error_reporting(0);
$cusDaoImpl = new CustomerDaoImpl();
$customerService = new CustomerService($cusDaoImpl);
$username = (string) filter_input(INPUT_POST, 'username');
$password = (string) filter_input(INPUT_POST, 'password');
$reuslt = $customerService->verfiUsernameAndPassword($username, md5($password));
$resultLogin = explode("||", $reuslt);
if ($resultLogin[0] == 503) {
    //invalid username and password
    echo "503:";
} else {
    if ($resultLogin[0] == 205) {
        //Force change password
        echo "205:" . $resultLogin[1];
    } else {
        $jsonValue = $resultLogin[1];
        $obj = json_decode($jsonValue);
        $_SESSION['expireFrontEnd'] = time() + 60 * $configuration['applicationTimeOut'];