Пример #1
0
        private static void UpdateWayBill(StoreKeeperRepository storeKeeperRepository)
        {
            WayBillRepository wayBillRepository = new WayBillRepository(CONNECTION_STRING);
            var updwaybil = wayBillRepository.GetWayBill() as List<Waybill>;
            int i = 0;
            Console.WriteLine("# | Id WayBill | Send | Provider | Id Keeper | Date To/from");
            foreach (var waybill in updwaybil)
            {
                if (waybill.IsExport==true)
                {

                    Console.WriteLine($"{++i},{waybill.Id},{waybill.IsExport},{waybill.StoreKeeperId},{waybill.DeliveryDate},");

                }
                else
                {
                    Console.WriteLine($"{++i},{waybill.Id},{waybill.IsExport},{waybill.StoreKeeperId},{waybill.DepartDate},");

                }
                while (true)
                {
                    int choise = 0;
                    if (int.TryParse(Console.ReadLine(), out choise))
                    {
                        choise--;
                        if (choise>=0&&choise<updwaybil.Count)
                        {
                            if (updwaybil[choise].IsExport == true)
                            {
                                Console.WriteLine("Изменить получателя");
                                updwaybil[choise].Receiver = Console.ReadLine();
                            }
                        }
                       
                    

                }
            }
        }
Пример #2
0
static void Main(string[] args)
        {
            
            EnsureDatabase.For.SqlDatabase(CONNECTION_STRING);

            var upgrader =
              DeployChanges.To
                  .SqlDatabase(CONNECTION_STRING)
                  .WithScriptsEmbeddedInAssembly(Assembly.GetExecutingAssembly())
                  .LogToConsole()
                  .Build();

            upgrader.PerformUpgrade();
            WayBillRepository wayBillRepository = new WayBillRepository(CONNECTION_STRING);
            StoreKeeperRepository storeKeeperRepository = new StoreKeeperRepository(CONNECTION_STRING);

            while (true)
            {
                Console.WriteLine("Выберите меню: \n" +
                    "1.Принять товар\n" +
                    "2.Отправить товар\n" +
                    "3.Изменить товар\n" +
                    "4.Список товаров\n" +
                    "5.Список кладовщиков\n"+
                    "0.Exit\n" );
                int chooseMenu;
                if (int.TryParse(Console.ReadLine(), out chooseMenu))
                {
                    Console.Clear();
                    switch (chooseMenu)
                    {
                        case 1:
                            insetWayBill(storeKeeperRepository);
                           
                            break;
                        case 2:
                            WayBillDepart(storeKeeperRepository);



                            break;
                        case 3:
                            UpdateWayBill(storeKeeperRepository);



                            break;
                        case 4:
                            ProductRepository productRepository = new ProductRepository(CONNECTION_STRING);
                            var products = productRepository.GetProduct() as List<Product>;
                            PrintProduct(products);
                            break;
                        case 5:
                            var keepers = storeKeeperRepository.GetStoreKeeper() as List<StoreKeeper>;
                            PrintKeeper(keepers);
                            int i = 0;
                           
                            break;
                    }

                }
                
            }
        }