当前位置: 首页>>代码示例>>PHP>>正文


PHP Manufacturer::GetDatabase方法代码示例

本文整理汇总了PHP中Manufacturer::GetDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP Manufacturer::GetDatabase方法的具体用法?PHP Manufacturer::GetDatabase怎么用?PHP Manufacturer::GetDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Manufacturer的用法示例。


在下文中一共展示了Manufacturer::GetDatabase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Save

 public function Save($blnForceInsert = false, $blnForceUpdate = false)
 {
     if (!$this->__blnRestored || $blnForceInsert) {
         $this->CreatedBy = QApplication::$objUserAccount->UserAccountId;
         $this->CreationDate = new QDateTime(QDateTime::Now);
         parent::Save($blnForceInsert, $blnForceUpdate);
         // If we have no errors then will add the data to the helper table
         $objDatabase = Manufacturer::GetDatabase();
         $strQuery = sprintf('INSERT INTO `manufacturer_custom_field_helper` (`manufacturer_id`) VALUES (%s);', $this->ManufacturerId);
         $objDatabase->NonQuery($strQuery);
     } else {
         $this->ModifiedBy = QApplication::$objUserAccount->UserAccountId;
         parent::Save($blnForceInsert, $blnForceUpdate);
     }
 }
开发者ID:brustj,项目名称:tracmor,代码行数:15,代码来源:Manufacturer.class.php

示例2: DeleteAllInventoryModels

    /**
     * Deletes all associated InventoryModels
     * @return void
     */
    public function DeleteAllInventoryModels()
    {
        if (is_null($this->intManufacturerId)) {
            throw new QUndefinedPrimaryKeyException('Unable to call UnassociateInventoryModel on this unsaved Manufacturer.');
        }
        // Get the Database Object for this Class
        $objDatabase = Manufacturer::GetDatabase();
        // Journaling
        if ($objDatabase->JournalingDatabase) {
            foreach (InventoryModel::LoadArrayByManufacturerId($this->intManufacturerId) as $objInventoryModel) {
                $objInventoryModel->Journal('DELETE');
            }
        }
        // Perform the SQL Query
        $objDatabase->NonQuery('
				DELETE FROM
					`inventory_model`
				WHERE
					`manufacturer_id` = ' . $objDatabase->SqlVariable($this->intManufacturerId) . '
			');
    }
开发者ID:proxymoron,项目名称:tracmor,代码行数:25,代码来源:ManufacturerGen.class.php

示例3: btnNext_Click


//.........这里部分代码省略.........
                 $objNewLocation->Save();
                 $this->objNewLocationArray[$objNewLocation->LocationId] = $objNewLocation->ShortDescription;
             }
             $this->objNewLocationArray = array();
             $this->objNewCategoryArray = array();
             $this->objNewManufacturerArray = array();
             $this->objNewAssetModelArray = array();
             $this->strModelValuesArray = array();
             $this->blnImportEnd = false;
             $j = 1;
             $strLocationValuesArray = array();
             // Add all unique locations in database
             foreach ($this->strFilePathArray as $strFilePath) {
                 $this->FileCsvData->load($strFilePath);
                 if ($j != 1) {
                     //$this->FileCsvData->appendRow($this->FileCsvData->getHeaders());
                 }
                 // Location Import
                 for ($i = 0; $i < $this->FileCsvData->countRows(); $i++) {
                     $strRowArray = $this->FileCsvData->getRow($i);
                     if (trim($strRowArray[$this->intLocationKey]) && !$this->in_array_nocase(trim($strRowArray[$this->intLocationKey]), $strLocationArray)) {
                         $strLocationArray[] = trim($strRowArray[$this->intLocationKey]);
                         /*$objNewLocation = new Location();
                           $objNewLocation->ShortDescription = addslashes(trim($strRowArray[$this->intLocationKey]));
                           $objNewLocation->Save();*/
                         $strLocationValuesArray[] = sprintf("('%s', '%s', NOW())", addslashes(trim($strRowArray[$this->intLocationKey])), $_SESSION['intUserAccountId']);
                         $strNewLocation[] = addslashes(trim($strRowArray[$this->intLocationKey]));
                         //$this->objNewLocationArray[$objNewLocation->LocationId] = $objNewLocation->ShortDescription;
                     }
                 }
                 $j++;
             }
             if (count($strLocationValuesArray)) {
                 $objDatabase = Location::GetDatabase();
                 $objDatabase->NonQuery(sprintf("INSERT INTO `location` (`short_description`, `created_by`, `creation_date`) VALUES %s;", implode(", ", $strLocationValuesArray)));
                 $intStartId = $objDatabase->InsertId();
                 for ($i = 0; $i < count($strNewLocation); $i++) {
                     $this->objNewLocationArray[$intStartId + $i] = $strNewLocation[$i];
                 }
             }
             $this->btnNext->RemoveAllActions('onclick');
             // Add new ajax actions for button
             $this->btnNext->AddAction(new QClickEvent(), new QAjaxAction('btnNext_Click'));
             $this->btnNext->AddAction(new QClickEvent(), new QToggleEnableAction($this->btnNext));
             $this->btnNext->AddAction(new QEnterKeyEvent(), new QAjaxAction('btnNext_Click'));
             $this->btnNext->AddAction(new QEnterKeyEvent(), new QToggleEnableAction($this->btnNext));
             $this->btnNext->AddAction(new QEnterKeyEvent(), new QTerminateAction());
             $this->btnNext->Warning = "Locations have been imported. Please wait...";
             $this->intImportStep = 2;
             $this->intCurrentFile = 0;
             $this->strSelectedValueArray = array();
             // New locations
             $this->dtgLocation = new QDataGrid($this);
             $this->dtgLocation->Name = 'location_list';
             $this->dtgLocation->CellPadding = 5;
             $this->dtgLocation->CellSpacing = 0;
             $this->dtgLocation->CssClass = "datagrid";
             $this->dtgLocation->UseAjax = true;
             $this->dtgLocation->ShowColumnToggle = false;
             $this->dtgLocation->ShowExportCsv = false;
             $this->dtgLocation->ShowHeader = false;
             $this->dtgLocation->AddColumn(new QDataGridColumnExt('Location', '<?= $_ITEM ?>', 'CssClass="dtg_column"', 'HtmlEntities="false"'));
             // New categories
             $this->dtgCategory = new QDataGrid($this);
             $this->dtgCategory->Name = 'category_list';
             $this->dtgCategory->CellPadding = 5;
开发者ID:proxymoron,项目名称:tracmor,代码行数:67,代码来源:asset_import.php

示例4: UndoImport

 protected function UndoImport()
 {
     $objDatabase = Manufacturer::GetDatabase();
     if (isset($this->arrOldItemArray)) {
         foreach ($this->arrOldItemArray as $intItemId => $objOldItem) {
             $strQuery = sprintf("UPDATE `manufacturer` SET `short_description`='%s', `long_description`='%s' WHERE `manufacturer_id`='%s'", $objOldItem->ShortDescription, $objOldItem->LongDescription, $objOldItem->ManufacturerId);
             $objDatabase->NonQuery($strQuery);
             $strCFVArray = array();
             foreach ($this->arrItemCustomField as $objCustomField) {
                 $strCFV = $objOldItem->GetVirtualAttribute($objCustomField->CustomFieldId);
                 $strCFVArray[] = sprintf("`cfv_%s`='%s'", $objCustomField->CustomFieldId, $strCFV);
             }
             if (isset($strCFVArray) && count($strCFVArray)) {
                 $strQuery = sprintf("UPDATE `manufacturer_custom_field_helper` SET %s WHERE `manufacturer_id`='%s'", implode(", ", $strCFVArray), $intItemId);
                 $objDatabase->NonQuery($strQuery);
             }
         }
     }
     if (count($this->objNewManufacturerArray)) {
         $strQuery = sprintf("DELETE FROM `manufacturer` WHERE `manufacturer_id` IN (%s)", implode(", ", array_keys($this->objNewManufacturerArray)));
         $objDatabase->NonQuery($strQuery);
     }
     //$strQuery = "SET FOREIGN_KEY_CHECKS=1;";
     //$objDatabase->NonQuery($strQuery);
 }
开发者ID:proxymoron,项目名称:tracmor,代码行数:25,代码来源:manufacturer_import.php


注:本文中的Manufacturer::GetDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。