File tree Expand file tree Collapse file tree 2 files changed +41
-3
lines changed
Expand file tree Collapse file tree 2 files changed +41
-3
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,44 @@ public AtmApp2()
2121 Dictionary < string , string > usersFullName = new Dictionary < string , string > ( ) ;
2222 List < double > usebalance = new List < double > ( ) ;
2323
24+
25+ bool numbercontrol ( string text )
26+ {
27+
28+
29+ char [ ] control = text . ToLower ( ) . ToCharArray ( ) ;
30+ bool result = false ;
31+
32+ foreach ( char item in text )
33+ {
34+ switch ( item )
35+ {
36+ case '1' :
37+ case '2' :
38+ case '3' :
39+ case '4' :
40+ case '5' :
41+ case '6' :
42+ case '7' :
43+ case '8' :
44+ case '9' :
45+ case '0' :
46+ result = true ;
47+ break ;
48+
49+ default :
50+ break ;
51+
52+
53+ }
54+
55+ }
56+
57+ return result ;
58+
59+ }
60+
61+
2462 bool SignUpFullName ( string firstname , string lastname )
2563 {
2664 if ( firstname == "" && lastname == "" )
@@ -45,14 +83,14 @@ bool SignUp(string userId, string password)
4583 if ( userId != "" && userId . Length == 11 )
4684 {
4785
48- if ( password != "" && password . Length > 5 )
86+ if ( password != "" && password . Length > 5 && numbercontrol ( password ) == true )
4987 {
5088 users . Add ( userId , password ) ;
5189 return true ;
5290 }
5391 else
5492 {
55- MessageBox . Show ( "You entered the wrong password or ID !!" ) ;
93+ MessageBox . Show ( "You entered the wrong password or ID . Your password must have a number . !!" ) ;
5694 return false ;
5795 }
5896
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ static void Main()
1111 // To customize application configuration such as set high DPI settings or default font,
1212 // see https://aka.ms/applicationconfiguration.
1313 ApplicationConfiguration . Initialize ( ) ;
14- Application . Run ( new BusTicketApp ( ) ) ;
14+ Application . Run ( new AtmApp2 ( ) ) ;
1515 }
1616 }
1717}
You can’t perform that action at this time.
0 commit comments