protected function btnQuickAdd_Click($strFormId, $strControlId, $strParameter) { $blnError = false; $this->btnQuickAdd->Warning = ''; if (strlen(trim($this->txtQuickAdd->Text)) == 0) { $blnError = true; $this->btnQuickAdd->Warning = 'You must enter a Category name'; } // Check for dupes $objCategoryDuplicate = Category::QuerySingle(QQ::Equal(QQN::Category()->ShortDescription, $this->txtQuickAdd->Text)); if ($objCategoryDuplicate) { $blnError = true; $this->btnQuickAdd->Warning = 'This Category Name is already in use. Please try another.'; } if (!$blnError) { $objCategory = new Category(); $objCategory->ShortDescription = $this->txtQuickAdd->Text; $objCategory->AssetFlag = '1'; $objCategory->InventoryFlag = '1'; $objCategory->CreatedBy = QApplication::$objUserAccount->UserAccountId; $objCategory->CreationDate = QDateTime::Now(); $objCategory->Save(); $this->dtgCategory->Refresh(); $this->txtQuickAdd->Text = ''; } $this->txtQuickAdd->Focus(); $this->txtQuickAdd->Select(); }
/** * Load a single Category object, * by CategoryId Index(es) * @param integer $intCategoryId * @return Category */ public static function LoadByCategoryId($intCategoryId, $objOptionalClauses = null) { return Category::QuerySingle(QQ::Equal(QQN::Category()->CategoryId, $intCategoryId), $objOptionalClauses); }
/** * Load a single Category object, * by CategoryId Index(es) * @param integer $intCategoryId * @return Category */ public static function LoadByCategoryId($intCategoryId) { return Category::QuerySingle(QQ::Equal(QQN::Category()->CategoryId, $intCategoryId)); }