示例#1
0
        public virtual int GetDefaultTaxCategoryId()
        {
            var taxDto         = CatalogTaxManager.GetTaxCategoryByName(DefaultTaxCategoryName);
            var taxCategoryRow = taxDto?.TaxCategory.FirstOrDefault();

            return(taxCategoryRow?.TaxCategoryId ?? 1);
        }
示例#2
0
        /// <summary>
        /// Checks if entered tax category name is unique.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="System.Web.UI.WebControls.ServerValidateEventArgs"/> instance containing the event data.</param>
        public void TaxCategoryNameCheck(object sender, ServerValidateEventArgs args)
        {
            // load tax category by name
            CatalogTaxDto dto = CatalogTaxManager.GetTaxCategoryByName(args.Value);

            // check if tax category with specified name is loaded
            if (dto != null && dto.TaxCategory.Count > 0 &&
                dto.TaxCategory[0].TaxCategoryId != TaxCategoryId)
            {
                args.IsValid = false;
                return;
            }

            args.IsValid = true;
        }