-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
61 lines (54 loc) · 2.11 KB
/
Program.cs
File metadata and controls
61 lines (54 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// See https://aka.ms/new-console-template for more information
using System.Collections.Generic;
public class ATMAPP : IUserLogin
{
private List<UserAccount> userAccountList;
private UserAccount selectedAccount;
public void InitializeData()
{
userAccountList = new List<UserAccount>{
new UserAccount{Id =1, FullName = " saintmoses agbukor", AccountNumber=123456, CardNumber= 232323, CardPin=123123,AccountBalance=5000.00m, IsLocked=false},
new UserAccount{Id =2, FullName = " Amaka hope", AccountNumber=123345, CardNumber= 233245, CardPin=124545,AccountBalance=4000.00m, IsLocked=false},
new UserAccount{Id =3, FullName = " Rich kids", AccountNumber=123321, CardNumber= 233565, CardPin=123653,AccountBalance=3000.00m, IsLocked=true}
};
}
public void CheckUserCardNumberAndPassword()
{
bool isCorrectLogin = false;
UserAccount inputAccount = AppScreen.UserLoginForm();
AppScreen.LoginProcess();
foreach (UserAccount account in userAccountList)
{
selectedAccount = account;
if (inputAccount.CardPin.Equals(selectedAccount.CardPin))
{
selectedAccount = account;
if (selectedAccount.IsLocked || selectedAccount.TotalLogin > 3)
{
// print is locked message
AppScreen.PrintLockedScreen();
}
else
{
selectedAccount.TotalLogin = 0;
isCorrectLogin = true;
break;
}
}
if (isCorrectLogin == false)
{
Utility.PrintError("\nInvalid Card Number Or Pin", false);
selectedAccount.IsLocked = selectedAccount.TotalLogin == 3;
if (selectedAccount.IsLocked)
{
AppScreen.PrintLockedScreen();
}
}
Console.Clear();
}
}
public void Welcome()
{
Console.WriteLine($"Welcom back,{selectedAccount.FullName}");
}
}