bool BooksListByName() { string toFind = head.GetInputValue(1); if (toFind.Length < 3) { return(false); } System.Collections.Generic.List <Book> find = shop.FindBookByTitle(toFind); if (find.Count == 0) { return(false); } return(BooksListScreen(find)); }
void RegisterAndLoginScreen() { byte choose; ActiveElementDraw loginWindow; NextWindow nextWindow = null; { loginWindow = new ActiveElementDraw(head, new StaticElement(" ::Login::", new Coord(10, 5)), new ActiveInputElement("Login:"******"Pass:"******"-------\n|Login|\n-------", new Coord(10, 10)), new StaticElement("╔══╗╔═══╗\n║╔╗║║╔═╗║\n║║║║║╚═╝║\n║║║║║╔╗╔╝\n║╚╝║║║║║\n╚══╝╚╝╚╝", new Coord((short)(downRightCorner.x / 2 - 10), (short)(downRightCorner.y / 2 - 5))), new StaticElement(" ::Register::", new Coord((short)(downRightCorner.x / 2 + 10), 5)), new ActiveInputElementAllSymbols("E-mail: " + new string(' ', 31), new Coord((short)(downRightCorner.x / 2 + 10), 7), new Coord(8, 0), 32), new ActiveInputElement("Login: "******"Pass: "******"Name: " + new string(' ', 16), new Coord((short)(downRightCorner.x / 2 + 10), 11), new Coord((short)"Name: ".Length, 0), 16), new ActiveInputElement("Surname: " + new string(' ', 16), new Coord((short)(downRightCorner.x / 2 + 10), 12), new Coord((short)"Surname: ".Length, 0), 16), new ActiveInputElement("Phone: " + new string(' ', 13), new Coord((short)(downRightCorner.x / 2 + 10), 13), new Coord((short)"Phone: ".Length, 0), 10), new ActiveStaticElement("----------\n|Register|\n----------", new Coord((short)(downRightCorner.x / 2 + 10), 15)) ); } loginWindow.InitStatic(); while (true) { loginWindow.Print(); choose = loginWindow.Input(InbisibleInput()); if (choose == 255) { continue; } switch (choose) { //Main case 0: goto REGISTER_AND_LOGIN_RETURN; //Find case 1: nextWindow = new NextWindow(BooksListByName); goto REGISTER_AND_LOGIN_RETURN; //Register/Login Logout case 2: break; //Login case 16: if (shop.Login(loginWindow.GetInputValue(14), LoginPass.Hasher(loginWindow.GetInputValue(15))) != null) { head.ChangeDoubleElementContrain(2); goto REGISTER_AND_LOGIN_RETURN; } break; //Register case 25: if (loginWindow.GetInputValue(22).Length == 0 || loginWindow.GetInputValue(23).Length == 0 || loginWindow.GetInputValue(24).Length == 0 || loginWindow.GetInputValue(21).Length == 0 || loginWindow.GetInputValue(20).Length == 0 || loginWindow.GetInputValue(19).Length == 0 ) { break; } if (!(Validator.IsEmail(loginWindow.GetInputValue(19)) && Validator.IsPhone(loginWindow.GetInputValue(24)))) { break; } if (shop.CreateUser(new Person(loginWindow.GetInputValue(22), loginWindow.GetInputValue(23), loginWindow.GetInputValue(24)), loginWindow.GetInputValue(20), LoginPass.Hasher(loginWindow.GetInputValue(21)), loginWindow.GetInputValue(19))) { shop.Login(loginWindow.GetInputValue(20), LoginPass.Hasher(loginWindow.GetInputValue(21))); head.ChangeDoubleElementContrain(2); goto REGISTER_AND_LOGIN_RETURN; } break; default: //Console.Write(choose); break; } } REGISTER_AND_LOGIN_RETURN: loginWindow.ClearScreen(); head.InitStatic(); if (nextWindow != null) { nextWindow.Invoke(); } }