private List <ProductCategoryMappingHelperClass> GetProductCategoryMappings(List <ProductCategory> existingProductCategoryCollection)
        {
            List <ProductCategoryMappingHelperClass> result = new List <ProductCategoryMappingHelperClass>();

            foreach (ProductCategory pc in existingProductCategoryCollection)
            {
                Product product = pc.Product;
                if (product != null)
                {
                    ProductCategoryMappingHelperClass pcmhc = new ProductCategoryMappingHelperClass();
                    pcmhc.ProductCategoryId = pc.ProductCategoryId;
                    pcmhc.ProductId         = pc.ProductId;
                    if (this.SettingManager.GetSettingValueBoolean("Display.ShowAdminProductImages"))
                    {
                        pcmhc.ProductImage = GetProductImageUrl(product);
                    }
                    pcmhc.ProductInfo  = product.Name;
                    pcmhc.IsMapped     = true;
                    pcmhc.IsFeatured   = pc.IsFeaturedProduct;
                    pcmhc.DisplayOrder = pc.DisplayOrder;
                    result.Add(pcmhc);
                }
            }

            return(result);
        }
Example #2
0
        private List <ProductCategoryMappingHelperClass> GetProductCategoryMappings(int ForParentCategoryID,
                                                                                    string prefix, ProductCategoryCollection ExistingProductCategoryCollection)
        {
            CategoryCollection categoryCollection           = CategoryManager.GetAllCategories(ForParentCategoryID);
            List <ProductCategoryMappingHelperClass> result = new List <ProductCategoryMappingHelperClass>();

            for (int i = 0; i < categoryCollection.Count; i++)
            {
                Category        category = categoryCollection[i];
                ProductCategory existingProductCategory = ExistingProductCategoryCollection.FindProductCategory(this.ProductID, category.CategoryID);
                ProductCategoryMappingHelperClass pcm   = new ProductCategoryMappingHelperClass();
                if (existingProductCategory != null)
                {
                    pcm.ProductCategoryID = existingProductCategory.ProductCategoryID;
                    pcm.IsMapped          = true;
                    pcm.IsFeatured        = existingProductCategory.IsFeaturedProduct;
                    pcm.DisplayOrder      = existingProductCategory.DisplayOrder;
                }
                else
                {
                    pcm.DisplayOrder = 1;
                }
                pcm.CategoryID   = category.CategoryID;
                pcm.CategoryInfo = prefix + category.Name;
                //if (pcm.CategoryID == this.CategoryID)
                //    pcm.IsMapped = true;
                result.Add(pcm);
                if (CategoryManager.GetAllCategories(category.CategoryID).Count > 0)
                {
                    result.AddRange(GetProductCategoryMappings(category.CategoryID, prefix + "--", ExistingProductCategoryCollection));
                }
            }

            return(result);
        }
Example #3
0
        private void UpdateState()
        {
            Dictionary <int, ProductCategoryMappingHelperClass> state = this.GridState;

            foreach (GridViewRow row in gvCategoryMappings.Rows)
            {
                CheckBox       cbCategoryInfo      = row.FindControl("cbCategoryInfo") as CheckBox;
                HiddenField    hfCategoryId        = row.FindControl("hfCategoryId") as HiddenField;
                HiddenField    hfProductCategoryId = row.FindControl("hfProductCategoryId") as HiddenField;
                CheckBox       cbFeatured          = row.FindControl("cbFeatured") as CheckBox;
                NumericTextBox txtRowDisplayOrder  = row.FindControl("txtDisplayOrder") as NumericTextBox;
                int            productCategoryId   = int.Parse(hfProductCategoryId.Value);
                int            categoryId          = int.Parse(hfCategoryId.Value);
                int            displayOrder        = txtRowDisplayOrder.Value;

                if (cbCategoryInfo.Checked || (productCategoryId > 0))
                {
                    state[categoryId] = new ProductCategoryMappingHelperClass()
                    {
                        CategoryId        = categoryId,
                        ProductCategoryId = productCategoryId,
                        IsMapped          = cbCategoryInfo.Checked,
                        DisplayOrder      = displayOrder,
                        IsFeatured        = cbFeatured.Checked
                    };
                }
                else if (state.ContainsKey(categoryId))
                {
                    state.Remove(categoryId);
                }
            }
            this.GridState = state;
        }
Example #4
0
        private List <ProductCategoryMappingHelperClass> GetProductCategoryMappings(List <ProductCategory> existingProductCategoryCollection)
        {
            var categories = CategoryManager.GetAllCategories();
            List <ProductCategoryMappingHelperClass> result = new List <ProductCategoryMappingHelperClass>();

            for (int i = 0; i < categories.Count; i++)
            {
                Category        category = categories[i];
                ProductCategory existingProductCategory = null;
                if (existingProductCategoryCollection != null)
                {
                    existingProductCategory = existingProductCategoryCollection.FindProductCategory(this.ProductId, category.CategoryId);
                }
                ProductCategoryMappingHelperClass pcm = new ProductCategoryMappingHelperClass();
                if (existingProductCategory != null)
                {
                    pcm.ProductCategoryId = existingProductCategory.ProductCategoryId;
                    pcm.IsMapped          = true;
                    pcm.IsFeatured        = existingProductCategory.IsFeaturedProduct;
                    pcm.DisplayOrder      = existingProductCategory.DisplayOrder;
                }
                else
                {
                    pcm.DisplayOrder = 1;
                }
                pcm.CategoryId   = category.CategoryId;
                pcm.CategoryInfo = GetCategoryFullName(category);

                MapState(category.CategoryId, pcm);

                result.Add(pcm);
            }

            return(result);
        }
Example #5
0
 private void MapState(int Id, ProductCategoryMappingHelperClass rp)
 {
     if (this.GridState.ContainsKey(Id))
     {
         ProductCategoryMappingHelperClass srp = this.GridState[Id];
         rp.IsMapped     = srp.IsMapped;
         rp.DisplayOrder = srp.DisplayOrder;
         rp.IsFeatured   = srp.IsFeatured;
     }
 }
        private List <ProductCategoryMappingHelperClass> GetProductCategoryMappings(ProductCategoryCollection ExistingProductCategoryCollection)
        {
            List <ProductCategoryMappingHelperClass> result = new List <ProductCategoryMappingHelperClass>();

            foreach (ProductCategory pc in ExistingProductCategoryCollection)
            {
                Product product = pc.Product;
                if (product != null)
                {
                    ProductCategoryMappingHelperClass pcmhc = new ProductCategoryMappingHelperClass();
                    pcmhc.ProductCategoryID = pc.ProductCategoryID;
                    pcmhc.ProductID         = pc.ProductID;
                    pcmhc.ProductInfo       = product.Name;
                    pcmhc.IsMapped          = true;
                    pcmhc.IsFeatured        = pc.IsFeaturedProduct;
                    pcmhc.DisplayOrder      = pc.DisplayOrder;
                    result.Add(pcmhc);
                }
            }

            return(result);
        }
Example #7
0
        private List<ProductCategoryMappingHelperClass> GetProductCategoryMappings(List<ProductCategory> existingProductCategoryCollection)
        {
            List<ProductCategoryMappingHelperClass> result = new List<ProductCategoryMappingHelperClass>();
            foreach (ProductCategory pc in existingProductCategoryCollection)
            {
                Product product = pc.Product;
                if (product != null)
                {
                    ProductCategoryMappingHelperClass pcmhc = new ProductCategoryMappingHelperClass();
                    pcmhc.ProductCategoryId = pc.ProductCategoryId;
                    pcmhc.ProductId = pc.ProductId;
                    if (SettingManager.GetSettingValueBoolean("Display.ShowAdminProductImages"))
                    {
                        pcmhc.ProductImage = GetProductImageUrl(product);
                    }
                    pcmhc.ProductInfo = product.Name;
                    pcmhc.IsMapped = true;
                    pcmhc.IsFeatured = pc.IsFeaturedProduct;
                    pcmhc.DisplayOrder = pc.DisplayOrder;
                    result.Add(pcmhc);
                }
            }

            return result;
        }
        private void UpdateState()
        {
            Dictionary<int, ProductCategoryMappingHelperClass> state = this.GridState;
            foreach (GridViewRow row in gvCategoryMappings.Rows)
            {
                CheckBox cbCategoryInfo = row.FindControl("cbCategoryInfo") as CheckBox;
                HiddenField hfCategoryId = row.FindControl("hfCategoryId") as HiddenField;
                HiddenField hfProductCategoryId = row.FindControl("hfProductCategoryId") as HiddenField;
                HiddenField hfCategoryDisplayOrder = row.FindControl("hfCategoryDisplayOrder") as HiddenField;
                HiddenField hfCategoryIsFeatured = row.FindControl("hfCategoryIsFeatured") as HiddenField;
                int productCategoryId = int.Parse(hfProductCategoryId.Value);
                int categoryId = int.Parse(hfCategoryId.Value);
                int displayOrder = int.Parse(hfCategoryDisplayOrder.Value);
                bool isFeatured = bool.Parse(hfCategoryIsFeatured.Value);

                if (cbCategoryInfo.Checked || (productCategoryId > 0))
                {
                    state[categoryId] = new ProductCategoryMappingHelperClass()
                    {
                        CategoryId = categoryId,
                        ProductCategoryId = productCategoryId,
                        IsMapped = cbCategoryInfo.Checked,
                        DisplayOrder = displayOrder,
                        IsFeatured = isFeatured
                    };
                }
                else if (state.ContainsKey(categoryId))
                {
                    state.Remove(categoryId);
                }
            }
            this.GridState = state;
        }
 private void MapState(int Id, ProductCategoryMappingHelperClass rp)
 {
     if (this.GridState.ContainsKey(Id))
     {
         ProductCategoryMappingHelperClass srp = this.GridState[Id];
         rp.IsMapped = srp.IsMapped;
         rp.DisplayOrder = srp.DisplayOrder;
         rp.IsFeatured = srp.IsFeatured;
     }
 }
        private List<ProductCategoryMappingHelperClass> GetProductCategoryMappings(List<ProductCategory> existingProductCategoryCollection)
        {
            var categories = this.CategoryService.GetAllCategories();
            List<ProductCategoryMappingHelperClass> result = new List<ProductCategoryMappingHelperClass>();
            for (int i = 0; i < categories.Count; i++)
            {
                Category category = categories[i];
                ProductCategory existingProductCategory = null;
                if (existingProductCategoryCollection != null)
                    existingProductCategory = existingProductCategoryCollection.FindProductCategory(this.ProductId, category.CategoryId);
                ProductCategoryMappingHelperClass pcm = new ProductCategoryMappingHelperClass();
                if (existingProductCategory != null)
                {
                    pcm.ProductCategoryId = existingProductCategory.ProductCategoryId;
                    pcm.IsMapped = true;
                    pcm.IsFeatured = existingProductCategory.IsFeaturedProduct;
                    pcm.DisplayOrder = existingProductCategory.DisplayOrder;
                }
                else
                {
                    pcm.DisplayOrder = 1;
                }
                pcm.CategoryId = category.CategoryId;
                pcm.CategoryInfo = GetCategoryFullName(category);

                MapState(category.CategoryId, pcm);

                result.Add(pcm);
            }

            return result;
        }
        //private List<ProductCategoryMappingHelperClass> GetProductCategoryMappings(List<ProductCategory> existingProductCategoryCollection)
        //{
        //    var categories = this.CategoryService.GetAllCategories();
        //    this.CategoryService.GetAllCategoriesByParentCategoryId(0);
        //    List<ProductCategoryMappingHelperClass> result = new List<ProductCategoryMappingHelperClass>();
        //    for (int i = 0; i < categories.Count; i++)
        //    {
        //        Category category = categories[i];
        //        ProductCategory existingProductCategory = null;
        //        if (existingProductCategoryCollection != null)
        //            existingProductCategory = existingProductCategoryCollection.FindProductCategory(this.ProductId, category.CategoryId);
        //        ProductCategoryMappingHelperClass pcm = new ProductCategoryMappingHelperClass();
        //        if (existingProductCategory != null)
        //        {
        //            pcm.ProductCategoryId = existingProductCategory.ProductCategoryId;
        //            pcm.IsMapped = true;
        //            pcm.IsFeatured = existingProductCategory.IsFeaturedProduct;
        //            pcm.DisplayOrder = existingProductCategory.DisplayOrder;
        //        }
        //        else
        //        {
        //            pcm.DisplayOrder = 1;
        //        }
        //        pcm.CategoryId = category.CategoryId;
        //        pcm.CategoryInfo = GetCategoryFullName(category);
        //        result.Add(pcm);
        //    }
        //    return result;
        //}
        private List<ProductCategoryMappingHelperClass> GetProductCategoryMappings(List<ProductCategory> existingProductCategoryCollection, string categoryTypeName)
        {
            List<Category> categories = null;

            switch (categoryTypeName) {

                case "Mens":
                        categories = this.CategoryService.GetAllCategoriesByParentCategoryId(55);
                        break;
                case "Womens":
                        categories = this.CategoryService.GetAllCategoriesByParentCategoryId(53);
                        break;
                case "Kids":
                        categories = this.CategoryService.GetAllCategoriesByParentCategoryId(57);
                        break;
                default:
                    categories = this.CategoryService.GetAllCategories();
                    break;
            }

            List<ProductCategoryMappingHelperClass> result = new List<ProductCategoryMappingHelperClass>();
            for (int i = 0; i < categories.Count; i++)
            {
                Category category = categories[i];
                //ProductCategory existingProductCategory = null;
                //if (existingProductCategoryCollection != null)
                //    existingProductCategory = existingProductCategoryCollection.FindProductCategory(this.ProductId, category.CategoryId);
                ProductCategoryMappingHelperClass pcm = new ProductCategoryMappingHelperClass();
                //if (existingProductCategory != null)
                //{
                //    pcm.ProductCategoryId = existingProductCategory.ProductCategoryId;
                //    pcm.IsMapped = true;
                //    pcm.IsFeatured = existingProductCategory.IsFeaturedProduct;
                //    pcm.DisplayOrder = existingProductCategory.DisplayOrder;
                //}
                //else
                //{
                //    pcm.DisplayOrder = 1;
                //}
                pcm.CategoryId = category.CategoryId;
                pcm.CategoryInfo = category.Name;// GetCategoryFullName(category);

                result.Add(pcm);
            }

            return result;
        }