public void DisplaySortedProducts() { try { ProductDetailsFill objProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> objListProductGroup = objProductDetailsFill.ProductGroupFill(); List <ProductInfo> objListproductInfo = objProductDetailsFill.ProductFill(); IEnumerable <ProductInfo> EnumProductInfo = objProductDetailsFill.ProductSort(objListproductInfo); foreach (ProductGroup product1 in objListProductGroup) { foreach (ProductInfo product2 in EnumProductInfo) { if (product1.ProductGroupID == product2.GroupID) { Console.WriteLine("Product Group Name: " + product1.ProductGroupName + " || Product Name: " + product2.ProductName + " || Product Description: " + product2.ProductDescription + " || Product Rate: " + product2.ProductRate); } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void displaySortedProducts() { try { FindIndex objectFindIndex = new FindIndex(); ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> productGroup = objectProductDetailsFill.ProductGroupFill(); List <ProductInfo> productInfo = objectProductDetailsFill.ProductFill(); IEnumerable <ProductInfo> product = objectProductDetailsFill.ProductSort(productInfo); foreach (ProductGroup item1 in productGroup) { foreach (ProductInfo item2 in product) { 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); } }
public void DisplayAfterDeletion3(int num1, int num2) { try { ProductDetailsFill objProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> objListProductGroup = objProductDetailsFill.ProductGroupFill(); List <ProductInfo> objListproductInfo = objProductDetailsFill.ProductFill(); List <ProductInfo> objProductDelete3 = objProductDetailsFill.ProductDelete3(objListproductInfo, num1, num2); foreach (ProductGroup product1 in objListProductGroup) { foreach (ProductInfo product2 in objProductDelete3) { if (product1.ProductGroupID == product2.GroupID) { Console.WriteLine("Product Group Name: " + product1.ProductGroupName + " || Product Name: " + product2.ProductName + " || Product Description: " + product2.ProductDescription + " || Product Rate: " + product2.ProductRate); } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
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); } }
public List <ProductInfo> testDisplayAll() { ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductInfo> productInfo = objectProductDetailsFill.ProductFill(); return(productInfo); }
public IEnumerable <ProductInfo> ProductSort(List <ProductInfo> ProductInfo) { ProductDetailsFill objProductDetailsFill = new ProductDetailsFill(); ProductInfo.Sort(objProductDetailsFill); return(ProductInfo); }
public IEnumerable <ProductInfo> testSort() { ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductInfo> productInfo = objectProductDetailsFill.ProductFill(); IEnumerable <ProductInfo> product = objectProductDetailsFill.ProductSort(productInfo); return(product); }
public int Find(string str) { ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductInfo> productInfo = objectProductDetailsFill.ProductFill(); foreach (ProductInfo item in productInfo) { if (item.Name == str) { this.index = productInfo.IndexOf(item); break; } } return(index); }
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); } }
public static int Find(string str) { try { ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> productGroup = objectProductDetailsFill.ProductGroupFill(); foreach (ProductGroup item in productGroup) { if (str == item.Name) { return(item.ID); } } }catch (Exception ex) { Console.WriteLine(ex.Message); } return(0); }
public void DisplayFound(string str) { if (str == null) { Console.WriteLine("Please enter a string!"); } else { try { FindIndex objectFindIndex = new FindIndex(); ProductDetailsFill objectProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> productGroup = objectProductDetailsFill.ProductGroupFill(); List <ProductInfo> productInfo = objectProductDetailsFill.ProductFill(); var result = productInfo.Where(p => p.Name.ToUpper().Contains(str.ToUpper())); if (result.Count() < 1) { Console.WriteLine("No Match!"); } else { foreach (ProductGroup item1 in productGroup) { foreach (ProductInfo item2 in result) { 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); } } }
public static int FindID(string str) { try { ProductDetailsFill objProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> productGroup = objProductDetailsFill.ProductGroupFill(); foreach (ProductGroup product in productGroup) { if (product.ProductGroupName == "Dairy" && product.ProductGroupName == str) { return(1); } else if (product.ProductGroupName == "Chocolate" && product.ProductGroupName == str) { return(2); } if (product.ProductGroupName == "FruitJuice" && product.ProductGroupName == str) { return(3); } else if (product.ProductGroupName == "Cakes" && product.ProductGroupName == str) { return(4); } } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(0); }
public void DisplayFoundItems(string search) { if (search == null) { Console.WriteLine("Please enter a string!"); } else { try { ProductDetailsFill objProductDetailsFill = new ProductDetailsFill(); List <ProductGroup> objListProductGroup = objProductDetailsFill.ProductGroupFill(); List <ProductInfo> objListproductInfo = objProductDetailsFill.ProductFill(); var result = objListproductInfo.Where(p => p.ProductName.ToUpper().Contains(search.ToUpper())); foreach (ProductGroup product1 in objListProductGroup) { foreach (ProductInfo product2 in result) { if (product1.ProductGroupID == product2.GroupID) { Console.WriteLine("Product Group Name: " + product1.ProductGroupName + " || Product Name: " + product2.ProductName + " || Product Description: " + product2.ProductDescription + " || Product Rate: " + product2.ProductRate); } } } } catch (Exception ex) { Console.WriteLine(ex.Message); } } }