Esempio n. 1
0
        public static void AddKnot()
        {
            if (Details.Count() < 2)
            {
                Console.WriteLine("Деталей слишком мало для создания узла, минимальное количество 2.");
                Console.ReadKey();
                return;
            }

            Console.WriteLine("Введите название: ");
            string name = InputString();

            Console.WriteLine("Введите вес: ");
            int weight = InputInt(1, Product.MAX_WEIGHT);

            Console.WriteLine("Введите количество: ");
            int amount = InputInt(1, Product.MAX_AMOUNT);

            Console.WriteLine("Выберите страну производства:\n" +
                              $"{Product.COUNTRY_ID_RUSSIA}.{Product.GetCountryById(Product.COUNTRY_ID_RUSSIA)}\n" +
                              $"{Product.COUNTRY_ID_USA}.{Product.GetCountryById(Product.COUNTRY_ID_USA)}\n" +
                              $"{Product.COUNTRY_ID_GERMANY}.{Product.GetCountryById(Product.COUNTRY_ID_GERMANY)}\n" +
                              $"{Product.COUNTRY_ID_JAPAN}.{Product.GetCountryById(Product.COUNTRY_ID_JAPAN)}\n" +
                              $"{Product.COUNTRY_ID_KOREA}.{Product.GetCountryById(Product.COUNTRY_ID_KOREA)}\n");
            int countryId = InputInt(1, Product.COUNT_COUNTRY);

            Console.WriteLine("Введите год производства: ");
            int yearMake = InputInt(Detail.MIN_YEAR_MAKE, DateTime.Now.Year);

            List <Detail> details = new List <Detail>();

            Console.WriteLine("Выберите 1-ю деталь механизма: ");
            details.Add(ChoiceDetail());

            Console.WriteLine("Выберите 2-ю деталь механизма: ");
            details.Add(ChoiceDetail());

            Console.WriteLine("Выберите тип соеденения: \n" +
                              $"{Knot.CONNECT_ID_GEAR}.{Knot.GetConnectById(Knot.CONNECT_ID_GEAR)}\n" +
                              $"{Knot.CONNECT_ID_THREADED}.{Knot.GetConnectById(Knot.CONNECT_ID_THREADED)}\n");
            int connectionId = InputInt(1, Knot.COUNT_CONNECTS);

            Console.WriteLine($"Выберите сложность узла(от 1 до {Knot.MAX_DIFFICULTY})");
            int difficulty = InputInt(1, Knot.MAX_DIFFICULTY);

            Knots.Add(new Knot(countryId, weight, amount, name, details, connectionId, difficulty));
        }