示例#1
0
        private void DeleteEmployee()
        {
            if (CreateDictionaryEmployees().Count < 1)
            {
                Console.WriteLine("У Вас нету работников.");
                Console.ReadLine();
                return;
            }

            IsEmployee   = true;
            insideCursor = new CursorForSelect(CreateDictionaryEmployees());

            while (IsEmployee)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryEmployees.Count - 1)
            {
                return;
            }

            calculater.DeleteEmployee(insideCursor.Cursor.Position);

            Console.WriteLine("Данные удалены.");
            Console.ReadLine();
        }
示例#2
0
        private void SetValueType()
        {
            int iterator = 0;

            IsType = true;
            type   = new Dictionary <string, Action>
            {
                { "Int.", GetCursorPositionFromType },
                { "Bolean.", GetCursorPositionFromType },
                { "Char.", GetCursorPositionFromType },
                { "String.", GetCursorPositionFromType },
                { "Назад.", BackToCommand },
            };
            cursorForType = new CursorForSelect(type);

            foreach (var item in commands)
            {
                if (iterator == cursorForCommand.Cursor.Position)
                {
                    typeOperation = item.Key;
                    break;
                }
                ++iterator;
            }

            while (IsType)
            {
                cursorForType.RenderCursor();
                cursorForType.Move(CursorForSelect.InputData());
            }
        }
示例#3
0
        private void DeleteGood()
        {
            IsGoods      = true;
            insideCursor = new CursorForSelect(CreateDictionaryGoods());
            if (dictionaryGoods.Count < 1)
            {
                Console.WriteLine("У Вас нету товаров");
                Console.ReadLine();
                return;
            }

            while (IsGoods)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryGoods.Count - 1)
            {
                return;
            }

            calculater.DeleteGood(insideCursor.Cursor.Position);

            Console.WriteLine("Данные удалены.");
            Console.ReadLine();
        }
示例#4
0
        private void DeleteRentalSpace()
        {
            IsRentalSpace = true;
            insideCursor  = new CursorForSelect(CreateDictionaryRentalSpace());
            if (dictionaryRentalSpace.Count < 1)
            {
                Console.WriteLine("У Вас нету арендуемых помещений");
                Console.ReadLine();
                return;
            }

            while (IsRentalSpace)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryRentalSpace.Count - 1)
            {
                return;
            }

            calculater.DeleteRentalSpace(insideCursor.Cursor.Position);

            Console.WriteLine("Данные удалены.");
            Console.ReadLine();
        }
示例#5
0
        public SignInOut(IAccount <UserDTO, RegistrationDTO, SignInDTO> account, UserServiceFromList userService)
        {
            this.account     = account;
            this.userService = userService;

            action = new Dictionary <string, Action>()
            {
                { "Войти в систему", SignIn },
                { "Зарегистрироваться", RegistrationOfUser }
            };

            CursorForSelect = new CursorForSelect(action);
        }
示例#6
0
        public OperationOverGoods(UserServiceFromList calculater)
        {
            this.calculater = calculater;
            CursorForSelect = new CursorForSelect(new Dictionary <string, Action>()
            {
                { "Добавить товар.", CreateGood },
                { "Редактировать товар.", UpdateGood },
                { "Удалить товар.", DeleteGood },
                { "Назад.", ToBack }
            });

            IsToBack = true;
        }
示例#7
0
        public OperationOverRentalSpace(UserServiceFromList calculater)
        {
            this.calculater = calculater;
            CursorForSelect = new CursorForSelect(new Dictionary <string, Action>()
            {
                { "Добавить помещение.", CreateRentalSpace },
                { "Редактировать помещение.", UpdateRentalSpace },
                { "Удалить помещение.", DeleteRentalSpace },
                { "Назад.", ToBack }
            });

            IsToBack = true;
        }
示例#8
0
        public OperationOverEmployees(UserServiceFromList calculater)
        {
            this.calculater = calculater;

            CursorForSelect = new CursorForSelect(new Dictionary <string, Action>()
            {
                { "Добавить работника.", CreateEmployee },
                { "Редактировать работника.", UpdateEmployee },
                { "Удалить работника.", DeleteEmployee },
                { "Назад", ToBack }
            });

            IsToBack = true;
        }
示例#9
0
        public CustomerSettingsScreen(UserServiceFromList calculater)
        {
            this.calculater = calculater;

            OperationOverEmployees   = new OperationOverEmployees(calculater);
            OperationOverGoods       = new OperationOverGoods(calculater);
            OperationOverRentalSpace = new OperationOverRentalSpace(calculater);

            customerSettings = new Dictionary <string, Action>()
            {
                { "Работник.", GetOperationOverEmployees },
                { "Товар.", GetOperationOverGoods },
                { "Арендуемое помещение.", GetOperationOverRentalSpace },
                { "Расчитать прибыль", CalculateRevenue },
                { "Назад", ToMainScreen }
            };

            CursorForSelect = new CursorForSelect(customerSettings);
        }
示例#10
0
        public void SetCommand()
        {
            IsCommand = true;
            commands  = new Dictionary <string, Action>
            {
                { "Сложение.", GetCursorPositionFromCommand },
                { "Вычитание.", GetCursorPositionFromCommand },
                { "Умножение.", GetCursorPositionFromCommand },
                { "Деление.", GetCursorPositionFromCommand },
                { "Назад", BackToMainScreen }
            };

            cursorForCommand = new CursorForSelect(commands);

            while (IsCommand)
            {
                Console.WriteLine("Выберите команду:");
                cursorForCommand.RenderCursor();
                cursorForCommand.Move(CursorForSelect.InputData());
            }
        }
示例#11
0
        private void UpdateEmployee()
        {
            IsEmployee   = true;
            insideCursor = new CursorForSelect(CreateDictionaryEmployees());
            while (IsEmployee)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryEmployees.Count - 1)
            {
                return;
            }

            InputDataForEmployee();

            calculater.UpdateEmployee(position, salary, insideCursor.Cursor.Position);

            Console.WriteLine("Данные изменины.");
            Console.ReadLine();
        }
示例#12
0
        private void UpdateGood()
        {
            IsGoods      = true;
            insideCursor = new CursorForSelect(CreateDictionaryGoods());
            while (IsGoods)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryGoods.Count - 1)
            {
                return;
            }

            InputDataForGood();

            calculater.UpdateGood(purchasePrice, salePrice, count, insideCursor.Cursor.Position);

            Console.WriteLine("Данные изменины.");
            Console.ReadLine();
        }
        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 }
            });
        }
示例#14
0
        private void UpdateRentalSpace()
        {
            IsRentalSpace = true;
            insideCursor  = new CursorForSelect(CreateDictionaryRentalSpace());
            while (IsRentalSpace)
            {
                insideCursor.RenderCursor();
                insideCursor.Move(CursorForSelect.InputData());
            }

            if (insideCursor.Cursor.Position == dictionaryRentalSpace.Count - 1)
            {
                return;
            }

            InputDataForRentalSpace();

            calculater.UpdateRentalSpace(title, rentalSpace, insideCursor.Cursor.Position);

            Console.WriteLine("Данные изменины.");
            Console.ReadLine();
        }
示例#15
0
        static void Main()
        {
            ConsoleUI ui = new ConsoleUI();

            Dictionary <string, Action> action = new Dictionary <string, Action>()
            {
                { "Войти в систему", ui.SignIn },
                { "Зарегистрироваться", ui.RegistrationOfUser }
            };

            Dictionary <string, Action> actionOnPageForUser = new Dictionary <string, Action>()
            {
                { "Выполнить математические операции.", ui.SetCommand },
                { "Изменить пароль.", ui.EditUser },
                { "Выйти.", ui.ExitFromAccount }
            };


            Dictionary <string, Action> actionOnPageForSuperUser = new Dictionary <string, Action>()
            {
                { "Посмотреть операции пользователя.", ui.SelectUserFromList },
                { "Выйти.", ui.ExitFromAccountSuperUser }
            };

            CursorForSelect cursorIn        = new CursorForSelect(action);
            CursorForSelect cursorUser      = new CursorForSelect(actionOnPageForUser);
            CursorForSelect cursorSuperUser = new CursorForSelect(actionOnPageForSuperUser);

            while (true)
            {
                try
                {
                    cursorIn.RenderCursor();
                    cursorIn.Move(CursorForSelect.InputData());

                    while (ui.IsLogin())
                    {
                        try
                        {
                            cursorUser.RenderCursor();
                            cursorUser.Move(CursorForSelect.InputData());
                        }
                        catch (ValidationException ex)
                        {
                            Console.WriteLine(ex.Message);
                            Console.ReadKey();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message + "!!!");
                            Console.ReadKey();
                        }
                    }

                    while (ui.IsLoginSuperUser())
                    {
                        try
                        {
                            cursorSuperUser.RenderCursor();
                            cursorSuperUser.Move(CursorForSelect.InputData());
                        }
                        catch (ValidationException ex)
                        {
                            Console.WriteLine(ex.Message);
                            Console.ReadKey();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine(ex.Message + "!!!");
                            Console.ReadKey();
                        }
                    }
                }
                catch (ValidationException ex)
                {
                    Console.WriteLine(ex.Message);
                    Console.ReadKey();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message + "!!!");
                    Console.ReadKey();
                }
            }
        }
示例#16
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();
        }