Esempio n. 1
0
	def chkid_len(self,main,a,b=None,c=None,d=None,e=False):

		if e:
			if len(a)==8 or len(a)==10 or a.count('x')==4:
				return True
			else:
				self.alert(main,'ID Less than 8 or 10!','ID length allowed is 8 or 10 \n You have #'+str(len(a))+' digits.')
				return False
		else:
			print("self table===="+self.table)
			print("Check by name is activated!")
			# que = "SELECT * FROM wp_2015ptainsuracelist where frm_stdname='%s' AND frm_std_middle_name='%s' AND frm_std_last_name='%s';" % (b,c,d)
			que = """SELECT * FROM """+self.table+""" where frm_stdname=? AND frm_std_middle_name=? AND frm_std_last_name=?"""
			fullname = (str(b),str(c),str(d))
			rr=main.dbsql3.data_query(que,fullname)
			p = Stack()
			print(b+" "+c+" "+d)
			print("student name! search")
			print(rr)
			if rr:
				for i in rr[0]:
					p.push(i)
				rrr=p.seek()
				OR = rrr[18]
				ins = rrr[16]
				reg = rrr[15]
				trans = rrr[19]
				if OR=='' and ins==0 and reg==0 and trans=='':
					return 'False1'
				if OR!='' and ins==0 and trans!='':
					return 'True1',rrr
				if OR!='' and ins!=0 and trans!='':
					return 'True2',rrr
			else:
				return 'False2'
Esempio n. 2
0
	def chkid_allrecord(self,m,rr1):
			# que = "SELECT * FROM wp_2015ptainsuracelist where frm_id='%s';" % (rr1)
			# rr=m.db.query(que)
			idData = (str(rr1),)
			que = """SELECT * FROM """+self.table+""" where frm_id==?"""
			rr=m.dbsql3.data_query(que,idData,False)
			print rr
			p = Stack()
			print(rr)
			if rr:
				for i in rr[0]:
					p.push(i)
				rrr=p.seek()
				OR = rrr[18]
				ins = rrr[16]
				reg = rrr[15]
				trans = rrr[19]
				print "Pass chkid_allrecord!******************"
				if OR=='' and ins==0 and reg==0 and trans=='':
					return 'False1',rrr
				if OR!='' and ins==0 and trans!='':
					return 'True1',rrr
				if OR!='' and ins!=0 and trans!='':
					return 'True2',rrr
			else:
				return 'False2'
Esempio n. 3
0
	def chkDate_allRec(self,m,a,camp):

		# que = "SELECT * FROM wp_2015ptainsuracelist where frm_time_date='%s';" % (a)
		# rr=m.db.query(que)
		dateData = (str(a),)
		que = """SELECT * FROM """+self.table+""" where frm_time_date==?"""
		rr=m.dbsql3.data_query(que,dateData,False)
		# print(rr)
		y = Stack()
		p= []
		str2=[]
		if rr:
			for i in rr:

				print(i)
				# OR = i[18]
				# ins = i[16]
				# reg = i[15]
				# trans = i[19]
				#
				if i[18]!='' and i[15]!=0 and i[16]!=0 and i[19]!='' and i[20]==camp:
					y.push(list(i))
				#Has a sibling and paid the insurance fee
				if i[18]!='' and i[15]==0 and i[16]!=0 and i[19]!='' and i[20]==camp:
					y.push(list(i))
				#declared but not insured
				if i[18]!='' and i[15]==0 and i[16]==0 and i[19]!='' and i[20]==camp:
					y.push(list(i))
			return True,y.seek()

			# ns!='':
				# return 'True2',rrr

		else:
			return False
Esempio n. 4
0
def infixToPrefix(infixexpr):
    ##记录操作符的优先级
    prec = {}

    prec["*"] = 3
    prec["/"] = 3
    prec["+"] = 2
    prec["-"] = 2
    prec["("] = 1
    opStack = Stack()
    prefixList = []
    tokenList = reversed(infixexpr.split())  ###:反转,来实现从右到左的扫描

    for token in tokenList:

        ##如果扫描是操作数,将其附加输出到列表末尾
        if token in "ABCDEFGHIJKLMNOPQRSTUVWXYZ" or token in "0123456789":
            prefixList.append(token)

        ##如果是右括号,将其压倒opStack上
        elif token == ')':
            opStack.push(token)

        ##如果标记是左括号,则弹出 s,直到删除相应的右括号。将每个运算符附加到输出列表的末尾
        elif token == '(':
            while opStack.seek() != ')':
                prefixList.append(opStack.pop())
            opStack.pop()

        # 如果标记是运算符, *,/,+  或  -  ,将其压入 s。
        # 但是,首先删除已经在s中具有更高或相等优先级的任何运算符,并将它们加到输出列表中
        else:
            while (not opStack.isEmpty()) and \
                (opStack.peek() != ')') and \
                (prec[opStack.peek()] > prec[token]):
                prefixList.append(opStack.pop())
            opStack.push(token)
    # 当输入表达式被完全处理时,检查 s。
    # 仍然在栈上的任何运算符都可以删除并加到输出列表的末尾
    while not opStack.isEmpty():
        prefixList.append(opStack.pop())

    #反转序列
    prefixList.reverse()
    return "".join(prefixList)