示例#1
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());
            }
        }
示例#2
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();
        }
示例#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 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());
            }
        }
示例#6
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();
        }
示例#7
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();
        }
示例#8
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();
        }
示例#9
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();
                }
            }
        }