public ChoiseOperationForCalculateRevevenue(UserServiceFromList calculater, SignInOut signInOut)
        {
            this.signInOut  = signInOut;
            this.calculater = calculater;

            CalculateRevenueDefault = new CalculateRevenueDefault(calculater);
            CustomerSettingsScreen  = new CustomerSettingsScreen(calculater);

            CalculateRevenueDefault.RegisterHandlerDrawTable(OutputDataInTables);
            CalculateRevenueDefault.RegisterHandlerToFillUser(signInOut.ToFillUser);

            CustomerSettingsScreen.RegisterHandlerDrawTable(OutputDataInTables);
            CustomerSettingsScreen.RegisterHandlerToFillUser(signInOut.ToFillUser);

            CursorForSelect = new CursorForSelect(new Dictionary <string, Action>()
            {
                { "Посчитать с параметрами по умолчанию.", CalculateRevenueDefault.Calculate },
                { "Настроить.", ToSettings },
                { "Посмотреть прошлую зaпись.", ToPrevRecords },
                { "Выйти", ToExit }
            });
        }
Example #2
0
        static void Main()
        {
            Kernel = new StandardKernel(new CalculateServiceCollection());
            var calculater = Kernel.Get <UserServiceFromList>();

            var account   = new Account();
            var signInOut = new SignInOut(account, calculater);

            try
            {
                ChoiseOperationForCalculateRevevenue mainScreen = new ChoiseOperationForCalculateRevevenue(calculater, signInOut);
                while (true)
                {
                    try
                    {
                        signInOut.CursorForSelect.RenderCursor();
                        signInOut.CursorForSelect.Move(CursorForSelect.InputData());

                        while (signInOut.IsLogin())
                        {
                            try
                            {
                                mainScreen.CursorForSelect.RenderCursor();
                                mainScreen.CursorForSelect.Move(CursorForSelect.InputData());
                                while (mainScreen.CustomerSettingsScreen.IsSettings)
                                {
                                    mainScreen.CustomerSettingsScreen.CursorForSelect.RenderCursor();
                                    mainScreen.CustomerSettingsScreen.CursorForSelect.Move(CursorForSelect.InputData());
                                    while (!mainScreen.CustomerSettingsScreen.OperationOverEmployees.IsToBack)
                                    {
                                        mainScreen.CustomerSettingsScreen.OperationOverEmployees.CursorForSelect.RenderCursor();
                                        mainScreen.CustomerSettingsScreen.OperationOverEmployees.CursorForSelect.Move(CursorForSelect.InputData());
                                    }
                                    while (!mainScreen.CustomerSettingsScreen.OperationOverGoods.IsToBack)
                                    {
                                        mainScreen.CustomerSettingsScreen.OperationOverGoods.CursorForSelect.RenderCursor();
                                        mainScreen.CustomerSettingsScreen.OperationOverGoods.CursorForSelect.Move(CursorForSelect.InputData());
                                    }
                                    while (!mainScreen.CustomerSettingsScreen.OperationOverRentalSpace.IsToBack)
                                    {
                                        mainScreen.CustomerSettingsScreen.OperationOverRentalSpace.CursorForSelect.RenderCursor();
                                        mainScreen.CustomerSettingsScreen.OperationOverRentalSpace.CursorForSelect.Move(CursorForSelect.InputData());
                                    }
                                }
                            }
                            catch (ValidationException ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.ReadLine();
                            }
                            catch (ArgumentOutOfRangeException ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.ReadLine();
                            }
                            catch (InvalidCastException ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.ReadLine();
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine(ex.Message);
                                Console.ReadLine();
                            }
                        }
                    }
                    catch (ValidationException ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadLine();
                    }
                    catch (InvalidCastException ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadLine();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        Console.ReadLine();
                    }
                }
            }

            catch (InvalidCastException ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.ReadLine();
            }

            Console.ReadLine();
        }