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 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 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 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); }
public OperationOverGoods(UserServiceFromList calculater) { this.calculater = calculater; CursorForSelect = new CursorForSelect(new Dictionary <string, Action>() { { "Добавить товар.", CreateGood }, { "Редактировать товар.", UpdateGood }, { "Удалить товар.", DeleteGood }, { "Назад.", ToBack } }); IsToBack = true; }
public OperationOverRentalSpace(UserServiceFromList calculater) { this.calculater = calculater; CursorForSelect = new CursorForSelect(new Dictionary <string, Action>() { { "Добавить помещение.", CreateRentalSpace }, { "Редактировать помещение.", UpdateRentalSpace }, { "Удалить помещение.", DeleteRentalSpace }, { "Назад.", ToBack } }); IsToBack = true; }
public OperationOverEmployees(UserServiceFromList calculater) { this.calculater = calculater; CursorForSelect = new CursorForSelect(new Dictionary <string, Action>() { { "Добавить работника.", CreateEmployee }, { "Редактировать работника.", UpdateEmployee }, { "Удалить работника.", DeleteEmployee }, { "Назад", ToBack } }); IsToBack = true; }
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); }
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(); }
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 } }); }
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(); } } }
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(); }