private void saveCategory() { try { Category category = new Category(); category.Name = txtName.Text; category.Url = txtUrl.Text; category.ImageUrl = txtImageUrl.Text; category.ParentCategoryID = int.Parse(cmbParent.SelectedValue); if (lblCategoryID.Value != string.Empty) { category.CategoryID = int.Parse(lblCategoryID.Value); } category.SortOrder = (int.Parse(txtSortOrder.Text)); category.PricePercent = double.Parse(txtPricePercent.Text); category.WebPricePercent = double.Parse(txtWebPricePercent.Text); category.ShowOnFirstPage = chkShowOnFirstPage.Checked; category.NumberOfProducts = (txtNumber.Text.Length > 0) ? int.Parse(txtNumber.Text) : 0; category.firstPageSortOrder = (txtSortOrderFirstPage.Text.Length > 0) ? int.Parse(txtSortOrderFirstPage.Text) : 0; category.firstPageOrderBy = cmbCriterion.SelectedItem.Text; category.Description = txtDescription.Text; category.Active = chkActive.Checked; category.Slider = new Slider(int.Parse(cmbSlider.SelectedValue), cmbSlider.SelectedItem.Text, DateTime.Now, DateTime.Now, true); category.CategoryBannerID = cmbCategoryBanner.SelectedIndex > -1 ? int.Parse(cmbCategoryBanner.SelectedValue) : -1; category.UpdateProductsFromExternalApplication = chkUpdateProductsFromExternalApplication.Checked; category.ExportProducts = chkExportProducts.Checked; CategoryBL categoryBl = new CategoryBL(); categoryBl.SaveCategory(category); } catch (BLException ex) { setStatus(ex.Message, System.Drawing.Color.Red, "danger"); } }
private void saveCategory() { try { Category category = new Category(); category.Name = txtName.Text; category.Url = txtUrl.Text; category.ImageUrl = txtImageUrl.Text; category.ParentCategoryID = int.Parse(cmbParent.SelectedValue); if (lblCategoryID.Value != string.Empty) { category.CategoryID = int.Parse(lblCategoryID.Value); } category.SortOrder = (int.Parse(txtSortOrder.Text)); category.PricePercent = double.Parse(txtPricePercent.Text); category.WebPricePercent = double.Parse(txtWebPricePercent.Text); category.ShowOnFirstPage = chkShowOnFirstPage.Checked; category.NumberOfProducts = (txtNumber.Text.Length > 0) ? int.Parse(txtNumber.Text) : 0; category.firstPageSortOrder = (txtSortOrderFirstPage.Text.Length > 0) ? int.Parse(txtSortOrderFirstPage.Text) : 0; category.firstPageOrderBy = cmbCriterion.SelectedItem.Text; category.Description = txtDescription.Text; category.Active = chkActive.Checked; category.Slider = new Slider(int.Parse(cmbSlider.SelectedValue), cmbSlider.SelectedItem.Text, DateTime.Now, DateTime.Now, true); category.CategoryBannerID = cmbCategoryBanner.SelectedIndex > -1 ? int.Parse(cmbCategoryBanner.SelectedValue) : -1; category.UpdateProductsFromExternalApplication = chkUpdateProductsFromExternalApplication.Checked; category.ExportProducts = chkExportProducts.Checked; category.ExternalID = int.Parse(txtExternalID.Text != string.Empty ? txtExternalID.Text : "0"); category.ExternalParentID = int.Parse(txtExternalParentID.Text != string.Empty ? txtExternalParentID.Text : "0"); category.ShowInFooter = chkShowInFooter.Checked; category.ImageUrlSource = rdbImageTypeStandard.Checked ? 0 : 1; int positionX = 0; int positionY = 0; category.ImageUrlPositionX = int.TryParse(txtPositionX.Text, out positionX) ? int.Parse(txtPositionX.Text) : 0; category.ImageUrlPositionY = int.TryParse(txtPositionY.Text, out positionY) ? int.Parse(txtPositionY.Text) : 0; category.Icon = txtIcon.Text; category.ShowProductsFromSubCategories = chkShowProductsFromSubCategories.Checked; category.PriceFixedAmount = txtPriceFixedAmount.Text.Length > 0 ? double.Parse(txtPriceFixedAmount.Text) : 0; CategoryBL categoryBl = new CategoryBL(); int categoryID = categoryBl.SaveCategory(category); lblCategoryID.Value = categoryID.ToString(); } catch (BLException ex) { setStatus(ex.Message, System.Drawing.Color.Red, "danger"); } }
public BaseResponse CreateCategory(Category objCategory) { BaseResponse response = new BaseResponse(); try { CategoryBL categroyBL = new CategoryBL(); response.ReturnValue = categroyBL.SaveCategory(objCategory); } catch (Exception ce) { response = new BaseResponse() { HasError = true, ReturnValue = ce.ToString() }; } return(response); }