def get_all(self):
     user_accounts = db.get(self.file_name)
     usr_acc_lst = []
     # [1,2]
     for account in user_accounts:
         usr_acc_lst.append(account.split(',')[2])
     usr_acc_lst.sort()
     return usr_acc_lst
Beispiel #2
0
 def get_all(self):
     user_accounts = db.get(self.file_name)
     usr_acc_lst = []
     # [1,2]
     for account in user_accounts:
         usr_acc_lst.append(account.split(',')[2])
     usr_acc_lst.sort()
     return usr_acc_lst
    def login(self, login_id, pincode):
        users = db.get(self.file_name)

        for user in users:
            attributes = user.split(',')
            if attributes[2] == login_id and attributes[3] == pincode:
                return self.get(attributes[0])

        return None
    def get_all_hashing(self):
        user_accounts = db.get(self.file_name)
        usr_accs = {}
        # {1: UserAccount, 2: {1,2,3,4}}
        for account in user_accounts:
            attributes = account.split(',')
            usr_accs.update({attributes[2]: UserAccounts(attributes[0], attributes[1], attributes[2], attributes[3], attributes[4], attributes[5])})

        return usr_accs
    def login(self, login_id, pincode):
        users = db.get(self.file_name)

        for user in users:
            attributes = user.split(',')
            if attributes[2] == login_id and attributes[3] == pincode:
                return self.get(attributes[0])

        return None
    def get(self, id):
        users = db.get(self.file_name)

        for user in users:
            attributes = user.split(',')
            if attributes[0] == id:
                return User(attributes[0], attributes[1], attributes[2], attributes[3], attributes[4])

        return None
    def _get(self, key, value):
        user_accounts = db.get(self.file_name)

        for account in user_accounts:
            attributes = account.split(',')

            if str(attributes[key]) == str(value):
                return UserAccounts(attributes[0], attributes[1], attributes[2], attributes[3], attributes[4], attributes[5])

        return None
    def get(self, id):
        users = db.get(self.file_name)

        for user in users:
            attributes = user.split(',')
            if attributes[0] == id:
                return User(attributes[0], attributes[1], attributes[2],
                            attributes[3], attributes[4])

        return None
    def save(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        data = "%s,%s,%s,%s,%s" % (self.id, self.name, self.login_id, self.pincode, self.type)
        users.append(data)
        db.save(self.file_name, users)
        return self
    def save(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        data = "%s,%s,%s,%s,%s,%s" % (self.id, self.user_id, self.account_number, self.balance, self.account_type, self.status)
        useraccounts.append(data)
        db.save(self.file_name, useraccounts)

        return self
Beispiel #11
0
    def _get(self, key, value):
        user_accounts = db.get(self.file_name)

        for account in user_accounts:
            attributes = account.split(',')

            if str(attributes[key]) == str(value):
                return UserAccounts(attributes[0], attributes[1],
                                    attributes[2], attributes[3],
                                    attributes[4], attributes[5])

        return None
Beispiel #12
0
    def save(self):
        transactions= []
        try:
            transactions= db.get(self.file_name)
        except Exception as e:
            pass

        data = "%s,%s,%s,%s,%s,%s,%s" % (self.id, self.account_number, self.amount, self.account_type, self.transaction_type, self.date, self.balance)
        transactions.append(data)
        db.save(self.file_name, transactions)

        return self
    def save(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        data = "%s,%s,%s,%s,%s" % (self.id, self.name, self.login_id,
                                   self.pincode, self.type)
        users.append(data)
        db.save(self.file_name, users)
        return self
    def delete(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(users):
            attributes = user.split(",")
            if self.id == attributes[0]:
                users.pop(index)

        db.save(self.file_name, users)
Beispiel #15
0
    def get_all_hashing(self):
        user_accounts = db.get(self.file_name)
        usr_accs = {}
        # {1: UserAccount, 2: {1,2,3,4}}
        for account in user_accounts:
            attributes = account.split(',')
            usr_accs.update({
                attributes[2]:
                UserAccounts(attributes[0], attributes[1], attributes[2],
                             attributes[3], attributes[4], attributes[5])
            })

        return usr_accs
    def delete(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(users):
            attributes = user.split(",")
            if self.id == attributes[0]:
                users.pop(index)

        db.save(self.file_name, users)
Beispiel #17
0
    def save(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        data = "%s,%s,%s,%s,%s,%s" % (self.id, self.user_id,
                                      self.account_number, self.balance,
                                      self.account_type, self.status)
        useraccounts.append(data)
        db.save(self.file_name, useraccounts)

        return self
    def delete(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(useraccounts):
            attributes = user.split(",")
            if self.account_number == attributes[2]:
                useraccounts.pop(index)

        db.save(self.file_name, useraccounts)

        return self
Beispiel #19
0
    def delete(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(useraccounts):
            attributes = user.split(",")
            if self.account_number == attributes[2]:
                useraccounts.pop(index)

        db.save(self.file_name, useraccounts)

        return self
    def update(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(users):
            attributes = user.split(",")
            if self.id == attributes[0]:
                users.pop(index)

        data = "%s,%s,%s,%s,%s" % (self.id, self.name, self.login_id, self.pincode, self.type)
        users.append(data)
        db.save(self.file_name, users)
        return self
    def update(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(useraccounts):
            attributes = user.split(",")
            if self.id == attributes[0]:
                useraccounts.pop(index)

        data = "%s,%s,%s,%s,%s,%s" % (self.id, self.user_id, self.account_number, self.balance, self.account_type, self.status)
        useraccounts.append(data)
        db.save(self.file_name, useraccounts)

        return self
    def update(self):
        users = []
        try:
            users = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(users):
            attributes = user.split(",")
            if self.id == attributes[0]:
                users.pop(index)

        data = "%s,%s,%s,%s,%s" % (self.id, self.name, self.login_id,
                                   self.pincode, self.type)
        users.append(data)
        db.save(self.file_name, users)
        return self
Beispiel #23
0
    def update(self):
        useraccounts = []
        try:
            useraccounts = db.get(self.file_name)
        except Exception as e:
            pass

        for index, user in enumerate(useraccounts):
            attributes = user.split(",")
            if self.id == attributes[0]:
                useraccounts.pop(index)

        data = "%s,%s,%s,%s,%s,%s" % (self.id, self.user_id,
                                      self.account_number, self.balance,
                                      self.account_type, self.status)
        useraccounts.append(data)
        db.save(self.file_name, useraccounts)

        return self