Пример #1
0
        public static void AddNewBatch(SqlConnection connection)
        {
            Batch batch = new Batch();

            Console.WriteLine("Please, enter the batch details: ");

            Console.Write("Date: ");
            batch.Date = ConsoleInput.InputDate();

            Console.Write("Select batch type: ");
            batch.BatchType = SelectBatchType();

            BatchQuery batchQuery = new BatchQuery(connection);

            batchQuery.AddNewRecord(batch);
            int lastId = batchQuery.GetLastId();

            Console.WriteLine("Please, add products to the batch (input product's Id and quantity): ");
            ProductBatchQuery productBatchQuery = new ProductBatchQuery(connection);

            AddRecordsIntoProductBatch(lastId, productBatchQuery);
        }
Пример #2
0
        public static void AddNewProduct(SqlConnection connection)
        {
            Product product = new Product();

            Console.WriteLine("Please, enter the product details: ");

            Console.Write("Name: ");
            product.Name = Console.ReadLine();

            Console.Write("UnitMeasure: ");
            product.UnitMeasure = Console.ReadLine();

            Console.Write("UnitPrice: ");
            product.UnitPrice = ConsoleInput.InputDouble();

            Console.Write("Quantity: ");
            product.Quantity = ConsoleInput.InputInt();

            ProductQuery productQuery = new ProductQuery(connection);
            int          result       = productQuery.AddNewRecord(product);

            Console.WriteLine($"Affected rows: {result}");
        }