public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; int left = 3; int pos = 2; ViewTools.Txt(top: pos++, left: left, text: "Главный экран пользователя"); ViewTools.Txt(top: pos++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: pos++, left: left, text: "--------------------------------------------"); pos++; ViewTools.Txt(top: pos++, left: left, text: "(1). Добавить часы работы"); ViewTools.Txt(top: pos++, left: left, text: "(2). Выход из программы"); ViewTools.Txt(top: pos++, left: left, text: "(3). Сменить пользователя"); pos++; ViewTools.Txt(top: pos, left: left, text: "Ваш выбор : "); FieldList fields = new FieldList().Add(new ChooseField(top: pos++, left: left + 13, name: "Choose", chooseConvert: ChooseConvert)); eViewStatus inputFieldResult = fields.Input(); return(new ControllerRequest <UserMainController>(inputFieldResult, fields.ToResultValueList())); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; ViewTools.Txt(top: 2, left: 3, text: "Вы хотите выйти из программы?"); ViewTools.Txt(top: 3, left: 3, text: "--------------------------------------------"); FieldList fieldList = new FieldList(); fieldList.Add(new WaitOkField(top: 5, left: 3, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fieldList.Input(); return(new ControllerRequest <AskToExitController>(viewStatus, fieldList.ToResultValueList())); }
public override ControllerRequest View(object model) { Console.Clear(); Console.CursorVisible = false; IPerson currentUser = ApplicationData.CurrentData.CurrentPerson; int left = 3; int top = 2; ViewTools.Txt(top: top++, left: left, text: "Список работников"); ViewTools.Txt(top: top++, left: left, text: $"Пользователь: {currentUser.FirstName}, {currentUser.LastName}"); ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------"); top++; ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); ViewTools.Txt(top: top++, left: left, text: "| Id | Имя | Фамилия | Должность |"); ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); IPerson[] persons = (IPerson[])model; foreach (var person in persons.OrderBy(p => p.Role).ThenBy(p => p.LastName)) { string role = person.Role switch { Role.Worker => "Работник", Role.Manager => "Менеджер", Role.Freelancer => "Фриланстер", _ => throw new ArgumentOutOfRangeException() }; ViewTools.Txt(top: top++, left: left, text: $"| {person.Id,4} | {person.FirstName,-16} | {person.LastName,-16} | {role, -11} |"); } ViewTools.Txt(top: top++, left: left, text: "+------+------------------+------------------+-------------+"); FieldList fields = new FieldList(); top++; fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]")); eViewStatus viewStatus = fields.Input(); return(new ControllerRequest <ManagerMainController>()); } }
public override ControllerRequest View(object model) { ViewInput input = (ViewInput)model; Console.Clear(); Console.CursorVisible = false; FieldList fields = new FieldList(); int left = 3; int top = 2; ViewTools.Txt(top: top++, left: left, text: "Добро пожаловать, представьтесь пожалуйста"); ViewTools.Txt(top: top++, left: left, text: "--------------------------------------------"); ViewTools.Txt(top: top, left: left, text: "Имя :"); fields.Add(new EditField(top: top++, left: left + 10, length: 15, name: "FirstName", text: "")); ViewTools.Txt(top: top, left: left, text: "Фамилия :"); fields.Add(new EditField(top: top++, left: left + 10, length: 15, name: "LastName", text: "")); top++; fields.Add(new WaitOkField(top: top++, left: left, name: "Ok", text: "[ Ok ]")); if (!string.IsNullOrWhiteSpace(input?.Message)) { top++; Console.ForegroundColor = ConsoleColor.Red; ViewTools.Txt(top: top++, left: 3, length: 30, text: input.Message); Console.ResetColor(); } eViewStatus viewStatus = fields.Input(); return(new ControllerRequest <LoginController>(viewStatus: viewStatus, valueList: fields.ToResultValueList())); }
protected ControllerRequest(eViewStatus viewStatus, ResultValueList valueList) { _viewResult = new ViewResult(viewStatus, valueList); }
public ViewResult(eViewStatus viewStatus, ResultValueList values) { ViewStatus = viewStatus; Values = values; }