protected void btnSave_Click(object sender, EventArgs e) { var category = this.CategoryService.GetCategoryById(this.CategoryId); if (category != null) { var existingProductCategories = category.ProductCategories; foreach (GridViewRow row in gvProducts.Rows) { try { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductId = row.FindControl("hfProductId") as HiddenField; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productId = int.Parse(hfProductId.Value); int displayOrder = txtRowDisplayOrder.Value; if (cbProductInfo.Checked) { if (existingProductCategories.FindProductCategory(productId, this.CategoryId) == null) { var productCategory = new ProductCategory() { ProductId = productId, CategoryId = this.CategoryId, IsFeaturedProduct = false, DisplayOrder = displayOrder }; this.CategoryService.InsertProductCategory(productCategory); } } } catch (Exception exc) { ProcessException(exc); } } } this.Page.ClientScript.RegisterStartupScript(typeof(CategoryProductAddControl), "closerefresh", "<script language=javascript>try {window.opener.document.forms[0]." + this.BtnId + ".click();}catch (e){} window.close();</script>"); }
protected void btnSave_Click(object sender, EventArgs e) { Product product = this.ProductService.GetProductById(this.ProductId); if (product != null) { var existingRelatedProducts = product.RelatedProducts; foreach (GridViewRow row in gvProducts.Rows) { try { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductId = row.FindControl("hfProductId") as HiddenField; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productId = int.Parse(hfProductId.Value); int displayOrder = txtRowDisplayOrder.Value; if (cbProductInfo.Checked) { if (existingRelatedProducts.FindRelatedProduct(this.ProductId, productId) == null) { this.ProductService.InsertRelatedProduct( new RelatedProduct() { ProductId1 = this.ProductId, ProductId2 = productId, DisplayOrder = displayOrder }); } } } catch (Exception exc) { ProcessException(exc); } } } this.Page.ClientScript.RegisterStartupScript(typeof(RelatedProductAddControl), "closerefresh", "<script language=javascript>try {window.opener.document.forms[0]." + this.BtnId + ".click();}catch (e){} window.close();</script>"); }
protected void gvwImages_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateProductPicture") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvwImages.Rows[index]; NumericTextBox txtProductPictureDisplayOrder = row.FindControl("txtProductPictureDisplayOrder") as NumericTextBox; HiddenField hfProductPictureID = row.FindControl("hfProductPictureID") as HiddenField; int displayOrder = txtProductPictureDisplayOrder.Value; int productPictureID = int.Parse(hfProductPictureID.Value); ProductPicture productPicture = ProductManager.GetProductPictureByID(productPictureID); if (productPicture != null) { ProductManager.UpdateProductPicture(productPicture.ProductPictureID, productPicture.ProductID, productPicture.PictureID, displayOrder); } BindData(); } }
protected void gvVideos_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateProductVideo") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvVideos.Rows[index]; NumericTextBox txtProductVideoDisplayOrder = row.FindControl("txtProductVideoDisplayOrder") as NumericTextBox; HiddenField hfProductVideoId = row.FindControl("hdVideoId") as HiddenField; int displayOrder = txtProductVideoDisplayOrder.Value; int productVideoId = int.Parse(hfProductVideoId.Value); VideoBiz videoBiz = new VideoBiz(); lwg_Video video = videoBiz.GetVideoById(productVideoId); if (video != null) { video.DisplayOrder = displayOrder; videoBiz.UpdateCatalogVideo(video); } BindData(); } }
protected void gvwImages_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateProductPicture") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvwImages.Rows[index]; NumericTextBox txtProductPictureDisplayOrder = row.FindControl("txtProductPictureDisplayOrder") as NumericTextBox; HiddenField hfProductPictureId = row.FindControl("hfProductPictureId") as HiddenField; int displayOrder = txtProductPictureDisplayOrder.Value; int productPictureId = int.Parse(hfProductPictureId.Value); ProductPicture productPicture = this.ProductService.GetProductPictureById(productPictureId); if (productPicture != null) { productPicture.DisplayOrder = displayOrder; this.ProductService.UpdateProductPicture(productPicture); } BindData(); } }
public void SaveInfo() { var category = this.CategoryService.GetCategoryById(this.CategoryId); if (category != null) { foreach (GridViewRow row in gvProductCategoryMappings.Rows) { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductId = row.FindControl("hfProductId") as HiddenField; HiddenField hfProductCategoryId = row.FindControl("hfProductCategoryId") as HiddenField; CheckBox cbFeatured = row.FindControl("cbFeatured") as CheckBox; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productId = int.Parse(hfProductId.Value); int productCategoryId = int.Parse(hfProductCategoryId.Value); bool featured = cbFeatured.Checked; int displayOrder = txtRowDisplayOrder.Value; if (productCategoryId > 0 && !cbProductInfo.Checked) { this.CategoryService.DeleteProductCategory(productCategoryId); } if (productCategoryId > 0 && cbProductInfo.Checked) { var productCategory = this.CategoryService.GetProductCategoryById(productCategoryId); if (productCategory != null) { productCategory.ProductId = productId; productCategory.CategoryId = category.CategoryId; productCategory.IsFeaturedProduct = featured; productCategory.DisplayOrder = displayOrder; this.CategoryService.UpdateProductCategory(productCategory); } } } } }
public void SaveInfo() { Manufacturer manufacturer = this.ManufacturerService.GetManufacturerById(this.ManufacturerId); if (manufacturer != null) { foreach (GridViewRow row in gvProductManufacturerMappings.Rows) { CheckBox cbProductInfo = row.FindControl("cbProductInfo") as CheckBox; HiddenField hfProductId = row.FindControl("hfProductId") as HiddenField; HiddenField hfProductManufacturerId = row.FindControl("hfProductManufacturerId") as HiddenField; CheckBox cbFeatured = row.FindControl("cbFeatured") as CheckBox; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productId = int.Parse(hfProductId.Value); int productManufacturerId = int.Parse(hfProductManufacturerId.Value); bool featured = cbFeatured.Checked; int displayOrder = txtRowDisplayOrder.Value; if (productManufacturerId > 0 && !cbProductInfo.Checked) { this.ManufacturerService.DeleteProductManufacturer(productManufacturerId); } if (productManufacturerId > 0 && cbProductInfo.Checked) { var pm = this.ManufacturerService.GetProductManufacturerById(productManufacturerId); if (pm != null) { pm.ProductId = productId; pm.ManufacturerId = manufacturer.ManufacturerId; pm.IsFeaturedProduct = featured; pm.DisplayOrder = displayOrder; this.ManufacturerService.UpdateProductManufacturer(pm); } } } } }
protected void gvProductVariantAttributes_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateProductVariantAttribute") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvProductVariantAttributes.Rows[index]; HiddenField hfProductVariantAttributeId = row.FindControl("hfProductVariantAttributeId") as HiddenField; DropDownList ddlProductAttribute = row.FindControl("ddlProductAttribute") as DropDownList; TextBox txtTextPrompt = row.FindControl("txtTextPrompt") as TextBox; CheckBox cbIsRequired = row.FindControl("cbIsRequired") as CheckBox; DropDownList ddlAttributeControlType = row.FindControl("ddlAttributeControlType") as DropDownList; NumericTextBox txtDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productVariantAttributeId = int.Parse(hfProductVariantAttributeId.Value); int productAttributeId = int.Parse(ddlProductAttribute.SelectedItem.Value); string textPrompt = txtTextPrompt.Text; bool isRequired = cbIsRequired.Checked; AttributeControlTypeEnum attributeControlType = (AttributeControlTypeEnum)Enum.ToObject(typeof(AttributeControlTypeEnum), int.Parse(ddlAttributeControlType.SelectedItem.Value)); int displayOrder = txtDisplayOrder.Value; ProductVariantAttribute productVariantAttribute = this.ProductAttributeService.GetProductVariantAttributeById(productVariantAttributeId); if (productVariantAttribute != null) { productVariantAttribute.ProductAttributeId = productAttributeId; productVariantAttribute.TextPrompt = textPrompt; productVariantAttribute.IsRequired = isRequired; productVariantAttribute.AttributeControlTypeId = (int)attributeControlType; productVariantAttribute.DisplayOrder = displayOrder; this.ProductAttributeService.UpdateProductVariantAttribute(productVariantAttribute); } BindAttributes(); BindCombinations(); RefreshSelectCombinationControl(); } }
protected void gvPollAnswers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdatePollAnswer") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvPollAnswers.Rows[index]; HiddenField hfPollAnswerId = row.FindControl("hfPollAnswerId") as HiddenField; SimpleTextBox txtName = row.FindControl("txtName") as SimpleTextBox; NumericTextBox txtDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int pollAnswerId = int.Parse(hfPollAnswerId.Value); PollAnswer pollAnswer = PollManager.GetPollAnswerById(pollAnswerId); if (pollAnswer != null) { pollAnswer = PollManager.UpdatePollAnswer(pollAnswer.PollAnswerId, pollAnswer.PollId, txtName.Text, pollAnswer.Count, txtDisplayOrder.Value); } BindData(); } }
protected void gvValues_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateCheckoutAttributeValue") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = gvValues.Rows[index]; HiddenField hfCheckoutAttributeValueId = row.FindControl("hfCheckoutAttributeValueId") as HiddenField; SimpleTextBox txtName = row.FindControl("txtName") as SimpleTextBox; DecimalTextBox txtPriceAdjustment = row.FindControl("txtPriceAdjustment") as DecimalTextBox; DecimalTextBox txtWeightAdjustment = row.FindControl("txtWeightAdjustment") as DecimalTextBox; CheckBox cbIsPreSelected = row.FindControl("cbIsPreSelected") as CheckBox; NumericTextBox txtDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int cavId = int.Parse(hfCheckoutAttributeValueId.Value); string name = txtName.Text; decimal priceAdjustment = txtPriceAdjustment.Value; decimal weightAdjustment = txtWeightAdjustment.Value; bool isPreSelected = cbIsPreSelected.Checked; int displayOrder = txtDisplayOrder.Value; var cav = this.CheckoutAttributeService.GetCheckoutAttributeValueById(cavId); if (cav != null) { cav.Name = name; cav.PriceAdjustment = priceAdjustment; cav.WeightAdjustment = weightAdjustment; cav.IsPreSelected = isPreSelected; cav.DisplayOrder = displayOrder; this.CheckoutAttributeService.UpdateCheckoutAttributeValue(cav); SaveLocalizableContentGrid(cav); } BindData(); } }
protected void OnSpecificationAttributeOptionsCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "UpdateOption") { int index = Convert.ToInt32(e.CommandArgument); GridViewRow row = grdSpecificationAttributeOptions.Rows[index]; SimpleTextBox txtName = row.FindControl("txtOptionName") as SimpleTextBox; NumericTextBox txtDisplayOrder = row.FindControl("txtOptionDisplayOrder") as NumericTextBox; HiddenField hfSpecificationAttributeOptionID = row.FindControl("hfSpecificationAttributeOptionID") as HiddenField; string name = txtName.Text; int displayOrder = txtDisplayOrder.Value; int saoID = int.Parse(hfSpecificationAttributeOptionID.Value); SpecificationAttributeOption sao = SpecificationAttributeManager.GetSpecificationAttributeOptionByID(saoID); if (sao != null) { SpecificationAttributeManager.UpdateSpecificationAttributeOptions(saoID, SpecificationAttributeID, name, displayOrder); ColorManager.UpdateColor(sao.Name, name); } BindData(); } }