Esempio n. 1
0
        /// <summary>
        /// Работа с меню регистрации нового клиента
        /// </summary>
        protected static void GetRegMenu()
        {
            string[] filds   = new string[] { "Login", "Password", "Surname", "Name", "Pasport IDNO" };
            string[] buttons = new string[] { "REGISTRATION", "CANCEL", "EXIT" };
            string   title   = "Registration data";
            Menu     regMenu = new Menu(title, filds, buttons);
            Client   newClient;

            while (true)
            {
                regMenu.Show();
                try {
                    newClient = new Client(regMenu.FildsDict["Login"], regMenu.FildsDict["Password"])
                    {
                        Surname     = regMenu.FildsDict["Surname"],
                        Name        = regMenu.FildsDict["Name"],
                        PasportIDNO = regMenu.FildsDict["Pasport IDNO"],
                    };
                    if (Bank.TryAddNewClient(newClient))
                    {
                        if (regMenu.ButtonPressedIndex() == 0)
                        {
                            ClientMenu(newClient);
                            return;
                        }
                        else if (regMenu.ButtonPressedIndex() == 2)
                        {
                            Environment.Exit(0);
                        }
                    }
                    else
                    {
                        regMenu.Title = "Accaunt whith this login already exist. Choice another login.";
                    }
                } catch (PasswordCorrectExeption ex) {
                    regMenu.Title = ex.Message;
                }
            }
        }