def addMoneyTransfer(self, fromaccount, toaccount, happentime, money, currency, description, user): moneytransfer = MoneyTransfer(fromaccount = fromaccount, toaccount = toaccount, happentime = happentime, money = money, currency = currency, description = description, user = user) moneytransfer.put() AccountService().updateAccountMoney(fromaccount, money, -1) AccountService().updateAccountMoney(toaccount, money, 1)
def addMoneyTransfer(self, fromaccount, toaccount, happentime, money, currency, description, user): moneytransfer = MoneyTransfer(fromaccount=fromaccount, toaccount=toaccount, happentime=happentime, money=money, currency=currency, description=description, user=user) moneytransfer.put() AccountService().updateAccountMoney(fromaccount, money, -1) AccountService().updateAccountMoney(toaccount, money, 1)
def getMoneyTransfer(self, id, user): moneytransfer = None try: moneytransfer = MoneyTransfer.get_by_id(int(id)) if moneytransfer.user.id <> user.id: moneytransfer = None except: moneytransfer = None return moneytransfer
def getMoneyTransferCount(self, filter_dict, user): moneytransfer_list = MoneyTransfer.all() if filter_dict: for filter_key in filter_dict.keys(): moneytransfer_list = moneytransfer_list.filter(filter_key, filter_dict[filter_key]) if user: moneytransfer_list = moneytransfer_list.filter('user', user) return moneytransfer_list.count()
def getMoneyTransferCount(self, filter_dict, user): moneytransfer_list = MoneyTransfer.all() if filter_dict: for filter_key in filter_dict.keys(): moneytransfer_list = moneytransfer_list.filter( filter_key, filter_dict[filter_key]) if user: moneytransfer_list = moneytransfer_list.filter('user', user) return moneytransfer_list.count()
def getMoneyTransferList(self, filter_dict, orderby, pagesize, pagecount, user): moneytransfer_list = MoneyTransfer.all() if filter_dict: for filter_key in filter_dict.keys(): moneytransfer_list = moneytransfer_list.filter(filter_key, filter_dict[filter_key]) if user: moneytransfer_list = moneytransfer_list.filter('user', user) total_records = moneytransfer_list.count() if orderby: moneytransfer_list = moneytransfer_list.order(orderby) if pagesize > 0: moneytransfer_list = moneytransfer_list.fetch(pagesize, pagesize * (pagecount-1)) return moneytransfer_list, total_records
def getMoneyTransferList(self, filter_dict, orderby, pagesize, pagecount, user): moneytransfer_list = MoneyTransfer.all() if filter_dict: for filter_key in filter_dict.keys(): moneytransfer_list = moneytransfer_list.filter( filter_key, filter_dict[filter_key]) if user: moneytransfer_list = moneytransfer_list.filter('user', user) total_records = moneytransfer_list.count() if orderby: moneytransfer_list = moneytransfer_list.order(orderby) if pagesize > 0: moneytransfer_list = moneytransfer_list.fetch( pagesize, pagesize * (pagecount - 1)) return moneytransfer_list, total_records