Exemple #1
0
        /// <summary>
        /// Работа с меню авторизации клиента банка
        /// </summary>
        protected static void GetLoginMenu()
        {
            Menu loginMenu = new Menu("Enter you registration data for enter:",
                                      new string[] { "Login", "Password" },
                                      new string[] { "ENTER", "BACK", "EXIT" });
            Client client;

            while (true)
            {
                loginMenu.Show();
                if (loginMenu.ButtonPressedIndex() == 0 && loginMenu.FildsDict["Login"] != null && loginMenu.FildsDict["Password"] != null)
                {
                    try {
                        client = Bank.GetClient(loginMenu.FildsDict["Login"], loginMenu.FildsDict["Password"]);
                        if (client != null)
                        {
                            if (client.IsLogined)
                            {
                                ClientMenu(client);
                                return;
                            }
                            else
                            {
                                loginMenu.Title = String.Format("Incorrect password. Remain {0} trying.", client.TryCountLeft);
                            }
                        }
                        else
                        {
                            loginMenu.Title = "Incorrect login. Verify corrections of login entering.";
                        }
                    } catch (PasswordCorrectExeption ex) {
                        loginMenu.Title = ex.Message;
                    }
                }
                else if (loginMenu.ButtonPressedIndex() == 1)
                {
                    return;
                }
                else if (loginMenu.ButtonPressedIndex() == 2)
                {
                    Environment.Exit(0);
                }
                else
                {
                    loginMenu.Title = "Please enter the login and password";
                }
                loginMenu.FildsDict["Password"] = null;
            }
        }