public Bancomat(ClientBank _client) { InitializeComponent(); client = _client; account = AllBankAccounts.GetAccount(client.numOfCurd); label1.Text = "Ваш текущий баланс: " + account.cashValue.ToString(); }
private void LogIn_Click(object sender, EventArgs e) { client = Authorization.InputInSystem(int.Parse(numberOfCard.Text), password.Text); if (client != null) { Bancomat panel = new Bancomat(client); panel.Show(); this.Visible = false; } }
public static ClientBank InputInSystem(int inpCurd, string inpPassword) { var client = User.GetUser(inpCurd); if (client != null) { if (!client.accessInATM) { MessageBox.Show("Ваш счет заблокирован"); return(null); } if (previousClientWhoTryToLogIn == null) { previousClientWhoTryToLogIn = client; } if (previousClientWhoTryToLogIn != client) { sizeOfTry = 3; } if (client.password == inpPassword) { numOfCurd = inpCurd; return(client); } else { --sizeOfTry; } if (sizeOfTry < 1) { client.SetAccess(false); EmploeeBank.AddMessage($"Пользователь {client.FIO} 3 раза ввел неправильный пароль!!! Его счет заблокирован"); MessageBox.Show("Ваш счет заблокирован"); } MessageBox.Show("Нерпавильный пароль!!! Введите еще раз"); return(null); } else { MessageBox.Show("Нет такого счета!!!"); return(null); } }
private void button1_Click(object sender, EventArgs e) { int newCurd = int.Parse(inputNumOfClientTextBox.Text); string newFIO = inputFIOOfClientTextBox.Text; string newPass = inputPassOfClientTextBox.Text; bool newStatus = true; int newBill = int.Parse(inputBillOfClientTextBox.Text); ClientBank newClient = new ClientBank(newCurd, newFIO, newPass, newStatus); BankAccount newBankAccount = new BankAccount(int.Parse(inputNumOfClientTextBox.Text), newBill); User.AddClient(newCurd, newClient); User.WriteToFileAllClients(); AllBankAccounts.AddBankAccount(newCurd, newBankAccount); AllBankAccounts.WriteToFileAllClients(); MessageBox.Show("Новый клиент добавлне в список"); inputNumOfClientTextBox.Clear(); inputFIOOfClientTextBox.Clear(); inputPassOfClientTextBox.Clear(); inputBillOfClientTextBox.Clear(); }
public static void ReadFromFileAllClients() { string fileName = "Users.txt"; try { StreamReader sr = new StreamReader(fileName); List <string> lists = new List <string>(); while (!sr.EndOfStream) { lists.Add(sr.ReadLine()); } int curd; string fio; string pass; bool status = true; for (int i = 0; i < lists.Count; i++) { string [] buff = lists[i].Split(';'); curd = Convert.ToInt32(buff[0]); fio = buff[1]; pass = buff[2]; status = Convert.ToBoolean(buff[3]); AddClient(curd, new ClientBank(curd, fio, pass, status)); } sr.Close(); } catch { var temp = new ClientBank(11111, "Грушев Вениамин Абрикосович", "123456"); AddClient(temp.numOfCurd, temp); temp = new ClientBank(22222, "Петров Петр Иванович", "123456789"); AddClient(temp.numOfCurd, temp); WriteToFileAllClients(); } }
public static void AddClient(int cod, ClientBank client) { allClients.Add(cod, client); }