Esempio n. 1
0
        static void Main(string[] args)
        {
            bool isFinish = false;

            do
            {
                switch (ChoicesMenu.ChoseWhatToDo())
                {
                case Constants.ENTER_CHOICE:
                    RecordsService.CraeteReacord();
                    break;

                case Constants.EXIT_CHOICE:
                    RecordsService.FinishRecord();
                    break;

                case Constants.PROGRAMM_FINISH_CHOICE:
                    isFinish = true;
                    break;

                default:
                    Console.WriteLine("Выберите существующи вариант");
                    break;
                }
            } while (!isFinish);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            bool isFinish = false;

            do
            {
                switch (ChoicesMenu.ChoseOperation())
                {
                case (int)Operations.Add:
                    switch (ChoicesMenu.ChoseModel())
                    {
                    case (int)TableModels.Producer:
                        OperationsWithObject.AddProducer();
                        break;

                    case (int)TableModels.Product:
                        try
                        {
                            OperationsWithObject.AddProduct();
                        }
                        catch (ArgumentNullException exception)
                        {
                            Console.WriteLine(exception.ParamName);
                        }
                        break;

                    default:
                        Console.WriteLine("Нет такого объекта");
                        break;
                    }
                    break;

                case (int)Operations.Delete:
                    try
                    {
                        OperationsWithObject.DeleteProductById(ChoicesMenu.ChoseProduct().Id);
                    }
                    catch (ArgumentNullException exception)
                    {
                        Console.WriteLine(exception.ParamName);
                    }
                    break;

                case (int)Operations.Edit:
                    try
                    {
                        OperationsWithObject.EditProduct(ChoicesMenu.ChoseProduct());
                    }
                    catch (ArgumentNullException exception)
                    {
                        Console.WriteLine(exception.ParamName);
                    }
                    break;

                case Constants.EXIT_CHOSE:
                    isFinish = true;
                    break;

                default:
                    Console.WriteLine("Нет такой операций");
                    break;
                }

                Console.WriteLine("============================");
            } while (!isFinish);
        }