Ejemplo n.º 1
0
import banking.db.models as models
from banking.logic import session  # opens db, activates logic listener <--

# first delete, so can add
delete_cust = session.query(models.CUSTOMER).filter(models.CUSTOMER.CustNum == 2).delete()
print("\nadd_cust, deleting: " + str(delete_cust) + "\n\n")
session.commit()

# Add a Customer - works
new_cust = models.CUSTOMER(CustNum=2, Name='Tyler', City='Ormond', Street='123 main', State='FL', CheckingAcctBal=0, SavingsAcctBal=0)
session.add(new_cust)
session.commit()

verify_cust = session.query(models.CUSTOMER).filter(models.CUSTOMER.CustNum == 2).one()

print("\nadd_cust, completed: " + str(verify_cust) + "\n\n")

assert True
Ejemplo n.º 2
0
import datetime
import banking.db.models as models
from banking.logic import session  # opens db, activates logic listener <--

delete_deposit = session.query(
    models.CHECKINGTRANS).filter(models.CHECKINGTRANS.TransId == 100).one()
print("\ndelete checking trans, deleting row: " + str(delete_deposit))

delete_deposit = session.query(
    models.CHECKINGTRANS).filter(models.CHECKINGTRANS.TransId == 100).delete()
print("\ndelete checking trans, affected: " + str(delete_deposit) + " rows")
session.commit()

trans_date = datetime.datetime(2020, 10, 1)
deposit = models.CHECKINGTRANS(TransId=100,
                               CustNum=2,
                               AcctNum=2,
                               DepositAmt=1000,
                               WithdrawlAmt=0,
                               TransDate=trans_date)
print("\n\n - deposit checking trans: " + str(deposit))
session.add(deposit)
session.commit()

verify_deposit = session.query(
    models.CHECKINGTRANS).filter(models.CHECKINGTRANS.TransId == 100).one()

print("\nverify_deposit, completed: " + str(verify_deposit) + "\n\n")
import banking.db.models as models
from banking.logic import session  # opens db, activates logic listener <--

# first delete, so can add
delete_checking = session.query(
    models.CHECKING).filter(models.CHECKING.CustNum == 2).delete()
print("\ndelete checking, deleting: " + str(delete_checking) + "\n\n")
session.commit()

new_checking = models.CHECKING(CustNum=2,
                               AcctNum=2,
                               Deposits=0,
                               Withdrawls=0,
                               AvailableBalance=0,
                               ItemCount=0,
                               CreditCode=1,
                               AcctType='C')
session.add(new_checking)
session.commit()

verify_checking = session.query(
    models.CHECKING).filter(models.CHECKING.AcctNum == 2).one()

print("\nverify_checking, completed: " + str(verify_checking) + "\n\n")
import banking.db.models as models
from banking.logic import session  # opens db, activates logic listener <--

# first delete, so can add
delete_savings = session.query(
    models.SAVING).filter(models.SAVING.CustNum == 2).delete()
print("\ndelete savings, deleting: " + str(delete_savings) + "\n\n")
session.commit()

new_savings = models.SAVING(CustNum=2,
                            AcctNum=3,
                            Deposits=0,
                            Withdrawls=0,
                            AvailableBalance=0,
                            ItemCount=0,
                            AcctType='S')
session.add(new_savings)
session.commit()

verify_savings = session.query(
    models.SAVING).filter(models.CHECKING.AcctNum == 3).one()

print("\nverify_savings, completed: " + str(verify_savings) + "\n\n")