Пример #1
0
        public void displaySortedProducts()
        {
            try
            {
                ProductDetailFillClass objProductDetailsFill = new ProductDetailFillClass();

                List <ProductGroup>         listProductGroup            = objProductDetailsFill.ProductGroupFill();
                List <ProductDetail>        listProductDetail           = objProductDetailsFill.ProductDetailFill();
                IEnumerable <ProductDetail> listProductDetailEnumerable = objProductDetailsFill.ProductSort(listProductDetail);

                foreach (ProductGroup item1 in listProductGroup)
                {
                    foreach (ProductDetail item2 in listProductDetailEnumerable)
                    {
                        if (item1.GroupId == item2.GroupId)
                        {
                            int intIndex = listProductDetail.IndexOf(item2);
                            Console.WriteLine("Index:" + intIndex + "|| Product Group Name: " + item1.GroupName + " || Product Name: " + item2.ProductName + " ||Product Description: " + item2.Description + " ||Product Rate: " + item2.Rate);
                            intIndex++;
                        }
                    }
                }
            }catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
Пример #2
0
        public IEnumerable <ProductDetail> ProductSort(List <ProductDetail> listProductDetail)
        {
            ProductDetailFillClass listProductDetailsFill = new ProductDetailFillClass();

            listProductDetail.Sort(listProductDetailsFill);
            return(listProductDetail);
        }