Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- using System.Collections.Generic;
- using System.IO;
- using Warehouse;
- using Warehouse.Item;
- using Kits;
- namespace StartPoint
- {
- class Program
- {
- static void Main()
- {
- string selection,TitleKit, TitleItem, ProdData;
- string[] ArrTitleItem;
- List<Item> ArrItem = new List<Item>();
- //Комплекты
- List<Item> KitList = new List<Item>();
- List<Kit> KitListAll = new List<Kit>();
- //Партии
- List<Item> PartyList = new List<Item>();
- List<Party> PartyListAll = new List<Party>();
- //общий список
- List<Product> ProductsAll = new List<Product>();
- using (StreamReader fileIn = new StreamReader(@"../../DataItem.txt"))
- {
- while (!fileIn.EndOfStream)
- {
- string[] Line;
- Line = fileIn.ReadLine().Split(' ');
- Item obj = new Item(Line[0], Convert.ToInt32(Line[1]), Line[2], Line[3]);
- ArrItem.Add(obj);
- ProductsAll.Add(obj);
- }
- }
- switchMenu:
- Console.WriteLine("Выбирите действие");
- Console.WriteLine("1) Найти информацию об 1 товаре");
- Console.WriteLine("2) Собрать комплект из нескольки товаров");
- Console.WriteLine("3) Собрать партию");
- Console.WriteLine("4) Отсортировать партию");
- Console.WriteLine("5) Отсортировать Комплект");
- Console.WriteLine();
- selection = Console.ReadLine();
- switch (selection)
- {
- case "1":
- Console.WriteLine("Введите название товара");
- selection = Console.ReadLine();
- foreach (var item in ArrItem)
- {
- if(selection == item.Title)
- {
- item.ItemInfo();
- }
- else
- {
- Console.WriteLine("Такого товара нет");
- }
- }
- goto switchMenu;
- case "2":
- Console.WriteLine("Введите навание комплекта");
- TitleKit = Console.ReadLine();
- Console.Write("Введите названия товаров: ");
- TitleItem = Console.ReadLine();
- ArrTitleItem = TitleItem.Split(' ');
- for (int i = 0; i < ArrTitleItem.Length; i++)
- {
- var temp = ArrItem.Where(item => item.Title == ArrTitleItem[i]).ToList();
- foreach (Item item in temp)
- {
- KitList.Add(item);
- }
- }
- Kit Kits = new Kit(TitleKit, KitList);
- Console.Write("Комплект {0} собран", TitleKit);
- Kits.ItemInfo();
- KitListAll.Add(Kits);
- ProductsAll.Add(Kits);
- goto switchMenu;
- case "3":
- Console.WriteLine("Введите навание партии");
- TitleKit = Console.ReadLine();
- Console.WriteLine("Введите цену партии");
- int.TryParse(Console.ReadLine(),out int PriceParty);
- Console.WriteLine("Введите Срок годности партии");
- ProdData = Console.ReadLine();
- Console.WriteLine("Введите количество");
- int.TryParse(Console.ReadLine(),out int CountPartyItem);
- Console.Write("Введите названия товаров: ");
- TitleItem = Console.ReadLine();
- ArrTitleItem = TitleItem.Split(' ');
- for (int i = 0; i < ArrTitleItem.Length; i++)
- {
- var temp = ArrItem.Where(item => item.Title == ArrTitleItem[i]).ToList();
- foreach (Item item in temp)
- {
- PartyList.Add(item);
- }
- }
- Party Party = new Party(TitleKit,PriceParty,ProdData,CountPartyItem, PartyList);
- Console.Write("Партия {0} собрана", TitleKit);
- Party.ItemInfo();
- PartyListAll.Add(Party);
- ProductsAll.Add(Party);
- goto switchMenu;
- case "4":
- Console.WriteLine("Выберите комплект для сортировки");
- selection = Console.ReadLine();
- if (PartyListAll!=null)
- {
- int i = 0;
- foreach (var item in PartyListAll)
- {
- Console.WriteLine("{0}) {1} ",i,item.Title);
- }
- int.TryParse(Console.ReadLine(),out int kek);
- //тут я уже очень устал
- PartyListAll[i].ListProducts.Sort();
- Console.WriteLine("Отсортирован*");
- PartyListAll[i].ItemInfo();
- }
- goto switchMenu;
- default:
- Console.WriteLine("Вы нажали неизвестную букву");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement