예제 #1
0
        private void DeleteCategory()
        {
            try
            {
                int result = CategoryHelper.DeleteCategory(ecPanelRequest.CategoryId);

                if (result < 0)
                {
                    ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage(MessagesKeys.DELETE_CATEGORY, ex);
                return;
            }

            RedirectToBrowsePage();
        }
예제 #2
0
        private void SaveCategory()
        {
            string categoryName     = txtCategoryName.Text.Trim();
            string categorySku      = txtCategorySku.Text.Trim();
            string shortDescription = txtShortDescription.Text.Trim();
            string fullDescription  = txtFullDescription.Text.Trim();
            int    parentId         = -1;

            // assign parent category if selected
            if (ddlCategories.SelectedIndex > 0)
            {
                parentId = Utils.ParseInt(ddlCategories.SelectedValue, 0);
            }

            try
            {
                int result = CategoryHelper.UpdateCategory(
                    category.CategoryId,
                    categoryName,
                    categorySku,
                    parentId,
                    shortDescription,
                    fullDescription
                    );

                if (result < 0)
                {
                    ShowResultMessage(result);
                    return;
                }

                RedirectToBrowsePage();
            }
            catch (Exception ex)
            {
                ShowErrorMessage(MessagesKeys.EDIT_CATEGORY, ex.Message);
            }
        }