コード例 #1
0
ファイル: Display.cs プロジェクト: vikashkbihari/Assignment_4
        public void DisplayAfterDeletion4(string productName)
        {
            try
            {
                FindIndex          objectFindIndex          = new FindIndex();
                ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill();

                List <ProductGroup> productGroup = objectProductDetailsFill.ProductGroupFill();
                List <ProductInfo>  productInfo  = objectProductDetailsFill.ProductFill();

                List <ProductInfo> productNew = objectProductDetailsFill.ProductDelete4(productInfo, productName);

                if (productNew == null)
                {
                    Console.WriteLine("No Match!");
                }
                else
                {
                    foreach (ProductGroup item1 in productGroup)
                    {
                        foreach (ProductInfo item2 in productNew)
                        {
                            if (item1.ID == item2.GroupID)
                            {
                                Console.WriteLine("Index: " + (objectFindIndex.Find(item2.Name)) + " || Product Group Name: " + item1.Name + " || Product Name: " + item2.Name + " || Product Description: " + item2.Description + " || Product Rate: " + item2.rate);
                            }
                        }
                    }
                }
            }catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
コード例 #2
0
        public void DisplayAfterDeletion4(string delete)
        {
            try
            {
                ProductDetailsFill objProductDetailsFill = new ProductDetailsFill();

                List <ProductGroup> objListProductGroup = objProductDetailsFill.ProductGroupFill();
                List <ProductInfo>  objListproductInfo  = objProductDetailsFill.ProductFill();

                bool flag = false;

                foreach (ProductInfo testProduct in objListproductInfo)
                {
                    if (testProduct.ProductName.Trim().ToUpper() == (delete.Trim().ToUpper()))
                    {
                        flag = true;
                        break;
                    }
                }

                if (flag == false)
                {
                    Console.WriteLine("Invalid product name");
                }

                else
                {
                    List <ProductInfo> objProductDelete4 = objProductDetailsFill.ProductDelete4(objListproductInfo, delete);

                    foreach (ProductGroup product1 in objListProductGroup)
                    {
                        foreach (ProductInfo product2 in objProductDelete4)
                        {
                            if (product1.ProductGroupID == product2.GroupID)
                            {
                                Console.WriteLine("Product Group Name: " + product1.ProductGroupName + " || Product Name: " + product2.ProductName + " || Product Description: " + product2.ProductDescription + " || Product Rate: " + product2.ProductRate + "Reached");
                            }
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }