Esempio n. 1
0
    def __init__(self, **kwargs):
        self.__session = Session()
        self.__args = kwargs
        self._retval = list()
        self.__search_filter = list()
        self.__search_param = ['branch_name']
        self.__data = None

        if not self.__args:
            self.__data = self.__session.query(T_Branch).order_by(
                T_Branch.branchid).all()

            for d in self.__data:
                r = d.toJSONExcept()
                self._retval.append(r)

        else:
            for key in self.__search_param:
                if key in self.__args and self.__args[key] not in (None, ""):
                    self.__search_filter.append(
                        getattr(T_Branch, key) == self.__args[key])

            if len(self.__search_filter) != 0:
                self.__data = self.__session.query(T_Branch).filter(
                    *self.__search_filter).order_by(T_Branch.branchid).all()

                for d in self.__data:
                    r = d.toJSONExcept()
                    self._retval.append(r)
Esempio n. 2
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self._retval = list()
     self.__search_filter = list()
     self.__search_param = ['add_ons_name']
     self.__data = None
Esempio n. 3
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self._retval = list()
     self.__search_filter = list()
     self.__search_param = ['member00id']
     self.__data = None
Esempio n. 4
0
    def __init__(self, **kwargs):
        self.__session = Session()
        self.__args = kwargs
        self._retval = list()
        self.__search_filter = list()
        self.__search_param = ['username', 'password', 'role']
        self.__data = None

        for key in self.__search_param:
            if key in self.__args and self.__args[key] not in (None, ''):
                self.__search_filter.append(
                    getattr(Users_table, key) == self.__args[key])

        if len(self.__search_filter) != 0:
            self.__data = self.__session.query(Users_table).filter(
                *self.__search_filter).order_by(Users_table.userid).all()

            for d in self.__data:
                r = d.toJSONExcept()
                self._retval.append(r)

        else:
            self.__data = self.__session.query(Users_table).order_by(
                Users_table.userid).all()

            for d in self.__data:
                r = d.toJSONExcept()
                self._retval.append(r)
Esempio n. 5
0
    def __init__(self, **kwargs):
        self.__session = Session()
        self.__args = kwargs
        self.__retval = dict()

        # column start for insert of image
        self.__column = 0
Esempio n. 6
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self._retval = list()
     self.__search_filter = list()
     self.__search_param = ['attendant_name', 'attendantid']
     self.__data = None
Esempio n. 7
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self._retval = list()
     self.__search_filter = list()
     self.__search_param = [
         'member00id', 'membertype', 'attendantid', 'upgraded_by'
     ]
     self.__data = None
Esempio n. 8
0
    def __init__(self, querytype='all', **kwargs):
        self.__session = Session()
        self.__args = kwargs
        self._retval = list()
        self.__search_filter = list()
        self.__search_param = [
            'active', 'transaction_type', 'transactionid', 'attendantid',
            'member00id'
        ]
        self.__data = None

        for key in self.__search_param:
            if key in self.__args and self.__args[key] not in (None, ""):
                self.__search_filter.append(
                    getattr(T_Transaction, key) == self.__args[key])

        ds = self.__args.get('from', None)
        de = self.__args.get('to', None)

        if ds and de:
            self.__search_filter.append(
                getattr(T_Transaction, 'datecreated').between(ds, de))

        if self.__search_filter:
            self.__data = self.__session.query(T_Transaction).filter(
                and_(*self.__search_filter)).order_by(
                    T_Transaction.datestart).all()

            for d in self.__data:
                r = d.toJSONExcept()
                time = datetime.datetime.strptime(r['datestart'],
                                                  '%m/%d/%Y %H:%M')
                r['started'] = time.time().strftime("%I:%M %p")
                etime = time + datetime.timedelta(
                    minutes=int(d.estimated_time))
                r['endtime'] = etime.strftime("%I:%M %p")
                self._retval.append(r)

        elif querytype is not None:
            self.__data = self.__session.query(T_Transaction).order_by(
                T_Transaction.datestart).all()

            for d in self.__data:
                r = d.toJSONExcept()
                time = datetime.datetime.strptime(r['datestart'],
                                                  '%m/%d/%Y %H:%M')
                r['started'] = time.time().strftime("%I:%M %p")
                etime = time + datetime.timedelta(
                    minutes=int(d.estimated_time))
                r['endtime'] = etime.strftime("%I:%M %p")
                self._retval.append(r)
Esempio n. 9
0
    def __init__(self, **kwargs):
        self.__session = Session()
        self.__data = ''
        self.__args = kwargs
        self.__search_filter = list()
        self.__search_param = ['username', 'password']
        self.__inputed_pass = None

        for key in self.__search_param:
            if key in self.__args and self.__args[key] not in (None, ''):
                if key in ('username'):
                    self.__search_filter.append(
                        getattr(Users_table, key) == self.__args[key])
                elif key in ('password'):
                    self.__inputed_pass = self.__args[key]

        if len(self.__search_filter) != 0:
            data = self.__session.query(Users_table).filter(
                *self.__search_filter)
            self.__data = [x for x in data]
Esempio n. 10
0
 def __init__(self):
     self.__session = Session()
Esempio n. 11
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
Esempio n. 12
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self.__retval = dict()
Esempio n. 13
0
 def __init__(self, **kwargs):
     self.__session = Session()
     self.__args = kwargs
     self.__retval = None
     self.__tempdict = dict()
     self.__total = 0