private void confirmButton_Click(object sender, EventArgs e) { String loging = loginBox.Text; String password = passwordBox.Text; if (!String.IsNullOrEmpty(loging) || !String.IsNullOrEmpty(password)) { User user = controller.signIn(loging, password); if (user != null) { Console.WriteLine(user.email); RegisteredUserMenu userMenu = new RegisteredUserMenu(user);; userMenu.Show(); this.Close(); } else { errorLabel.ForeColor = Color.Red; errorLabel.Text = "Invalid login or password"; } } }
public static void signInAndSession() { SignInController signIn = new SignInController(); Console.Write("Input login:"******"Input password:"******"Invalid login or password!"); Console.WriteLine("1.Try again" + "\n2.Exit"); Console.Write("Value:"); int number = int.Parse(Console.ReadLine()); if (number == 1) { Console.Clear(); Console.Write("Input login:"******"Input password:"******"\nValue:"); int number = int.Parse(Console.ReadLine()); switch (number) { case (1): Console.Clear(); foreach (Product product in session.getAllProducts()) { Console.WriteLine("Id:" + product.id + "\nName:" + product.name + "\nPrice:" + product.price + "\n"); } Console.Write("Input product id:"); int pid = int.Parse(Console.ReadLine()); Console.Write("Comment:"); String comment = Console.ReadLine(); session.leaveFeedback(pid, comment); break; case (2): Console.Clear(); Console.Write("Input password:"******"User:"******"\nProduct:" + feedback.product.name + "\nComment:" + feedback.comment + "\nDate:" + feedback.date + "\n"); } break; case (4): Console.Clear(); printFeedbacks(); break; case (5): exit = true; break; } } }