private List <ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(List <ProductManufacturer> ExistingProductManufacturerCollection) { var manufacturerCollection = ManufacturerManager.GetAllManufacturers(); List <ProductManufacturerMappingHelperClass> result = new List <ProductManufacturerMappingHelperClass>(); for (int i = 0; i < manufacturerCollection.Count; i++) { Manufacturer manufacturer = manufacturerCollection[i]; ProductManufacturer existingProductManufacturer = null; if (ExistingProductManufacturerCollection != null) { existingProductManufacturer = ExistingProductManufacturerCollection.FindProductManufacturer(this.ProductId, manufacturer.ManufacturerId); } ProductManufacturerMappingHelperClass pmm = new ProductManufacturerMappingHelperClass(); if (existingProductManufacturer != null) { pmm.ProductManufacturerId = existingProductManufacturer.ProductManufacturerId; pmm.IsMapped = true; pmm.IsFeatured = existingProductManufacturer.IsFeaturedProduct; pmm.DisplayOrder = existingProductManufacturer.DisplayOrder; } else { pmm.DisplayOrder = 1; } pmm.ManufacturerId = manufacturer.ManufacturerId; pmm.ManufacturerInfo = manufacturer.Name; MapState(manufacturer.ManufacturerId, pmm); result.Add(pmm); } return(result); }
private void UpdateState() { Dictionary <int, ProductManufacturerMappingHelperClass> state = this.GridState; foreach (GridViewRow row in gvManufacturerMappings.Rows) { CheckBox cbManufacturerInfo = row.FindControl("cbManufacturerInfo") as CheckBox; HiddenField hfManufacturerId = row.FindControl("hfManufacturerId") as HiddenField; HiddenField hfProductManufacturerId = row.FindControl("hfProductManufacturerId") as HiddenField; CheckBox cbFeatured = row.FindControl("cbFeatured") as CheckBox; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productManufacturerId = int.Parse(hfProductManufacturerId.Value); int manufacturerId = int.Parse(hfManufacturerId.Value); int displayOrder = txtRowDisplayOrder.Value; if (cbManufacturerInfo.Checked || (productManufacturerId > 0)) { state[manufacturerId] = new ProductManufacturerMappingHelperClass() { ManufacturerId = manufacturerId, ProductManufacturerId = productManufacturerId, IsMapped = cbManufacturerInfo.Checked, DisplayOrder = displayOrder, IsFeatured = cbFeatured.Checked }; } else if (state.ContainsKey(manufacturerId)) { state.Remove(manufacturerId); } } this.GridState = state; }
private List <ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(List <ProductManufacturer> ExistingProductManufacturerCollection) { List <ProductManufacturerMappingHelperClass> result = new List <ProductManufacturerMappingHelperClass>(); foreach (ProductManufacturer pm in ExistingProductManufacturerCollection) { Product product = pm.Product; if (product != null) { ProductManufacturerMappingHelperClass pmmhc = new ProductManufacturerMappingHelperClass(); pmmhc.ProductManufacturerId = pm.ProductManufacturerId; pmmhc.ProductId = pm.ProductId; pmmhc.ProductInfo = product.Name; if (SettingManager.GetSettingValueBoolean("Display.ShowAdminProductImages")) { pmmhc.ProductImage = GetProductImageUrl(product); } pmmhc.IsMapped = true; pmmhc.IsFeatured = pm.IsFeaturedProduct; pmmhc.DisplayOrder = pm.DisplayOrder; result.Add(pmmhc); } } return(result); }
private void MapState(int Id, ProductManufacturerMappingHelperClass rp) { if (this.GridState.ContainsKey(Id)) { ProductManufacturerMappingHelperClass srp = this.GridState[Id]; rp.IsMapped = srp.IsMapped; rp.DisplayOrder = srp.DisplayOrder; rp.IsFeatured = srp.IsFeatured; } }
private List <ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(ProductManufacturerCollection ExistingProductManufacturerCollection) { List <ProductManufacturerMappingHelperClass> result = new List <ProductManufacturerMappingHelperClass>(); foreach (ProductManufacturer pm in ExistingProductManufacturerCollection) { Product product = pm.Product; if (product != null) { ProductManufacturerMappingHelperClass pmmhc = new ProductManufacturerMappingHelperClass(); pmmhc.ProductManufacturerID = pm.ProductManufacturerID; pmmhc.ProductID = pm.ProductID; pmmhc.ProductInfo = product.Name; pmmhc.IsMapped = true; pmmhc.IsFeatured = pm.IsFeaturedProduct; pmmhc.DisplayOrder = pm.DisplayOrder; result.Add(pmmhc); } } return(result); }
private void UpdateState() { Dictionary<int, ProductManufacturerMappingHelperClass> state = this.GridState; foreach (GridViewRow row in gvManufacturerMappings.Rows) { CheckBox cbManufacturerInfo = row.FindControl("cbManufacturerInfo") as CheckBox; HiddenField hfManufacturerId = row.FindControl("hfManufacturerId") as HiddenField; HiddenField hfProductManufacturerId = row.FindControl("hfProductManufacturerId") as HiddenField; CheckBox cbFeatured = row.FindControl("cbFeatured") as CheckBox; NumericTextBox txtRowDisplayOrder = row.FindControl("txtDisplayOrder") as NumericTextBox; int productManufacturerId = int.Parse(hfProductManufacturerId.Value); int manufacturerId = int.Parse(hfManufacturerId.Value); int displayOrder = txtRowDisplayOrder.Value; if (cbManufacturerInfo.Checked || (productManufacturerId > 0)) { state[manufacturerId] = new ProductManufacturerMappingHelperClass() { ManufacturerId = manufacturerId, ProductManufacturerId = productManufacturerId, IsMapped = cbManufacturerInfo.Checked, DisplayOrder = displayOrder, IsFeatured = cbFeatured.Checked }; } else if (state.ContainsKey(manufacturerId)) { state.Remove(manufacturerId); } } this.GridState = state; }
private List<ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(List<ProductManufacturer> ExistingProductManufacturerCollection) { var manufacturerCollection = this.ManufacturerService.GetAllManufacturers(); List<ProductManufacturerMappingHelperClass> result = new List<ProductManufacturerMappingHelperClass>(); for (int i = 0; i < manufacturerCollection.Count; i++) { Manufacturer manufacturer = manufacturerCollection[i]; ProductManufacturer existingProductManufacturer = null; if (ExistingProductManufacturerCollection != null) existingProductManufacturer = ExistingProductManufacturerCollection.FindProductManufacturer(this.ProductId, manufacturer.ManufacturerId); ProductManufacturerMappingHelperClass pmm = new ProductManufacturerMappingHelperClass(); if (existingProductManufacturer != null) { pmm.ProductManufacturerId = existingProductManufacturer.ProductManufacturerId; pmm.IsMapped = true; pmm.IsFeatured = existingProductManufacturer.IsFeaturedProduct; pmm.DisplayOrder = existingProductManufacturer.DisplayOrder; } else { pmm.DisplayOrder = 1; } pmm.ManufacturerId = manufacturer.ManufacturerId; pmm.ManufacturerInfo = manufacturer.Name; MapState(manufacturer.ManufacturerId, pmm); result.Add(pmm); } return result; }
private List<ProductManufacturerMappingHelperClass> GetProductManufacturerMappings(List<ProductManufacturer> ExistingProductManufacturerCollection) { List<ProductManufacturerMappingHelperClass> result = new List<ProductManufacturerMappingHelperClass>(); foreach (ProductManufacturer pm in ExistingProductManufacturerCollection) { Product product = pm.Product; if (product != null) { ProductManufacturerMappingHelperClass pmmhc = new ProductManufacturerMappingHelperClass(); pmmhc.ProductManufacturerId = pm.ProductManufacturerId; pmmhc.ProductId = pm.ProductId; pmmhc.ProductInfo = product.Name; if (this.SettingManager.GetSettingValueBoolean("Display.ShowAdminProductImages")) { pmmhc.ProductImage = GetProductImageUrl(product); } pmmhc.IsMapped = true; pmmhc.IsFeatured = pm.IsFeaturedProduct; pmmhc.DisplayOrder = pm.DisplayOrder; result.Add(pmmhc); } } return result; }