예제 #1
0
        public void SaveInfo()
        {
            Manufacturer manufacturer = ManufacturerManager.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)
                    {
                        ManufacturerManager.DeleteProductManufacturer(productManufacturerID);
                    }
                    if (productManufacturerID > 0 && cbProductInfo.Checked)
                    {
                        ManufacturerManager.UpdateProductManufacturer(productManufacturerID, productID, manufacturer.ManufacturerID, featured, displayOrder);
                    }
                }
            }
        }
예제 #2
0
        public void SaveInfo(int prodId)
        {
            Product product = ProductManager.GetProductById(prodId);

            if (product != null)
            {
                foreach (var item in this.GridState.Values)
                {
                    if (item.ProductManufacturerId > 0 && !item.IsMapped)
                    {
                        ManufacturerManager.DeleteProductManufacturer(item.ProductManufacturerId);
                    }
                    if (item.ProductManufacturerId > 0 && item.IsMapped)
                    {
                        ManufacturerManager.UpdateProductManufacturer(item.ProductManufacturerId, product.ProductId, item.ManufacturerId, item.IsFeatured, item.DisplayOrder);
                    }
                    if (item.ProductManufacturerId == 0 && item.IsMapped)
                    {
                        ManufacturerManager.InsertProductManufacturer(product.ProductId, item.ManufacturerId, item.IsFeatured, item.DisplayOrder);
                    }
                }
            }
        }