MCPcopy Index your code
hub / github.com/geekcomputers/Python / add_account_form_submit

Function add_account_form_submit

bank_managment_system/QTFrontend.py:1393–1484  ·  view source on GitHub ↗
(name, age, address, balance, account_type, mobile)

Source from the content-addressed store, hash-verified

1391 )
1392
1393 def add_account_form_submit(name, age, address, balance, account_type, mobile):
1394 if (
1395 len(name) != 0
1396 and len(age) != 0
1397 and len(address) != 0
1398 and len(balance) != 0
1399 and len(account_type) != 0
1400 and len(mobile) != 0
1401 ):
1402 try:
1403 balance = int(balance)
1404 except ValueError:
1405 show_popup_message(
1406 stacked_widget,
1407 "Balance must be a valid number",
1408 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1409 )
1410 return
1411 if balance < 0:
1412 show_popup_message(
1413 stacked_widget,
1414 "Balance cannot be negative",
1415 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1416 )
1417 return
1418 if account_type not in ["Savings", "Current", "Fixed Deposit"]:
1419 show_popup_message(
1420 stacked_widget, "Invalid account type", EMPLOYEE_CREATE_ACCOUNT_PAGE
1421 )
1422 return
1423 if len(mobile) != 10:
1424 show_popup_message(
1425 stacked_widget,
1426 "Mobile number must be 10 digits",
1427 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1428 )
1429 return
1430 if not mobile.isdigit():
1431 show_popup_message(
1432 stacked_widget,
1433 "Mobile number must contain only digits",
1434 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1435 )
1436 return
1437 if not name.isalpha():
1438 show_popup_message(
1439 stacked_widget,
1440 "Name must contain only alphabets",
1441 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1442 )
1443 return
1444 if not age.isdigit():
1445 show_popup_message(
1446 stacked_widget,
1447 "Age must contain only digits",
1448 EMPLOYEE_CREATE_ACCOUNT_PAGE,
1449 )
1450 return

Callers 1

setup_main_windowFunction · 0.85

Calls 2

show_popup_messageFunction · 0.85
create_customerMethod · 0.80

Tested by

no test coverage detected