Esempio n. 1
0
    def XFR(self, account1, account2, amount, name):
        Utility.checkAccountNumber(account1)
        Utility.checkAccountNumber(account2)
        Utility.checkAmount(amount)

        if name != self.Unused['name']:
            self.fatalAccountName('XFR', name)
        self.accounts.transfer(account1, account2, amount)
Esempio n. 2
0
    def DEP(self, account1, account2, amount, name):
        Utility.checkAccountNumber(account1)
        Utility.checkAmount(amount)

        if account2 != self.Unused['account']:
            self.fatalAccountNumber('DEP', account2)
        elif name != self.Unused['name']:
            self.fatalAccountName('DEP', name)
        else:
            self.accounts.deposit(account1, amount)
Esempio n. 3
0
    def WDR(self, account1, account2, amount, name):
        Utility.checkAccountNumber(account1)
        Utility.checkAmount(amount)

        if account2 != self.Unused['account']:
            self.fatalAccountNumber('WDR', account2)
        elif name != self.Unused['name']:
            self.fatalAccountName('WDR', name)
        else:
            self.accounts.withdraw(account1, amount)
Esempio n. 4
0
    def DEL(self, account1, account2, amount, name):
        Utility.checkAccountNumber(account1)
        Utility.checkAccountName(name)

        if account2 != self.Unused['account']:
            self.fatalAccountNumber('DEL', account2)
        elif amount != self.Unused['amount']:
            self.fatalAmount('DEL', amount)
        else:
            self.accounts.deleteAccount(account1, name)
Esempio n. 5
0
    def NEW(self, account1, account2, amount, name):
        Utility.checkAccountNumber(account1)
        Utility.checkAccountName(name)
        if account2 != self.Unused['account']:
            self.fatalAccountNumber('NEW', account2)
        elif amount != self.Unused['amount']:
            self.fatalAmount('NEW', amount)

        acct = self.accounts.getAccountByNumber(account1)
        if acct is not None:
            Utility.log('Account number already exists.')
        else:
            self.accounts.addAccount(account1, name)
Esempio n. 6
0
    def __init__(self, oldMasterFile, newMasterFile, accountsFile):
        lines = FileIO.readLines(oldMasterFile)
        if len(lines) < 1:
            Utility.fatal('Empty Master Accounts File')
        self.newMasterFile = newMasterFile
        self.accountsFile = accountsFile
        self.list = []
        count = 0
        for line in lines:
            line = line.strip("\r\n ")
            params = line.split(' ')

            if (len(params) != 3):
                Utility.fatal("Line " + str(count) +
                              " is invalid - parameter count != 3")

            Utility.checkAccountNumber(params[0])
            Utility.checkAmount(params[1])
            Utility.checkAccountName(params[2])

            self.list.append(Account(int(params[0]), int(params[1]),
                                     params[2]))