def getCompanyDetailsModel(): group = DBINT.DBFieldGroup('DB1','companydetails') DBINT.setDBReadGroup(group, 'id', 'name') group.read() idList = group.getItem('id').getAllValues() valList = group.getItem('name').getAllValues() return NM.NisDropdownModelImpl(valList,idList)
def __init__(self,table): langid = SESSINFO.getLangId() group = DBINT.DBFieldGroup('DB1',table) DBINT.setDBReadGroup(group, 'id', langid,'childtable',) group.getItem('id').setSortItem(); qItem = DBINT.DBFieldItem('status', ['ACTIVE']) qGroup = DBINT.QueryGroupAnd([qItem]) group.setQueryGroup(qGroup) group.read() self.names = group.getItem(langid).getAllValues() self.values = group.getItem('id').getAllValues() self.refs = group.getItem('childtable').getAllValues()
def validateComboDBData(tableName, val): group = DBINT.DBFieldGroup('DB1', tableName) DBINT.setDBReadGroup(group,'id') idItem = DBINT.DBFieldItem('id', val) qGroup = DBINT.QueryGroupAnd(idItem) group.setQueryGroup(qGroup) ret = group.read() if ret == False: return False id = group.getItem('id').getValue(0) if id == None: return False return True
def _readData(self): tableName = SESSINFO.getSessionInfo().getDBName() group = DBINT.DBFieldGroup('DB1', tableName) DBINT.setDBReadGroup(group,'height','weight','maritalstatus','physicalstatus','complexion', 'religion','caste','countryperm','stateperm','districtperm','placeperm', 'pinperm','countrytemp','statetemp','districttemp','placetemp','pintemp', 'education','occupationtype','occupation','company','companyemail','writtenby','aboutme') qGroup = DBINT.getDBTrustedQGroupAnd(id=SESSINFO.getSessionInfo().getId()) group.setQueryGroup(qGroup) if tableName == None: ''' Make all the groups and returns if the table name is none. ''' return group group.read() return group
def validateChainedData(tableName, dofullcheck,*valList): ''' Validates the chained combo data. Checks the databases to see if the given list is valid or not ''' newValList = [] for val in valList: val2 = UTIL.toInt(val) if val2 != None: newValList.append(val2) for val in newValList: if tableName == None: return False group = DBINT.DBFieldGroup('DB1', tableName) DBINT.setDBReadGroup(group,'id', 'childtable') statsItem = DBINT.DBFieldItem('status', 'ACTIVE') idItem = DBINT.DBFieldItem('id', val) qGroup = DBINT.QueryGroupAnd([statsItem, idItem]) group.setQueryGroup(qGroup) ret = group.read() if ret == False: return False id = group.getItem('id').getValue(0) if id == None: return False tableName = group.getItem('childtable').getValue(0) if dofullcheck == True and tableName != None: return False return True
def populateSessionInfo(self): group = DBINT.DBFieldGroup('DB1','credentials') self.group = group DBINT.setDBReadGroup(group, 'id', 'uname', 'status', 'langid', 'email', 'sex', 'name', 'dob', 'doj', 'doll', 'dname') queryGroup = _getQueryGroup(self.inUname, self.inSid) if queryGroup == None: return False group.setQueryGroup(queryGroup) ret = group.read() if ret == False: return False if group.getItem('uname').getValue(0) == None: return False ret = self._updateLastLoginTime() if ret == False: return False return True
def _readTable(title, name, suffix): group = DBINT.DBFieldGroup('DB1',name) DBINT.setDBReadGroup(group, 'id', 'eng', 'childtable', 'status') qItem = DBINT.DBFieldItem('status', 'ACTIVE') qGroup = DBINT.QueryGroupAnd(qItem) group.setQueryGroup(qGroup) group.read() ids = group.getItem('id').getAllValues() engs = group.getItem('eng').getAllValues() values = group.getItem('childtable').getAllValues() for i, subname in enumerate(values): if subname == None: # print title+suffix+'_'+str(ids[i])+' '+engs[i] _gTableDBs.append(title+suffix+'_'+str(ids[i])) _gTableNames.append(engs[i]) else: _readTable(title, subname, suffix+'_'+str(ids[i])) return [_gTableDBs,_gTableNames]