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()); } }
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(); }
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(); }
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(); }
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()); } }
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(); }
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(); }
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(); }
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(); } } }